feat: send foreground agents to background - #233
Open
titouanmathis wants to merge 1 commit into
Open
Conversation
This was referenced Aug 24, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Foreground agents can take longer than expected. Today, the user must either keep waiting or stop the run.
This adds a one-way foreground-to-background transition without restarting the agent:
bin the conversation viewer to send a running foreground agent to the background.foregroundTimeoutMsto detach foreground agents automatically after a configured delay.0or omit the setting to keep the existing blocking behavior.The same session, promise, in-flight work, transcript, and worktree continue after detachment. The original
Agentcall returns the agent ID, and the normal background completion notification arrives later.Detached runs count against background concurrency. If the pool is full, the live run continues above capacity and queued work waits for capacity to become available.
The change also handles parent abort signals, completion races, repeated detach attempts, and shutdown cleanup.
Configuration
{ "foregroundTimeoutMs": 60000 }The setting is also available through
/agents → Settings → Foreground timeout.Verification
npm run lintnpm run typechecknpm run test— 1274 passed, 4 skippednpm run test:e2e— 52 passed, 4 skippednpm run buildRelated to #229.