Repository navigation
improve(anthropic): log Claude Code version probe failures - #157697
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 6, 2026, 12:48 PM ET / 16:48 UTC (Revision 8). ClawSweeper reviewWhat this changesThe Anthropic plugin logs fixed categories when Claude Code version discovery fails and adds regression coverage while preserving request fallback behavior. Merge readiness✅ Ready for maintainer review Keep open: the diagnostic gap remains on current main, the patch has no blocking correctness findings, and the recorded Gateway proof exercises the changed warning path. Priority: P2 Review scores
Verification
How this fits togetherThe Anthropic plugin probes the installed Claude Code version for subscription requests and native CLI capabilities. Failed discovery leaves the transport's maintained version floor in place; this change makes that failure visible in Gateway logs. flowchart TD
A[Subscription request or CLI preparation] --> B[Shared lazy version probe]
C[Installed Claude Code executable] --> B
B --> D{Discovery succeeds}
D -->|Yes| E[Installed version evidence]
D -->|No| F[Categorized Gateway warning]
F --> G[Existing version floor]
E --> H[Provider request identity]
G --> H
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +21, Tests +47. Total +68 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep failure diagnostics in the existing Anthropic probe, with bounded categories and unchanged fallback, and handle refresh policy separately. Do we have a high-confidence way to reproduce the issue? Yes: current-main source clearly returns silently on failed discovery, and the recorded real Gateway run exercises the introduced command-failure diagnostic. No local runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes: fixed categories in the existing probe are a narrow solution that preserves the documented fallback and avoids logging private subprocess content. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e0ec9b048f0c. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…llowing them (openclaw#157541) The OAuth identity wrapper sends `user-agent: claude-cli/<version>` only when the version probe succeeds. Every failure mode — missing executable, command failure, unparseable output, thrown errors — returned undefined silently, so users hit HTTP 400 `claude_code_version_too_old` with no evidence that their installed CLI was never detected, and "update Claude Code" could not help. Each failure mode now logs a warning naming its cause, so the gateway log shows which step failed instead of nothing. Transport behavior is unchanged: the built-in version floor still applies on failure. Adds regression coverage asserting a warning is emitted for each failure mode while the request still goes through without identity.
e87b8d0 to
ef72166
Compare
|
@clawsweeper re-review Rebased onto current main. Independent P0–P2 review is clean; fresh Linux regression tests, formatting, and lint pass. Please review the updated head. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* commit 'c39d9b0692dbaafa5b1bfe02514c9f6411ab5546': (30 commits) fix(ci): clear MCP audit and service-worker test blockers (#166217) test(gateway): wait for steering admission in FIFO fixtures fix(llama-cpp): managed setup crashes and loops on macOS below 13.3 (#163358) perf(worktrees): avoid full session parsing during GC (#166072) fix(update): recover stopped legacy managed services (#166232) perf(gateway): stream bounded link preview metadata (#166195) perf(diagnostics): release completed Git operation state (#166214) chore(deps): update fs-safe to 0.24.1 and clone plugin source captures (#166189) feat(clients): adopt worker-local inference placement (#163647) test: serialize PowerShell completion process suites (#166229) test: stabilize release timing boundaries (#166218) refactor(sessions): persist run outcomes only; liveness comes from the run registry (#165733) test(gateway): prove mention refresh after config retargeting fix(team-reports): keep the missed closed day when catch-up runs after midnight (#165780) test(gateway): join WebChat queue admission and drain completion fix(logging): reject blank diagnostic stability query fields (#145532) fix(agents): report unparseable serialized edit arguments (#163577) improve(anthropic): log Claude Code version probe failures (#157697) fix(agents): clarify prompt-size provider failures (#159712) fix(memory): re-throw non-ENOENT/ENOTDIR errors in root memory file lookup (#107921) ...
…157697) * fix(anthropic): log Claude Code version probe failures instead of swallowing them (openclaw#157541) The OAuth identity wrapper sends `user-agent: claude-cli/<version>` only when the version probe succeeds. Every failure mode — missing executable, command failure, unparseable output, thrown errors — returned undefined silently, so users hit HTTP 400 `claude_code_version_too_old` with no evidence that their installed CLI was never detected, and "update Claude Code" could not help. Each failure mode now logs a warning naming its cause, so the gateway log shows which step failed instead of nothing. Transport behavior is unchanged: the built-in version floor still applies on failure. Adds regression coverage asserting a warning is emitted for each failure mode while the request still goes through without identity. * fix(anthropic): log only failure categories from version probe --------- Co-authored-by: Bruce-Yii <[email protected]>
What Problem This Solves
Related: #157541.
The Anthropic plugin's Claude Code version probe can fail without any visible diagnostic. Missing executables, non-zero or unusable command results, unparseable output, and thrown probe errors all previously collapsed to
undefined, leaving operators with an OAuthclaude_code_version_too_oldresponse and no indication of which probe step failed.This is a diagnostic-only improvement. It does not claim to fix the OAuth rejection or change the request's version fallback.
Why This Change Was Made
Emit fixed warning categories for probe failures so an operator can distinguish a missing CLI, command failure, unparseable output, or thrown/timeout-style failure without exposing subprocess stdout, stderr, executable paths, or raw error text.
The existing transport contract remains unchanged: a successful probe may supply the installed version; a failed probe still uses the maintained version floor, and the lazy discovery cache is unchanged.
User Impact
Evidence
extensions/anthropic/cli-version.test.tsexercises missing-executable, command-failure, and unparseable-output warnings and verifies the request remains on the transport floor.oxlint,oxfmt, andgit diff --checkclean.claude --versionexit failure.Redacted observed proof from that run:
The proof test read the redacted Gateway log, confirmed the warning category, confirmed the single loopback request and OAuth-shaped auth path, and confirmed that synthetic subprocess stdout/stderr did not enter the captured logs. It is diagnostic evidence for the warning path; it is not a root-cause repair for #157541.
Measured cost for the changed test file: an isolated one-worker run of
extensions/anthropic/cli-version.test.tson the exact PR head completed in 46s wall time (41.67s Vitest duration, 1 file / 28 tests). The repositorycheck-test-typesjob completed in 7m18s.Non-goals / follow-ups