Uh oh!
There was an error while loading. Please reload this page.
fix(opencode): forward parent attachments to subagents - #32302
Conversation
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
ChanGarcia10
commented
Jun 20, 2026
@rekram1-node This is a something that is needed in opencode right now. Right now it strips out the path, it's annoying to be working with agents that need the whole path for image reading. Can you take a look at this? |
qiming-zhao
commented
Jun 27, 2026
Hi, this issue also affects me on Windows CLI (opencode TUI). I'm using @Vision subagent with attached images and the images never get forwarded. The parent model can't process images and the vision subagent receives text-only context. |
CSWNDQTJ-Kenny
commented
Jul 28, 2026
This PR's approach matches what I independently arrived at — extract image/file parts from the triggering parent message and forward them into the child subagent prompt. Confirming it's the right fix and adding two notes that may help it land: 1. Source of parts — |
wstuckey
commented
Jul 30, 2026
This is solid. Can we please get this merged? |
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.How 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