feat(tui): detach foreground tasks to background with Ctrl+B - #976
Conversation
- Add Ctrl+B shortcut to detach all foreground Bash/subagent tasks at once - Show "Press Ctrl+B to run in background" hint in tool cards (Agent immediately, Bash after 10s) and in the agent group panel - Mark detached foreground subagents as ◐ backgrounded instead of ✓ Completed - Filter foreground tasks out of the /tasks panel (they appear after detach) - Steer the model away from blocking on TaskOutput after a detach
|
| Name | Type |
|---|---|
| @moonshot-ai/kimi-code-sdk | Patch |
| @moonshot-ai/kimi-code | Patch |
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9369d94691
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
- Preserve `◐ backgrounded` for detached subagents inside AgentGroupComponent by reusing getDerivedSubagentPhase in getSubagentSnapshot - Distinguish detached-from-foreground subagents from started-in-background ones so the latter still read as `done` - Let Ctrl+B fall through to readline backward-char at the idle prompt instead of always consuming the key
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a4d03117f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
- Auto-clear the "No foreground task running." hint via showDetachHint so it doesn't stick on the footer - Don't clobber a newer transient hint (e.g. exit confirmation) when the detach hint timer fires - Add FooterComponent.getTransientHint()
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bcd26d7b56
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
- Only mark foreground-running subagent cards as backgrounded (skip done/backgrounded cards so background resumes don't mutate older rows) - Count /tasks header from the filtered (background-only) task set so foreground-only sessions don't read misleading counts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5749a265b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Related Issue
No linked issue. This builds on PR #821 (core
detachBackgroundcapability) by adding the TUI entry point and the surrounding UX.Problem
Foreground Bash and subagent tasks block the current turn until they finish. PR #821 added the core RPC to detach an already-running foreground task into a background task, but there was no way to trigger it from the TUI. Users had to either wait for long commands / subagents to finish, or cancel them outright. There was also a subtle UX gap: after a detach, the tool-result prompt nudged the model to call
TaskOutput, which re-blocked the main agent and defeated the point of detaching.What changed
Ctrl+Bshortcut (active while streaming) that detaches all running foreground Bash / subagent tasks at once. A one-shot footer hint (Moved N tasks to background. /tasks to view.) confirms the action and auto-clears after a few seconds.Press Ctrl+B to run in backgroundhint — immediately for subagents (they are long-running by nature), after 10s for Bash (to avoid nagging on short commands). The agent group panel shows the same hint while any subagent is still running in the foreground.◐ backgroundedinstead of flipping to✓ Completed, so they are visually distinguishable from work that actually finished./taskspanel now filters out foreground tasks; they appear in the panel only after being detached.do NOT wait, poll, or call TaskOutput on it; continue with your current work, so detaching actually frees the main agent. Therun_in_background=trueprompt was also aligned to the Agent tool'sno polling neededwording.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.