Repository navigation
refactor(core): share subagent completion delivery - #46054
Merged
Merged
Conversation
kitlangton
enabled auto-merge (squash)
August 29, 2026 01:05
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 2026
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.
Why
Live subagent completion and restart recovery independently build the same parent notification, admit it to the Session, and acknowledge the background record. Changes to the message or delivery ordering therefore need to remain synchronized across two implementations.
This is a small behavior-preserving consolidation, not a notification-lifecycle redesign.
What Changes
Both callers use
SubagentCompletion.deliverfor result formatting, synthetic admission, and acknowledgment. The operation receives only the Session and Job capabilities it needs; it introduces no service, registry, or owned lifetime.flowchart LR Live[Live subagent completion] --> Deliver[SubagentCompletion.deliver] Restart[Recovered subagent result] --> Deliver Deliver --> Admit[Session.synthetic] Admit --> Ack[Job.completeBackground]resume: falseis selected at delivery time, preserving restart accounting.Live and recovery callers keep their different preflight checks, assistant-text selection, and missing-session policies. Production changes total
+55/-59, including the new 32-line module: four net lines deleted, with one shared delivery implementation.Scope
Subagent delivery only. Shell completion, manual-shell scheduling, Job persistence, and public contracts are unchanged. Observer ownership remains plugin-scoped, so this does not fix completion loss during plugin replacement or change the direct-SDK lifetime work in #45988.
Verification