Skip to content

fix(server): abort OpenCode child sessions on interrupt - #7770

Draft
NitayRabi wants to merge 2 commits into
pingdotgg:mainfrom
NitayRabi:fix/opencode-abort-child-sessions
Draft

fix(server): abort OpenCode child sessions on interrupt#7770
NitayRabi wants to merge 2 commits into
pingdotgg:mainfrom
NitayRabi:fix/opencode-abort-child-sessions

Conversation

@NitayRabi

@NitayRabi NitayRabi commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • enumerate OpenCode child sessions when interrupting a turn
  • abort child/sub-agent sessions before aborting the parent session
  • preserve parent abort behavior when child enumeration is unsupported or fails
  • add regression coverage for multiple child sessions

Closes #7769.

Why

OpenCode sub-agents use child sessions. Relying only on session.abort(parent) leaves T3 dependent on the installed OpenCode version propagating cancellation to all children. When that propagation fails, the child provider stream remains alive and can occupy a single-slot local inference server indefinitely.

Validation

  • vp test apps/server/src/provider/Layers/OpenCodeAdapter.test.ts (33 passed)
  • vp run --filter t3 typecheck
  • vp fmt --check apps/server/src/provider/Layers/OpenCodeAdapter.ts apps/server/src/provider/Layers/OpenCodeAdapter.test.ts
  • git diff --check

Note

Abort OpenCode child sessions before parent in interruptTurn

  • interruptTurn now queries context.client.session.children and aborts each child session concurrently before aborting the parent, continuing even if individual child aborts fail.
  • Adds the abortOpenCodeSessionTree helper to OpenCodeAdapter.ts to encapsulate this ordering and error handling.
  • Extends the test double and mock utilities to simulate child sessions, with a new test asserting child IDs appear in abortCalls before the parent session URL.
  • Risk: session.children failures default to an empty list, so a failing children query silently skips child aborts rather than surfacing the error.
📊 Macroscope summarized 05630bb. 1 file reviewed, 1 issue evaluated, 0 issues filtered, 1 comment posted

🗂️ Filtered Issues

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 48a6afec-4add-4277-9bbd-990dc8d64da3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 21, 2026
Comment thread apps/server/src/provider/Layers/OpenCodeAdapter.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCode Stop can leave sub-agent provider requests running

1 participant