fix(opencode): forward parent attachments to subagents#32302
Open
21pounder wants to merge 3 commits into
Open
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This was referenced Jun 15, 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.
Issue for this PR
Closes #25553
Type of change
What does this PR do?
This fixes the attachment handoff for
@mentionsubagents in thetaskpath.In the failing
#25553flow, the parent agent could spawn the subagent, butTaskToolonly rebuilt child prompt parts fromparams.prompt, so the image attached to the parent user message never reached the child session.This change forwards file parts from the triggering parent user message into the child prompt, but only when that parent message explicitly targets the same subagent. That keeps the fix scoped to the actual handoff boundary and lets multimodal subagents receive the attached image once they are spawned.
This does not try to solve cases where the parent LLM does not choose to call
taskat all. That routing decision is upstream model behavior, not something this patch can make deterministic.sequenceDiagram participant U as User participant P as Parent session participant B as build model participant T as TaskTool participant V as Child subagent U->>P: text + @vision + image P->>B: parent message B->>T: call task(subagent, prompt) T->>V: child prompt from params.prompt only Note over V: image missingsequenceDiagram participant U as User participant P as Parent session participant B as build model participant T as TaskTool participant V as Child subagent U->>P: text + @vision + image P->>B: parent message B->>T: call task(subagent, prompt) T->>T: collect file parts from the triggering parent user message T->>V: child prompt + forwarded image V-->>P: image analysis resultHow did you verify your code works?
POST /session/:id/messagerequest withtext + agent + filepartsGET /session/:id/messagethat the session stored the@visionmention and the image attachmentagent=visionagent=visionandmode=subagentbun typecheckfrompackages/opencodebun test --timeout 15000 test/tool/task.test.tsfrompackages/opencodeScreenshots / recordings
POST request with

text + agent + fileparts:Stored session message with
@visionand image attachment:Child session creation for the subagent:

Child subagent stream:

Regression test passing:

Checklist