Skip to content

feat(claude): refuse Claude 5.x fallbacks and Mythos 5 on Bedrock - #4658

Merged
aheritier merged 3 commits into
feat/claude5x-model-tablefrom
feat/claude5x-safety-defaults
Oct 20, 2026
Merged

aheritier merged 3 commits into
feat/claude5x-model-tablefrom
feat/claude5x-safety-defaults

Conversation

@aheritier

@aheritier aheritier commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Supersedes #4656, same commits, moved to a docker/docker-agent branch because GitHub stacks cannot include fork PRs.

Closes #4652. Part of #4583 and epic #4580.

Stacked on #4657 (base branch feat/claude5x-model-table). This PR's diff shows only its own three commits; GitHub retargets it to main when #4657 merges.

What

Refuse two Claude 5.x configurations that docker-agent cannot serve correctly yet, at client construction and before any inference call:

  1. Server-side fallbacks involving Claude 5.x are rejected when the primary or any fallback is one of the nine 5.x models (gateway and Vertex spellings included), until feat(Claude): end-to-end server fallback for Claude 5.x #4584 handles a mid-response model switch. The error points to feat(Claude): end-to-end server fallback for Claude 5.x #4584. Absent or empty lists and chains without a 5.x model are unchanged. Malformed lists stay ignored, as before.
  2. claude-mythos-5 on Bedrock is refused. AWS serves it only through Bedrock Mantle, not the Converse API used here. claude-mythos-5-1 still works. The model table gains a BedrockMantleOnly field.

Both checks run where every construction path already validates options: validateThinkingOptions for Anthropic Direct, Vertex and Model Garden, and bedrock.NewClient for Bedrock. Clones, routing and gateway branches all pass through them.

⚠️ Breaking change

Fable 5/5.1 with fallbacks (the headline refusal-fallback use case) now fails at startup. This follows the rollout policy approved in #4580: the request is refused rather than half-supported until #4584. examples/anthropic-fallbacks.yaml and the docs example now use claude-opus-4-8 → claude-opus-4-7, and the docs carry a warning callout.

Not in this PR

Making thinking_prefix_mismatch: error the 5.x default moved to #4653. The runtime edits the conversation prefix (num_history_items trimming, hooks, compaction), so error would break those sessions until signed history can be replayed exactly. Both issues are updated.

References

Vendor documentation behind each change (all links checked on 2026-10-20):

Change Documentation
Fallback blocked for 5.x: a fallback can switch the serving model mid-response, supersede earlier tool calls, and route later requests to the fallback without a marker; billing is per attempt Refusals and server-side fallback
claude-mythos-5 refused on Bedrock: served only through Bedrock Mantle, not the runtime/Converse API AWS model card: Mythos 5, Endpoint availability
claude-mythos-5-1 still allowed on Bedrock Converse AWS model card: Mythos 5.1
thinking_prefix_mismatch: error default deferred to #4653: error rejects replayed thinking whose prefix changed, which the runtime does when trimming history Preserved thinking

Validation

  • task build passes.
  • golangci-lint v2.14.0 reports 0 issues, and go run ./lint . reports no offenses.
  • go test ./e2e -run '^TestWasmProviderDependencies$|^TestDependencies$' passes.
  • task test fails only the 10 pre-existing pkg/teamloader TestLoadExamples Gemini cases (GOOGLE_API_KEY or GEMINI_API_KEY environment variable is required under .env.test). They fail identically on main.
  • An independent review found no critical or important issues; its three minor findings are fixed in 26b5321.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 22:24
@aheritier
aheritier requested a review from a team as a code owner October 19, 2026 22:24
@aheritier
aheritier added this pull request to stack #4659 October 19, 2026 22:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused guards match the scoped requirements, preserve legacy behavior, and have regression coverage with no unresolved findings.

No open issues 🎉

What changed in this PR

Adds startup guards for unsupported Claude configurations in Docker Agent’s existing provider clients.

Changes:

  • Rejects non-empty fallback chains involving the nine recognized Claude 5.x models.
  • Refuses Mythos 5 on Bedrock Converse while allowing Mythos 5.1.
  • Adds regression coverage and updates documentation, schema descriptions, and examples.
File Description
pkg/​modelinfo/​claude5.go Marks Mythos 5 as Mantle-only.
pkg/​modelinfo/​claude5_test.go Checks the new model flag.
pkg/​model/​provider/​bedrock/​client.go Rejects Mantle-only models at construction.
pkg/​model/​provider/​bedrock/​client_test.go Covers Mythos 5 rejection and 5.1 acceptance.
pkg/​model/​provider/​anthropic/​vertex/​vertex_test.go Checks Vertex fallback rejection.
pkg/​model/​provider/​anthropic/​thinking_test.go Adjusts display-validation fixtures.
pkg/​model/​provider/​anthropic/​thinking_binding.go Invokes fallback validation.
pkg/​model/​provider/​anthropic/​thinking_binding_test.go Adjusts binding fixtures around the guard.
pkg/​model/​provider/​anthropic/​features_integration_test.go Updates display and binding integration coverage.
pkg/​model/​provider/​anthropic/​fallbacks.go Implements Claude 5.x fallback rejection.
pkg/​model/​provider/​anthropic/​fallbacks_test.go Covers rejected and unchanged fallback configurations.
examples/​anthropic-fallbacks.yaml Uses a legacy-model fallback chain.
docs/​providers/​bedrock/​index.md Documents the Mythos 5 restriction.
docs/​providers/​anthropic/​index.md Documents fallback restrictions and updates examples.
agent-schema.json Describes the temporary fallback restriction.

Review effort: Balanced

@aheritier aheritier added area/docs Documentation changes area/providers/anthropic For features/issues/fixes related to the usage of Anthropic models area/providers/bedrock AWS Bedrock provider support kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Oct 19, 2026
#4584

Signed-off-by: Arnaud Héritier <aheritier@apache.org>
Signed-off-by: Arnaud Héritier <aheritier@apache.org>
- Drop the Fable example from the server-side fallback comment; that
  configuration is now rejected.
- Build the Bedrock Mantle-only error from the configured model ID.
- Move unit-test fixtures off Claude 5.x fallbacks that the constructor
  now rejects.

Signed-off-by: Arnaud Héritier <aheritier@apache.org>
@aheritier
aheritier force-pushed the feat/claude5x-safety-defaults branch from 782564e to 26b5321 Compare October 20, 2026 06:41
@aheritier
aheritier added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit e5aaa97 Oct 20, 2026
22 checks passed
@aheritier
aheritier deleted the feat/claude5x-safety-defaults branch October 20, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation changes area/providers/anthropic For features/issues/fixes related to the usage of Anthropic models area/providers/bedrock AWS Bedrock provider support kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(anthropic): Claude 5.x safety defaults (prefix error, temporary fallback block, Mythos 5 on Converse)

3 participants