Skip to content

fix(background-subagent): keep card alive across turn for V1 background subagents - #264

Merged
grinev merged 1 commit into
grinev:mainfrom
vheins:fix/background-subagent-card
Oct 4, 2026
Merged

grinev merged 1 commit into
grinev:mainfrom
vheins:fix/background-subagent-card

Conversation

@vheins

@vheins vheins commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Problem

  • V1 background subagent card did not persist across the turn. The summary aggregation gate required tool.running + input.background, so completed states and metadata.background payloads were dropped. The next turn cleared the pending card before the child card could attach.

Fix

  • src/app/managers/summary-aggregation-manager.ts: accept running|completed and input.background|metadata.background; retain background intent until the child card attaches instead of clearing eagerly.
  • src/bot/events/handlers/tool-activity-handler.ts: isBackgroundTool honors metadata.background in addition to input.background.

Tests

  • Added cases in tests/app/managers/summary-aggregation-manager.test.ts covering running→completed transitions and both input.background / metadata.background signals.

…nd subagents

- FIX-BGSUB: V1 background subagents retired at turn boundary
  The gate now accepts running OR completed and input.background OR metadata.background; a background intent keyed by child session id is retained until the card attaches (task part can precede session.created); isBackgroundTool also honors metadata.background.
@vheins

vheins commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author

@grinev can you review and merge this? im make a litle plugin that make auto set subagent into background process like V2 behavior and its work for me, maybe usefull for other, Thanks.

https://github.com/vheins/opencode-asynchronous-agent

@grinev

grinev commented Oct 4, 2026

Copy link
Copy Markdown
Owner

@vheins thanks for contribution! I didn't know that opencode V1 also has background subagents

@grinev
grinev merged commit 0a73b91 into grinev:main Oct 4, 2026
1 check passed
@vheins

vheins commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@vheins thanks for contribution! I didn't know that opencode V1 also has background subagents

Thanks, its experimental feature and must be activated with env

export OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants