You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: @mention subagent with attached image in Web UI — image not forwarded to multimodal subagent #25553
When using @vision (a subagent with multimodal model) in the Web UI and attaching/drag-dropping an image in the same message, the image is processed at the parent agent level instead of being forwarded to the subagent. Since the parent agent uses a non-multimodal model (e.g., DeepSeek V4 Pro), it errors with:
ERROR: Cannot read "image.png" (this model does not support image input)
The vision subagent never receives the image data.
I reproduced this on the latest dev branch using bun dev serve.
The main failing path is the Web UI style request shape: the user message contains text + agent + file, where @vision is sent as an agent part, not a subtask part.
Reproduction
1. Create a session
POST http://localhost:4096/sessionContent-Type: application/json
{
"agentID": "build"
}
This returned session ses_13f04e5f9ffeU50f57Km5Zc5Yb.
2. Send one message containing @vision and an image attachment
The request payload shows the expected text + agent + file shape:
3. Inspect the stored session messages
GET http://localhost:4096/session/ses_13f04e5f9ffeU50f57Km5Zc5Yb/message
The stored message history shows that the parent session received the image together with the agent part:
The log shows the parent session runs on deepseek-v4-pro, but there is no child session creation and no vision subagent execution in the same request path:
What this confirms
This reproduces the issue on the main path that users hit from the app:
The user message contains an image attachment.
The @vision mention is persisted as an agent part.
The parent session processes the request with the primary model (deepseek-v4-pro in this repro).
The log does not show a vision child session being created or streamed for this request.
So the image is admitted into the parent message, but it does not make it into a multimodal vision subagent turn.
Root cause
There are two gaps in the current flow.
First, the app builds the request as text + agent + file:
The backend then handles the agent part by appending synthetic text instructing the parent model to call the task tool:
packages/opencode/src/session/prompt.ts:957
packages/opencode/src/session/prompt.ts:968
That means this path goes through the parent model first. It is not a direct subtask admission path.
Second, TaskTool.execute only reconstructs child prompt parts from params.prompt:
packages/opencode/src/tool/task.ts:187
resolvePromptParts(params.prompt) can resolve file references embedded in the prompt string, but it has no access to the already-admitted image file part from the parent user message. So even if the parent model does call the task tool, the attachment is not available to the child session unless it is explicitly threaded through.
Fix approach
I think the fix needs to cover the agent + file path directly, not only the direct subtask path.
When a task is spawned from a user message that includes media attachments, the task execution path should forward those file parts to the child prompt explicitly instead of relying only on params.prompt.
The forwarded attachments should be rebuilt as fresh child prompt parts rather than reusing persisted parent message part identities.
This fix can stay scoped to the case where the subagent is actually spawned and only needs the attachment handoff to be preserved across that boundary.
I have submitted a PR (#32302) to address this issue.
As detailed in my reproduction steps above, the root cause is that TaskTool.execute in packages/opencode/src/tool/task.ts only reconstructs child prompts from params.prompt, which completely leaves behind the original image/media file parts attached to the parent user message.
The PR fixes this by explicitly forwarding parent media attachments to the spawned subagent's prompt context.
Could you please take a look when you have a moment? Thank you!
Cross-linking the root cause analysis I posted on #34409 / #36020 / #32302:
The image not being forwarded is because TaskTool.runTask builds the child subagent prompt only from params.prompt via resolvePromptParts, which never reads ctx.messages. So the file part attached to the parent user message is silently dropped before the subagent is spawned — regardless of Web UI vs CLI, and regardless of whether the parent LLM is multimodal.
Minimal fix (matches #32302, which closes this issue but has been stalled since June):
A companion fix to unsupportedParts is also needed for config-defined OpenAI-compatible providers (doubao, kimi-vision, MiMo) — see #34409 comment for details. Both patches verified working on 1.17.20.
Activity
github-actions commentedon May 3, 2026
This issue might be a duplicate of existing issues. Please check:
Please review these issues to see if your report overlaps, and consider linking or closing if they address the same underlying problem.
21pounder commentedon Jun 14, 2026
I reproduced this on the latest
devbranch usingbun dev serve.The main failing path is the Web UI style request shape: the user message contains
text + agent + file, where@visionis sent as anagentpart, not asubtaskpart.Reproduction
1. Create a session
This returned session
ses_13f04e5f9ffeU50f57Km5Zc5Yb.2. Send one message containing
@visionand an image attachmentThe request payload shows the expected

text + agent + fileshape:3. Inspect the stored session messages
The stored message history shows that the parent session received the image together with the
agentpart:4. Inspect the server log for this request
The relevant log block for the same request is:
The log shows the parent session runs on
deepseek-v4-pro, but there is no child session creation and novisionsubagent execution in the same request path:What this confirms
This reproduces the issue on the main path that users hit from the app:
@visionmention is persisted as anagentpart.deepseek-v4-proin this repro).visionchild session being created or streamed for this request.So the image is admitted into the parent message, but it does not make it into a multimodal
visionsubagent turn.Root cause
There are two gaps in the current flow.
First, the app builds the request as
text + agent + file:packages/app/src/components/prompt-input/build-request-parts.tsThe backend then handles the
agentpart by appending synthetic text instructing the parent model to call thetasktool:packages/opencode/src/session/prompt.ts:957packages/opencode/src/session/prompt.ts:968That means this path goes through the parent model first. It is not a direct
subtaskadmission path.Second,
TaskTool.executeonly reconstructs child prompt parts fromparams.prompt:packages/opencode/src/tool/task.ts:187resolvePromptParts(params.prompt)can resolve file references embedded in the prompt string, but it has no access to the already-admitted image file part from the parent user message. So even if the parent model does call the task tool, the attachment is not available to the child session unless it is explicitly threaded through.Fix approach
I think the fix needs to cover the
agent + filepath directly, not only the directsubtaskpath.params.prompt.21pounder commentedon Jun 17, 2026
Hi @jlongster,
I have submitted a PR (#32302) to address this issue.
As detailed in my reproduction steps above, the root cause is that
TaskTool.executeinpackages/opencode/src/tool/task.tsonly reconstructs child prompts fromparams.prompt, which completely leaves behind the original image/media file parts attached to the parent user message.The PR fixes this by explicitly forwarding parent media attachments to the spawned subagent's prompt context.
Could you please take a look when you have a moment? Thank you!
CSWNDQTJ-Kenny commentedon Jul 28, 2026
Cross-linking the root cause analysis I posted on #34409 / #36020 / #32302:
The image not being forwarded is because
TaskTool.runTaskbuilds the child subagent prompt only fromparams.promptviaresolvePromptParts, which never readsctx.messages. So thefilepart attached to the parent user message is silently dropped before the subagent is spawned — regardless of Web UI vs CLI, and regardless of whether the parent LLM is multimodal.Minimal fix (matches #32302, which closes this issue but has been stalled since June):
A companion fix to
unsupportedPartsis also needed for config-defined OpenAI-compatible providers (doubao, kimi-vision, MiMo) — see #34409 comment for details. Both patches verified working on 1.17.20.github-actions commentedon Sep 27, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.