Fix Claude probe session pollution#2263
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 17, 2026, 2:20 PM ET / 18:20 UTC. Summary Reproducibility: yes. in source terms: the report identifies the Claude CLI usage probe launch path that previously lacked a stable Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land the stable probe-session identity after normal maintainer review and completed checks, then obtain a redacted live verification when a working authenticated Claude CLI environment is available. Do we have a high-confidence way to reproduce the issue? Yes in source terms: the report identifies the Claude CLI usage probe launch path that previously lacked a stable Is this the best way to solve the issue? Yes, provisionally: reusing one private installation-local session identifier preserves the existing interactive usage probe while avoiding a fresh account-side session per cold launch. A future non-interactive Claude quota interface could be preferable if the CLI provides one, but the PR body says none is currently available for this workflow. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7ea74d4ccf12. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat 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
|
|
Merged as Verification:
Live claude.ai session-list counting could not be run from this worktree: the usable installed Claude CLI reports |
Summary
ClaudeProbeworking directory--session-idfor both direct and watchdog-backed Claude CLI launchesRoot cause
The CLI usage source starts an interactive Claude session so it can invoke
/usageand/status. It previously launched without a session identity, causing every cold probe launch to register another empty account-side session.Claude CLI 2.1.212 still has no non-interactive quota command. Its
--no-session-persistenceflag is print-mode-only, so it cannot drive the interactive/usagepanel. Reusing an explicit session ID preserves every field the existing probe collects without creating a new identity per refresh.Background delegated refresh is already policy-gated after #2191, so this currently affects user-initiated CLI refreshes rather than scheduled background probes. Repeated refreshes and cold launches still polluted the account session list.
Verification
swift test --filter ClaudeCLISessionTests— 3 passedswift test --filter ClaudeDirectUsageFallbackTests— 3 passedswift test --filter ClaudeProbeWorkingDirectoryTests— 6 passedmake check— SwiftFormat clean; SwiftLint 0 violations; repository checks passedLive account-side counting was unavailable: the working local Claude CLI 2.1.206 is logged out, while the global 2.1.212 wrapper is missing its native optional dependency. No credentialed probe was attempted.
Closes #2251