Repository navigation
Composer ! shell mode: run a command in the worktree without a model turn (#470) - #1668
Conversation
…turn (#470) A leading ! turns the draft into a shell line. Enter runs it with sh -c in the thread's checkout through the quick-action runner (60s cap, one command per thread, refused during a run). Output streams into a single transcript card that ends with the exit code, with Copy and Add to prompt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dbd85d2a60
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| writeDraft(""); | ||
| try { | ||
| await onShell(command); |
There was a problem hiding this comment.
Prevent model turns while a shell command is running
While onShell is awaiting a potentially 60-second command, sending remains false and the cleared composer accepts and submits a normal prompt. The command path only checks whether an agent was active when the shell command started, while electron/runner.js waits only for pendingSetup, so the new model turn can run concurrently in the same checkout. For example, sending a prompt during !npm test lets the agent edit files underneath the test and makes its result unreliable; keep shell execution in a pending state that blocks or queues model turns until it settles.
Useful? React with 👍 / 👎.
| Shell: Enter runs this in the thread's checkout, no model | ||
| turn. 60s limit. |
There was a problem hiding this comment.
Make bare Enter execute shell lines
With the default coder.enterSends preference set to false, the existing keyboard handler only submits on modified Enter or Shift+Enter, so pressing the bare Enter advertised here merely inserts a newline into !command. This breaks the primary shell-style interaction for default installations; special-case shellMode in the Enter handler so bare Enter runs the command while still respecting IME composition.
Useful? React with 👍 / 👎.
Typing
!npm test(or!gh pr checks,!git status) in the composer now runs the line withsh -cin the thread's checkout. There's no model turn. Output streams into a card on the thread that ends with the exit code. This matches the!habit from Claude Code, Grok and Kimi, so one-off commands no longer cost a turn or a trip to a terminal. Closes #470.Changes
!mode: a leading!gives the box a green edge, a monospace font and a hint line. Enter, Cmd+Enter and Alt+Enter run the command and never send, steer or queue a prompt, even while the thread is busy. Context chips and attachments stay for the next prompt. If a command can't start, the line goes back into the box with the error. Ask threads don't get!.$ npm test · exit 1 · 0.8s. Shell cards open by default. Copy and Add to prompt (the existing P2: Make quick-action output inspectable and reusable in the composer #1216 path) give the next prompt the output.threads.runCommandtakes a newcommandfield and reuses the quick-action runner. That brings the existing guards: one command at a time per thread, refused while the agent runs, and web access already gated underterminal:type. Hard 60s cap. Commands over 500 characters are refused instead of silently cut short.Verification
/bin/shrun (printf first; sleep 1; printf second; exit 3) shows partial output reaching the card before exit, start and end sharing one event, and the exit code. A fake-runner test checks the 60s cap and the refusals for empty, over-long and mid-run commands.!while busy on a steer-capable provider calls the shell path only (no send, no steer); a failed start restores the line;!textwithout the shell hook stays a normal prompt.39356293:vite buildpass;ENOTEMPTYrmdir inworktrees-searchfiles.test.js, which this PR doesn't touch, and it passes 5/5 alone.Notes for reviewers
gh auth loginget end-of-input. A PTY belongs with Integrated terminal drawer scoped to the thread worktree #147.!while one is running is refused by the main process.claude-opus-5-5 via Claude Code
🤖 Generated with Claude Code