Repository navigation
Conversation
…tex/proxy backends The managed statusline script only forwarded Claude Code's per-turn payload to Orca's agent-hook endpoint when it contained a "rate_limits" key, which Anthropic only includes for standard Claude.ai-subscription API responses. Deployments routed through Vertex AI or an internal Anthropic-API-compatible proxy never receive that field, so the usage bar silently went dark even though the network was fine. context_window is reported by every backend (it's computed locally from the conversation length, not pulled from Claude.ai billing), so use it as a fallback session-usage source when rate_limits is absent.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe statusline scripts now recognize 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR fixes the live usage bar going dark for Claude Code sessions routed through Vertex AI or internal Anthropic-compatible proxies by widening the early-exit guard and the server-side parser to accept
Confidence Score: 5/5Safe to merge — changes are additive, touch only the guard patterns and the parser fallback, and are covered by both unit and behavioral integration tests. The fix is minimal and well-scoped: two OR-clauses added to shell guards (POSIX and Windows) and a small fallback branch in the TypeScript parser. The existing throttle, stamp, and curl machinery is unchanged. Tests confirm that a context_window-only payload reaches curl exactly once, that empty context_window returns null, and that rate_limits still takes priority when both keys are present. No pre-existing paths are altered in a way that could regress standard Claude.ai-subscription sessions. Files Needing Attention: No files require special attention. The priority test in claude-statusline-rate-limits.test.ts only asserts fiveHour and leaves sevenDay unchecked when both keys are present, but the logic that drives it is correct.
|
| Filename | Overview |
|---|---|
| src/shared/claude-statusline-rate-limits.ts | Core parser updated to try context_window fallback when rate_limits yields no windows; logic is sound, both empty-object and null rate_limits cases are handled correctly. |
| src/main/claude/statusline-script.ts | POSIX case-pattern and Windows findstr guard widened to OR-include context_window; both changes are minimal and symmetric with the existing rate_limits guard idiom. |
| src/shared/claude-statusline-rate-limits.test.ts | Good new coverage: empty context_window returns null, context_window-only populates fiveHour, rate_limits takes priority; minor gap — priority test does not assert sevenDay from rate_limits is preserved. |
| src/main/claude/statusline-script.test.ts | Guard ordering tests updated and a new behavioral integration test confirms a context_window-only payload reaches curl exactly once; throttle behavior for context_window is implicitly covered by shared code path. |
Sequence Diagram
sequenceDiagram
participant CC as Claude Code (statusline tick)
participant SH as statusline-script.sh / .bat
participant ORCA as Orca agent-hook endpoint
participant P as parseClaudeStatusLineBody
CC->>SH: pipe JSON payload via stdin
alt payload contains rate_limits OR context_window
SH->>SH: pass guard (case / findstr)
SH->>SH: check throttle stamp
alt within min-post interval
SH-->>CC: exit 0 (throttled)
else interval elapsed
SH->>ORCA: curl POST /statusline/claude
ORCA->>P: parseClaudeStatusLineBody(body)
alt rate_limits present and valid
P-->>ORCA: fiveHour from rate_limits.five_hour, sevenDay from rate_limits.seven_day
else rate_limits absent or invalid (Vertex AI / proxy)
P-->>ORCA: fiveHour from context_window, sevenDay null
end
ORCA-->>SH: 200 OK
end
else no rate_limits or context_window
SH-->>CC: exit 0 (skipped)
end
Reviews (1): Last reviewed commit: "fix(rate-limits): fall back to context_w..." | Re-trigger Greptile
Summary
rate_limitskey, which Anthropic only includes in standard Claude.ai-subscription API responses.rate_limits, so the live usage bar silently stopped updating even though the network itself was fine.context_windowis reported by every backend (computed locally from conversation length, not pulled from Claude.ai billing), so use it as a fallback session-usage source — both in the shell script's early-exit guard (POSIXcase/Windowsfindstr) and inparseClaudeStatusLineBody— whenrate_limitsis absent.Test plan
src/shared/claude-statusline-rate-limits.test.ts— added coverage for thecontext_windowfallback and forrate_limitstaking priority when both are presentsrc/main/claude/statusline-script.test.ts— updated the POSIX/Windows guard assertions and added a behavioral test confirming acontext_window-only payload now reaches curl