[PR #4221] fix: resolve @file references in slash commands with subagents #10906

Closed
opened 2026-02-16 18:15:40 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4221

State: closed
Merged: Yes


Fixes an issue where @file references in custom slash commands were not resolved
when the command specified agent: <subagent>.

Problem

When a slash command used both @file references and agent: foo, the file references
were passed literally to the subagent instead of being resolved to actual file
contents. This worked correctly for normal commands but failed for subagent
dispatch.

Solution

Extracted resolvePromptParts() function and reused it in the task tool pipeline
(packages/opencode/src/tool/task.ts:68) to ensure @file references are resolved
before subagent execution, matching the behavior of normal command handling.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4221 **State:** closed **Merged:** Yes --- Fixes an issue where `@file` references in custom slash commands were not resolved when the command specified `agent: <subagent>`. ### Problem When a slash command used both `@file` references and `agent: foo`, the file references were passed literally to the subagent instead of being resolved to actual file contents. This worked correctly for normal commands but failed for subagent dispatch. ### Solution Extracted `resolvePromptParts()` function and reused it in the task tool pipeline (`packages/opencode/src/tool/task.ts:68`) to ensure `@file` references are resolved before subagent execution, matching the behavior of normal command handling.
yindo added the pull-request label 2026-02-16 18:15:40 -05:00
yindo closed this issue 2026-02-16 18:15:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10906