Skip to content

feat: send foreground agents to background - #233

Open
titouanmathis wants to merge 1 commit into
tintinweb:masterfrom
titouanmathis:feat/foreground-background-timeout
Open

feat: send foreground agents to background#233
titouanmathis wants to merge 1 commit into
tintinweb:masterfrom
titouanmathis:feat/foreground-background-timeout

Conversation

@titouanmathis

Copy link
Copy Markdown

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:

  • Press b in the conversation viewer to send a running foreground agent to the background.
  • Set foregroundTimeoutMs to detach foreground agents automatically after a configured delay.
  • Use 0 or omit the setting to keep the existing blocking behavior.

The same session, promise, in-flight work, transcript, and worktree continue after detachment. The original Agent call 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 lint
  • npm run typecheck
  • npm run test — 1274 passed, 4 skipped
  • npm run test:e2e — 52 passed, 4 skipped
  • npm run build

Related to #229.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

<📍> feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants