fix(coderd/x/chatd/chatloop): tell the model to gather context before retrying an exclusive tool (#29281)

When the model batches `advisor` (an exclusive tool) with other tool
calls, every call in the batch is rejected and the `advisor` result only
says to retry with `advisor` alone. That nudges the model toward
re-calling `advisor` immediately, even when the sibling calls were there
to gather context for it.

Extend the message so the model is told to run the other tools first
when it still needs their output, then retry with only the exclusive
tool call.

Generated by Coder Agents on behalf of @ibetitsmike.
This commit is contained in:
Michael Suchacz authored and GitHub committed 2026-09-15 17:02:48 +02:00
1 parent f376f753b9
commit 0362e5386c
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -1220,7 +1220,7 @@ func exclusiveToolPolicyResults(
}
func exclusiveToolMustRunAloneErrorMessage(toolName string) string {
return toolName + " must be called alone, without other tools in the same batch. Retry with only the " + toolName + " call."
return toolName + " must be called alone, without other tools in the same batch. If you need more information to feed into the " + toolName + " call, execute the other tools first, then retry with only the " + toolName + " call."
}
func exclusiveToolSkippedErrorMessage(toolName string) string {
@@ -505,7 +505,7 @@ func TestExclusiveToolPolicy_MixedBatchErrors(t *testing.T) {
requireToolResultErrorMessage(
t,
results[0],
"advisor must be called alone, without other tools in the same batch. Retry with only the advisor call.",
"advisor must be called alone, without other tools in the same batch. If you need more information to feed into the advisor call, execute the other tools first, then retry with only the advisor call.",
)
requireToolResultErrorMessage(
t,
@@ -559,12 +559,12 @@ func TestExclusiveToolPolicy_MultipleExclusive(t *testing.T) {
requireToolResultErrorMessage(
t,
results[0],
"advisor must be called alone, without other tools in the same batch. Retry with only the advisor call.",
"advisor must be called alone, without other tools in the same batch. If you need more information to feed into the advisor call, execute the other tools first, then retry with only the advisor call.",
)
requireToolResultErrorMessage(
t,
results[1],
"advisor must be called alone, without other tools in the same batch. Retry with only the advisor call.",
"advisor must be called alone, without other tools in the same batch. If you need more information to feed into the advisor call, execute the other tools first, then retry with only the advisor call.",
)
}