fix(tui): double file content injection in commands using $ARGUMENTS (#31245)

Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
Tony Worm 2026-06-11 21:19:15 -07:00 committed by GitHub
parent fe2e4e21d0
commit a9c810cbbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1491,6 +1491,12 @@ export const layer = Layer.effect(
}
const templateParts = yield* resolvePromptParts(template)
const inputFiles = new Set(
input.parts?.filter((part) => new URL(part.url).protocol === "file:").map((part) => fileURLToPath(part.url)),
)
const uniqueTemplateParts = templateParts.filter(
(part) => part.type !== "file" || !inputFiles.has(fileURLToPath(part.url)),
)
const isSubtask = (agent.mode === "subagent" && cmd.subtask !== false) || cmd.subtask === true
const parts = isSubtask
? [
@ -1503,7 +1509,7 @@ export const layer = Layer.effect(
prompt: templateParts.find((y) => y.type === "text")?.text ?? "",
},
]
: [...templateParts, ...(input.parts ?? [])]
: [...uniqueTemplateParts, ...(input.parts ?? [])]
const userAgent = isSubtask ? (input.agent ?? (yield* agents.defaultInfo()).name) : agent.name
const userModel = isSubtask