Repository navigation
feat(claude): opt-in routed-only refusal of official Anthropic models - #7347
garysassano wants to merge 1 commit into
Conversation
claudeCode.routedOnly makes proxied Claude sessions refuse official Anthropic models instead of serving them from Anthropic, so a proxied session produces no Anthropic-bound traffic even with authMode auto in subscription mode. A native claude*/anthropic* selector that no alias or modelMap entry claims is refused before the caller-credential passthrough can forward it verbatim, and, when routing would settle it on the built-in Anthropic account pool (the managed native Messages lane and its bridge twin), refused again where the route settles - which also covers interaction targets mapped into the pool. count_tokens refuses the same ids before its passthrough branch; its local estimate stays available for routed selectors. Responses are 403 permission_error with code claude_routed_only; custom anthropic-wire relay providers are not refused. Surfaces: GET/PUT /api/claude-code, ocx claude config --routed-only, capability registry, GUI Claude page settings toggle with an active/defaults reminder in all 11 locales, generated skill surface. Tests cover both refusal homes, claimed selectors, count_tokens, the management round-trip, and the config schema refinement.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This pull request was already a draft. Its draft status will be preserved after every issue above is resolved. |
Ingwannu
left a comment
There was a problem hiding this comment.
Contract/coverage changes requested at 2a491d1.
- Register
tests/claude-integration/claude-routed-only.test.tsin BOTH the current test-layout explicit map (or its domain shard) and the independenttests/fixtures/test-layout-expected*.jsonmembership oracle. The complete 27-file diff adds the test but changes neither map. Regex placement alone is not the required independent membership registration. - Update the owning structure contract for the new routed-only setting and Messages/count_tokens refusal boundary. The guide and planning note are useful, but this diff changes shared config, routing eligibility, CLI/management settings and native/translated Messages behavior without any structure update. Document the native-selector vs mapped target rules, built-in pool vs custom Anthropic-wire destination distinction, default-off behavior and count-token behavior in the existing authority; keep rationale in its ADR scheme.
The live readiness gate also requests a UI screenshot. Retain Draft until those requirements, the author checklist and current-head functional CI are satisfied. UI/product disposition and the credential/destination refusal review remain separate requirements. This is a static contract review; no local suite, live provider call, security scan or fork-workflow approval was performed.
|
Thank you for the work here. We're closing this to keep the review queue manageable: the review findings are still unresolved and the change is mainly in the dashboard, which is outside the current sweep. You're welcome to reopen this or open a smaller PR against |
Summary
claudeCode.routedOnlymode that makes proxied Claude sessions refuse official Anthropic models instead of serving them from Anthropic, so a proxied session cannot produce Anthropic-bound traffic even when auth mode auto resolves to subscription.claude…/anthropic…selector that no alias ormodelMapentry claims is refused before the caller-credential passthrough can forward it verbatim, and again where the route settles if it would land on the built-in Anthropic account pool (the managed native Messages lane and its bridge twin alike — this also covers interaction targets mapped into the pool).count_tokensrefuses the same ids before its passthrough branch; its local estimate stays available for routed selectors. Refusals are HTTP 403permission_error, codeclaude_routed_only, with a message that names the resolve paths.PUT/GET /api/claude-code(routedOnlyboolean, unset-is-off),ocx claude config set --routed-only <on|off>, capability registry entry, GUI Claude page settings-card toggle (Save-committed like the other card fields) with an active/defaults reminder, locale catalogs updated in all 11 locales, generated skill surface refreshed.devlog/_plan/261002_claude_ux/060_routed_only.md.Verification
bun scripts/test.ts tests/claude-integration/claude-routed-only.test.ts— new suite (7 tests): refusal before the passthrough with and without ansk-ant-caller credential (the without-flag control attempts the verbatim forward through a stubbed global fetch), refusal where a mapped target settles on the OAuth pool, the without-flag control keeping the native lane open, count_tokens refusal vs. local estimate, the management round-trip, and the config-schema rejection; global fetch is stubbed to throw so any real network call fails the case.bun scripts/test.ts tests/claude-integration/claude-messages-endpoint.test.ts tests/claude-integration/claude-management-api.test.ts tests/claude-integration/messages-native.test.ts(214 pass) andbun scripts/test.ts tests/cli/cli-capabilities.test.ts tests/cli/cli-headless-parity.test.ts(125 pass).bun run typecheck,bun run skill:surface:check,bun run structure:check, and the file-size ratchet all pass;bun x tsc -bingui/passes; gui tests for the touched surfaces (claude-code-save,claude-code-types,claude-code-first-party, 78 pass) and pinnedoxlintpass.Checklist
docs-siteguide,devlog/_plan/261002_claude_ux, skill surface).Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.