fix: preserve Anthropic replay fidelity (#25377)

Anthropic is strict about replaying the latest assistant turn once it
contains signed or redacted reasoning. We were still mutating that turn
in a few Coder-owned places: dropping empty reasoning blocks on replay,
rewriting provider-tool history during sanitization, and in the worst
case sending a prompt we already knew Anthropic would reject.

This patch keeps the latest signed assistant immutable through Coder's
replay and sanitization paths, preserves empty signed or redacted
reasoning anywhere Coder owns the ledger, and fails before the provider
call if the prompt is still unsafe.

It also bumps the existing `coder/fantasy` `coder_2_33` fork that `main`
already uses to the commit containing coder/fantasy#35. These fixes have
also been upstreamed to charmbracelet/fantasy.

Closes CODAGT-409.
This commit is contained in:
Ethan
2026-05-18 15:20:33 +10:00
committed by GitHub
parent 3723f7a0c7
commit e75bd3aca4
9 changed files with 822 additions and 48 deletions
+4 -2
View File
@@ -88,8 +88,10 @@ replace github.com/spf13/afero => github.com/aslilac/afero v0.0.0-20250403163713
// when paired with reasoning, and validate function_call output pairing.
// 8) coder/fantasy#33, fail closed when Anthropic or OpenAI Responses
// streams close before their terminal events.
// See: https://github.com/coder/fantasy/commits/246c4ae7aff9e
replace charm.land/fantasy => github.com/coder/fantasy v0.0.0-20260507124503-246c4ae7aff9
// 9) coder/fantasy#35, preserve Anthropic replay fidelity for signed
// reasoning and provider-executed web_search error results.
// See: https://github.com/coder/fantasy/commits/cfca5fd82c5dd
replace charm.land/fantasy => github.com/coder/fantasy v0.0.0-20260514123132-cfca5fd82c5d
// coder/coder uses a fork of charmbracelet's fork of the Anthropic Go SDK
// with performance improvements and Bedrock header cleanup.