fix(coderd): sanitize Anthropic provider tool history (#24706)

Anthropic can reject replayed chat histories when a provider-executed
tool call, such as `web_search`, is present without its matching
provider result block.

This sanitizes unpaired Anthropic provider-executed tool calls during
prompt reconstruction, before Anthropic requests, and before persistence
so existing poisoned histories can continue and new malformed turns are
not stored.

Resolves: CODAGT-259

> Mux is acting on Mike's behalf.
This commit is contained in:
Michael Suchacz
2026-04-24 23:57:30 +02:00
committed by GitHub
parent 780aa6ce94
commit 0211448d09
7 changed files with 1090 additions and 63 deletions
+1 -1
View File
@@ -1066,7 +1066,7 @@ func TestListChats(t *testing.T) {
}
}
return false
}, testutil.WaitShort, testutil.IntervalFast)
}, testutil.WaitLong, testutil.IntervalFast)
}
// Fetch first page with limit=2.