fix: bedrock anthropic system prompt must be string by ibetitsmike · Pull Request #24685 · coder/coder · GitHub
Skip to content

fix: bedrock anthropic system prompt must be string#24685

Open
ibetitsmike wants to merge 3 commits intomainfrom
mike/bedrock-system-string
Open

fix: bedrock anthropic system prompt must be string#24685
ibetitsmike wants to merge 3 commits intomainfrom
mike/bedrock-system-string

Conversation

@ibetitsmike
Copy link
Copy Markdown
Collaborator

Mux working on behalf of Mike.

Problem

Anthropic chat calls that go through the Bedrock provider were failing with 400 validationException on affected Bedrock paths. Captured wire shape on the way out:

"system":[{"text":"you are helpful","type":"text"}]

Bedrock's Anthropic Messages schema expects system as a plain string.

Fix

The actual fix lives in the fantasy fork: coder/fantasy#28 (branch mike/bedrock-system-string, targeting coder_2_33). This PR:

  • Bumps charm.land/fantasy replace pin to the commit that contains the fix.
  • Tightens the existing diagnostic test TestModelFromConfig_Bedrock/CapturesSystemFieldShape to assert system is a JSON string equal to "you are helpful".

The diagnostic test landed in a separate commit first so the failing shape is visible in history without depending on the fantasy bump.

Verification

go test ./coderd/x/chatd/chatprovider/ -run 'TestModelFromConfig_Bedrock' -count=1 -v

All subtests pass, including CapturesSystemFieldShape which logs:

Bedrock system field JSON: "you are helpful"

Order of merge

coder/fantasy#28 needs to merge into coder_2_33 first. Once that merges, this PR will be rebased to pin to the merge commit on coder_2_33 rather than the PR branch tip.

Out of scope

No changes to chatprompt, chatloop, aibridge, or any other non-Bedrock path.

@ibetitsmike ibetitsmike changed the title fix(coderd/x/chatd/chatprovider): bedrock system prompt must be string fix: bedrock anthropic system prompt must be string Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant