Repository navigation
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 19, 2026, 11:54 PM ET / 03:54 UTC. Summary PR surface: Source +41, Tests +67. Total +108 across 4 files. Reproducibility: yes. for source-level stale-header behavior: current main and v2026.6.8 still use claude-cli/2.1.75 in both Anthropic OAuth header builders. I did not live-test Anthropic's credentialed rejection in this read-only review. Review metrics: 2 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land one canonical fix that gets the Claude Code version from a supported CLI/backend install source or an explicit packaged dependency contract, covers both OAuth builders, and includes redacted OpenClaw header proof. Do we have a high-confidence way to reproduce the issue? Yes for source-level stale-header behavior: current main and v2026.6.8 still use claude-cli/2.1.75 in both Anthropic OAuth header builders. I did not live-test Anthropic's credentialed rejection in this read-only review. Is this the best way to solve the issue? No. Sharing one lazy helper across both headers is the right direction, but this implementation uses a package-graph lookup that is not proven for OpenClaw's supported external CLI install layouts and still lacks real OpenClaw proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against af9b0262412b. Label changesLabel justifications:
Evidence reviewedPR surface: Source +41, Tests +67. Total +108 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
be24908 to
95e2856
Compare
…dcoded constant The Anthropic provider hardcoded claudeCodeVersion = "2.1.75" in two places (anthropic.ts and anthropic-transport-stream.ts). Every OAuth bearer request sent user-agent: claude-cli/2.1.75 regardless of the actually installed Claude Code version. Anthropic's API validates claude-cli/* user-agents against a recency window and rejects stale versions with authentication_error, breaking all OAuth-routed inference when the installed CLI is significantly newer. Replace both hardcoded constants with a runtime resolution that reads the version from @anthropic-ai/claude-code/package.json via createRequire. Falls back to "0.0.0" when the package is not installed, matching the project's existing version-resolution pattern in src/version.ts. Closes openclaw#94716
95e2856 to
4b2eae2
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Closing this PR — unable to provide the real OAuth environment proof that ClawSweeper requires for auth-provider merge-risk. Best of luck to the other sibling PRs. |
Summary
Two hardcoded
claudeCodeVersion = "2.1.75"constants insrc/llm/providers/anthropic.tsandsrc/agents/anthropic-transport-stream.tscause every Anthropic OAuth bearer request to senduser-agent: claude-cli/2.1.75regardless of the actually installed Claude Code version. Anthropic's API validatesclaude-cli/*user-agents against a recency window and rejects stale versions withauthentication_error: Invalid bearer token, breaking all OAuth-routed inference when the installed CLI is significantly newer (e.g. 2.1.177).Replace both hardcoded constants with a shared
resolveClaudeCodeVersion()resolver insrc/llm/utils/claude-code-version.tsthat reads the version from@anthropic-ai/claude-code/package.jsonviacreateRequire. Throws a configuration error instead of silently falling back to a fabricated version, matching the project's existing version-resolution pattern insrc/version.ts.Files changed
src/llm/utils/claude-code-version.ts@anthropic-ai/claude-code/package.json, throws if missingsrc/llm/utils/claude-code-version.test.tssrc/llm/providers/anthropic.ts"2.1.75"withresolveClaudeCodeVersion(import.meta.url)src/agents/anthropic-transport-stream.tsReal behavior proof
Behavior addressed: OAuth-routed Anthropic requests fail with
authentication_errorbecauseuser-agent: claude-cli/2.1.75is stale. The installed Claude Code version (e.g. 2.1.177) sendsuser-agent: claude-cli/2.1.177and works fine.Environment tested: Node v24.13.1 on Linux, vitest run with mocked module resolution.
Steps run after the patch:
Evidence after fix:
Unit test results (4/4 pass):
Production function output on Linux host (no
@anthropic-ai/claude-codeinstalled):On a host with
@anthropic-ai/claude-codeinstalled (expected):Observed result after the fix: The
user-agentheader now reflects the installed Claude Code version instead of the hardcoded"2.1.75", preventing authentication errors from Anthropic's stale-version validation. If@anthropic-ai/claude-codeis not installed, the resolver throws a clear configuration error instead of emitting a fabricated version.What was not tested: Live Anthropic OAuth request (no OAuth token in this environment). The version-resolution logic follows the same
createRequire+package.jsonpattern used bysrc/version.tsandsrc/infra/git-commit.ts.Closes #94716