Starting Bash with -i suspended my Python program
Adding -i to the Bash backend made my Python application stop before it could accept input.
I wanted Bash to load interactive startup configuration. Instead, launching agentsh produced a stopped-job message. The kernel had suspended the REPL with SIGTTIN when it tried to read the terminal.
The July 16 fix starts the interactive child in its own session. This is one of the terminal responsibilities that came with choosing a managed REPL.
Interactive Bash has job-control behavior
The backend communicates with Bash through pipes. But pipes don’t, by themselves, isolate the child from the parent’s controlling terminal.
In the failing arrangement, interactive Bash inherited the terminal session. Its job-control setup claimed the foreground process group. Agentsh then tried to read input from the terminal while its own group was in the background.
The process relationship was roughly:
Controlling terminal
shared session
Python agentsh REPL
interactive Bash backend
-> claims foreground group
Python's next terminal read -> SIGTTIN -> stopped REPL
This wasn’t the shell command taking too long to finish. The input-owning application had been suspended.
The launcher has to choose a session boundary
The relevant launch now includes:
proc = await asyncio.create_subprocess_exec(
"bash",
"-i",
stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.DEVNULL,
start_new_session=True,
)
The new child session has no controlling terminal to take from the REPL. Bash can load its interactive configuration without becoming the owner of the application’s input terminal.

Illustration: separate workspaces as a metaphor for the session boundary.
That doesn’t turn the pipes into a PTY. Programs launched inside the backend still don’t gain transparent access to an interactive screen. The change addresses foreground ownership while preserving the process model I chose.
The regression needs to inspect the process
The failure can be reproduced by launching the earlier interactive backend from a terminal where the parent has a controlling terminal. Running the same code in a headless test process may miss that condition.
The added regression test checks a narrower invariant after starting the backend:
assert os.getsid(proc.pid) != os.getsid(0)
That establishes a separate session. It doesn’t reproduce every terminal interaction, but it checks the launch property intended to prevent this failure.
With -i, Bash still needs its startup output drained and history expansion disabled before I send the first command. It now does that in a session of its own.