Repository navigation
feat(harness): enable Claude Code gateway hint headers - #122
Conversation
|
|
|
@FredLiu876 is this still needed given we already have |
Setup sets CLAUDE_CODE_GATEWAY_HINT_HEADERS=1 so Claude Code sends its request-class headers to the gateway, and teardown manages the key through claudePaths. The real-binary test checks the header arrives. LABS-312
…t type The router picker test and the API-format test both decoded the Codex catalog into untyped maps to read slugs. One test-only helper decodes it into a named struct and both tests call it. The routes API reports the router target as ROUTER, uppercase like the other target types, so the fixture now matches.
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The configuration changes are consistent across harnesses and adequately covered by focused tests.
Review effort: Balanced
Findings: None
What changed in this PR
Adds explicit harness identification headers and Claude Code gateway hints.
Changes:
- Configures
X-Baseten-Harnessacross all harnesses. - Enables Claude Code gateway hint headers.
- Tests header propagation, cleanup, and router-route selection.
| File | Description |
|---|---|
internal/harness/harness.go |
Defines the harness header. |
internal/harness/claude_code.go |
Configures headers and gateway hints. |
internal/harness/codex.go |
Adds the header to Codex requests. |
internal/harness/opencode.go |
Adds the header to OpenCode requests. |
internal/harness/harness_test.go |
Tests configuration and teardown. |
internal/cmd/command.harness_test.go |
Tests real requests and router routes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
f64e198 to
745851c
Compare
cretz
left a comment
There was a problem hiding this comment.
(approving from user POV, deferring to others on runtime behavior)
LABS-312, spec section 3: https://app.notion.com/p/3e691d2472738103a4b5f6ae8964114d
baseten harness setupsets CLAUDE_CODE_GATEWAY_HINT_HEADERS=1 for Claude Code, so it sends its request-class headers (x-claude-code-request-class and friends) to the gateway. They default to off when ANTHROPIC_BASE_URL is a custom origin, which is what setup writes. The SEG classifier (basetenlabs/baseten#31752, LABS-304) reads them.No X-Baseten-Harness after all (thanks @youngzheng-oss): every harness already identifies itself with X-Baseten-Client (#110), SEG forwards it, and the classifier keys on it with User-Agent fallback. A second duplicate header adds nothing today, and if the two concerns ever diverge, adding a new header then is additive.
Also here: a test pins a target.type: ROUTER route as the default route in all three harness pickers, and as the background route in Claude Code and OpenCode. Seeing the router route for real depends on the server-side routes API (basetenlabs/baseten#31292), already merged.
Testing: go fmt, go vet, go test ./..., including the real-harness test against Claude Code 2.1.289 and Codex, which confirmed Claude Code sends x-claude-code-request-class with the new env set.
Review notes: CLAUDE_CODE_GATEWAY_HINT_HEADERS is spelled out in both claudePaths and the setup list on purpose, matching how every other Claude env key in that file is written.