Skip to content

Fix blocking bugs: temporary-run 400 and Anthropic 401#1

Merged
eric007shine merged 2 commits into
modelscan:mainfrom
imphillip:fix/blocking-verification-bugs
Jun 11, 2026
Merged

Fix blocking bugs: temporary-run 400 and Anthropic 401#1
eric007shine merged 2 commits into
modelscan:mainfrom
imphillip:fix/blocking-verification-bugs

Conversation

@imphillip

Copy link
Copy Markdown
Contributor

Summary

Two independent, currently-blocking bugs in the core verification flows. Both fixes are small and isolated, each with a regression test.

1. Temporary verification against a real gateway always returns HTTP 400

The web UI's temporary flow posts only claimed_model (no model), but live_report required a model field via require_text and raised Missing required field: model. As a result every temporary verification against a real gateway failed — only the hardcoded gateway.example.test demo path worked, because it substitutes claimed_model for model.

Fix: make model optional, defaulting to claimed_model (matching the demo path and the frontend payload contract).

2. Anthropic-protocol verification always returns HTTP 401

Requests to /v1/messages only sent Authorization: Bearer + anthropic-version, never the x-api-key header the native Anthropic Messages API requires. Verifying api.anthropic.com (or any native Anthropic endpoint) always failed auth, all probes errored, and an honest Claude deployment was reported as unreachable/inconclusive.

Fix: add an anthropic_auth_headers helper that sends x-api-key while keeping Authorization: Bearer, so Anthropic-compatible gateways that expect a bearer token keep working.

Testing

pytest -q — all 48 pass, including two new regression tests:

  • test_temporary_live_run_defaults_model_to_claimed_model
  • test_call_model_anthropic_sends_x_api_key_header

Notes

  • Both commits are DCO Signed-off-by.
  • For bug 2 I send both x-api-key and Authorization: Bearer to maximize gateway compatibility while fixing native Anthropic. If you'd rather send only x-api-key in anthropic mode, happy to adjust.

🤖 Generated with Claude Code

imphillip and others added 2 commits June 10, 2026 23:53
The verifier UI's temporary flow posts only `claimed_model` and no
`model` field, but live_report required `model` via require_text and
raised "Missing required field: model". Every temporary verification
against a real gateway therefore failed with HTTP 400 — only the
hardcoded gateway.example.test demo path worked, because it substitutes
claimed_model for model.

Make `model` optional and default it to `claimed_model`, matching both
the demo path and the frontend payload contract. Add a regression test
that runs a respx-mocked live temporary verification with no `model`.

Signed-off-by: Phillip <phillip.wu@infothinker.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Anthropic-mode requests to /v1/messages only sent `Authorization:
Bearer` plus `anthropic-version`, never the `x-api-key` header the
native Anthropic Messages API requires. Verifying api.anthropic.com (or
any native Anthropic endpoint) always failed with 401, all probes
errored, and an honest Claude deployment was reported as
unreachable/inconclusive.

Add an `anthropic_auth_headers` helper that sends `x-api-key` while
keeping `Authorization: Bearer` so Anthropic-compatible gateways that
expect a bearer token keep working. Add a test asserting both headers.

Signed-off-by: Phillip <phillip.wu@infothinker.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@eric007shine eric007shine merged commit 181c091 into modelscan:main Jun 11, 2026
2 checks passed
@imphillip imphillip deleted the fix/blocking-verification-bugs branch June 11, 2026 12:29
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.

2 participants