Repository navigation
feat(XCOD-82): background subagents as a documented setting, /tasks, lifecycle (part 2) - #28
Merged
Merged
Conversation
…lifecycle (part 2)
- Graduated: `"subagent": { "background": true }` (off by default) turns
background subagents on; OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS still
works as an alias. Every check (task tool, capabilities, session
background route, run/local run) goes through backgroundEnabled(). Kept
opt-in because upstream still ships it as experimental and its follow-up
fixes (anomalyco#29179, anomalyco#30790, anomalyco#31162) were model-behaviour issues.
- Monitoring: GET /experimental/background[?sessionID] lists task jobs with
status, elapsed, agent, resolved model and rule; POST
/experimental/background/{jobID}/cancel cancels through the same run-state
path as an abort. TUI /tasks (alias /background) shows the same, refreshes
every second, opens a job's child session on Enter, cancels with ctrl+d.
- Lifecycle written down in specs/background-subagents.md, with the tests
that cover each case: abort cancels recursively, delete cancels,
compaction doesn't touch jobs, process exit loses them (registry is
process-local) but the child session stays and resumes via task_id.
- Parity note against Claude Code in the same spec.
Verified in a real terminal (pty, 140x45) against an OpenAI-compatible
model server: the main agent launched "General Task (background) — survey
repo"; /tasks listed "survey repo general · fake/m running · 21s"; ctrl+d
→ "Background subagent cancelled", status "cancelled"; Enter opened the child
session, whose turn shows "interrupted".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Part 2 of XCOD-82, completing the ticket. Part 1 (model selection) was #27.
Graduated
"subagent": { "background": true }. It's off by default, andOPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTSstill works as an alias.backgroundEnabled(). That covers the task tool, capabilities, the session-background route, and bothrunpaths.Monitoring
GET /experimental/background[?sessionID]lists task jobs with status, elapsed time, agent, resolved model and the rule that chose it.POST /experimental/background/{jobID}/cancelcancels through the same run-state path as an abort, so the job's own descendants stop too./tasks(alias/background) shows the same list and refreshes every second. Enter opens a job's child session, andctrl+dcancels it.ctrl+xis the leader key, which is why cancel isn't on it.Lifecycle and parity
specs/background-subagents.mdcovers each lifecycle case, along with the test that covers it, and a parity table against Claude Code:task_id.Verification
Real terminal (pty, 140x45), with a real
lunosTUI talking to an OpenAI-compatible model server:General Task (background) — survey repo./taskslistedsurvey repo general · fake/m running · 21s.ctrl+dshowed the toast "Background subagent cancelled", and the row changed tocancelled.interrupted.Tests:
task.test.tsis 24/24. New cases: the config key alone enables background runs, and a running job is listed with agent, model and rule, then cancelled.turbo typecheckpasses after./script/generate.ts.v2 pty HttpApi > serves location-wrapped PTY routes…, failed once under full-suite load. It passes 3/3 in isolation on this branch and 2/2 ondev, like the pty test already in the known-flaky list.🤖 Generated with Claude Code