Repository navigation
fix(server): stop OpenCode child sessions and route their approvals - #210
Conversation
OpenCode runs each subagent in a child session. The adapter only aborted the parent and dropped events from other session IDs, so child model requests and approval prompts could continue after Stop. Track descendant sessions, route child permission and question events onto the parent thread after ancestry is verified, and walk the child tree on interrupt and teardown. Unrelated sessions are left alone. OpenCode Go stays on Mastra. Adapted from pingdotgg#8480 and pingdotgg#9005. Made with Grok 4.6 High in Grok Build via Orca.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis update ensures child OpenCode approval and question events are routed to their owning parent session, including terminal events received while ancestry is still being resolved. Confidence Score: 5/5Safe to merge. The previous approval-routing issue is resolved. greptile-apps[bot] resolved it without explanation; the current code retains a terminal event received during ancestry resolution and emits it after the child session is confirmed as related. Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
A child permission reply that arrived while ancestry was still unknown was dropped because the request already had a retry. After ancestry resolved, only request.opened was forwarded, so the approval stayed open. Remember the terminal event on the pending retry and emit it after the opened event. Made with Grok 4.6 High in Grok Build via Orca.
…ssions # Conflicts: # docs/internals/providers.md
|
This is Leo's agent. The independent lifecycle-race regression still fails on refreshed head e6a7437. The 39 committed OpenCodeAdapter tests pass, but the additional deterministic test against the unchanged shipped adapter ends with Sequence: hold the child Re-run: Please retain the repair hold: reconcile in-flight ancestry retries with lifecycle-established ownership and already-settled requests, add a committed deterministic regression for this interleaving, and rerun review. Existing Orca access remains unavailable to this supervisor, so this comment is not a worker-delivery or repair-execution receipt. |
* fix(server): stop OpenCode child sessions and route their approvals OpenCode runs each subagent in a child session. The adapter only aborted the parent and dropped events from other session IDs, so child model requests and approval prompts could continue after Stop. Track descendant sessions, route child permission and question events onto the parent thread after ancestry is verified, and walk the child tree on interrupt and teardown. Unrelated sessions are left alone. OpenCode Go stays on Mastra. Adapted from pingdotgg#8480 and pingdotgg#9005. Made with Grok 4.6 High in Grok Build via Orca. * fix(server): keep child OpenCode replies during ancestry retry A child permission reply that arrived while ancestry was still unknown was dropped because the request already had a retry. After ancestry resolved, only request.opened was forwarded, so the approval stayed open. Remember the terminal event on the pending retry and emit it after the opened event. Made with Grok 4.6 High in Grok Build via Orca. * fix(server): auto-reply full-access OpenCode permission asks Full-access threads still surfaced OpenCode permission dialogs for doom-loop and subagent asks that never consult the session ruleset. Reply once off the event pump, without a persistent always grant, and fall back to the dialog if that reply fails. Depends on child-session routing in #210. Adapted from pingdotgg#9282. Made with Grok 4.6 High in Grok Build via Orca. * fix(server): abort timed-out OpenCode approvals * test(server): drain full-access approval events * test(server): bound OpenCode reply barrier * test(server): type reply timeout failure
Problem
OpenCode runs each subagent in a separate child session. Akeru only aborted the parent session and dropped events whose
sessionIDwas not the parent. Child model requests could keep running after Stop, and child permission or question prompts never appeared on the parent thread.Adaptation
This ports child-session ownership and descendant abort from upstream T3 Code onto the live legacy OpenCode adapter. It does not change OpenCode Go's Mastra controller, Codex, or Kimi.
session.created/session.updatedparent links.session.childrenand abort every descendant, with SDK list/abort concurrency capped at 8.Akeru subscription env, MCP headers/credentials, lazy attachments, and raw event retention are unchanged.
Upstream
Adapted from pingdotgg/t3code#8480 (child request routing and ancestry) and pingdotgg/t3code#9005 (descendant abort).
Scope
apps/server/src/provider/Layers/OpenCodeAdapter.tsdocs/internals/providers.mdNot in this PR: CLI probe bounding (pingdotgg#8750, pingdotgg#10427, see #205), full-access auto-reply (pingdotgg#9282), approval retry / stuck running (pingdotgg#9653), revert boundaries (pingdotgg#9924), part-index memory, or SDK skill loading (pingdotgg#9585).
Verification
vp test run apps/server/src/provider/Layers/OpenCodeAdapter.test.ts— 38 tests passed, including child permission routing, unrelated-session isolation, ancestry recovery, nested descendant abort, and child-abort failure.No live OpenCode CLI or browser pass: this is adapter protocol behavior covered by the recorded mock. End-to-end bot/group cancellation remains blocked until an OpenCode runtime and credentials are available in the isolated environment.
Limitations
Prompt send serialization, idle reconciliation, and failed-reply retry from later upstream follow-ups are still separate work. Windows was not exercised; child abort uses the same SDK client as the parent session.
Made with Grok 4.6 High in Grok Build via Orca.