You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: submit-after-ready pastes and submits the prompt into the shell when the agent CLI already exited #25628
With promptDelivery: 'submit-after-ready', planLaunchAgentStartupPrompt (src/renderer/src/lib/launch-agent-startup-prompt-plan.ts) launches the agent with an empty prompt and later pastes the prompt and presses Enter once the pane looks ready:
if(hasPrompt&&promptDelivery==='submit-after-ready'){// Why: multi-line generated prompts are too large for a shell argv, so launch clean then paste+submit in the TUI.returnpasteAfterReady(true)}
If the agent CLI exits immediately (rejected flag, missing auth, a wrapper binary on PATH with the agent's name), the shell is the foreground process when the paste happens. Each line of the prompt is then run by the shell as a command.
Observed
Launching an agent tab through launchAgentInNewTab({ promptDelivery: 'submit-after-ready', prompt: <multi-line generated text> }) where the agent binary on PATH was a wrapper that exited with ERROR: no prompt (no stdin and no positional args). The terminal then showed bash running every line of the prompt (command not found, syntax error near unexpected token, …). In this case nothing harmful ran, but generated text containing $(…), backticks or a valid command line would be executed.
Expected
A prompt meant for an agent is never submitted to a shell. For example: before pasting, confirm the expected agent process is still the PTY's foreground process (the stdin-after-start follow-up path already avoids sending into a shell when the agent never starts), and never press Enter when it is not.
Notes
Reproduced against a fork that carries this code unchanged; upstream main (d173514) has the same planner path.
Workaround we use: send generated text through a file and pass only a fixed one-line pointer as the launch argument (auto-submit), so nothing generated is ever typed into a terminal.
Activity
leilei3167 commentedon Oct 6, 2026
I'll look into this. Once the launched CLI has already exited, the delayed paste should not be submitted into the shell.
leilei3167 commentedon Oct 6, 2026
Stepping back from this. Open changes already touch the same paste files (#18996, #24115), so I won't add another one on top.