fix(grok): Refresh expired CLI tokens - #23
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 23 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Grok credential flow now probes authentication with ChangesGrok token refresh
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Comment |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/credentials/credentials.go (1)
654-656: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd a regression test for candidate validation.
The new loop is the core token-refresh change. The added test verifies only the candidate list. It does not verify that the code checks
IsTokenWorkingafter each candidate, continues after an unusable token, or stops after a valid token.Add a unit or integration test with two candidates and controlled CLI and token results.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/credentials/credentials.go` around lines 654 - 656, Add a regression test covering the candidate-validation loop around IsTokenWorking in the token refresh flow: configure two candidates with controlled CLI/token results so the first is unusable and the second is valid, then assert both are checked, processing continues after the first failure, and the loop stops successfully after the valid candidate.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pkg/credentials/credentials.go`:
- Around line 654-656: Add a regression test covering the candidate-validation
loop around IsTokenWorking in the token refresh flow: configure two candidates
with controlled CLI/token results so the first is unusable and the second is
valid, then assert both are checked, processing continues after the first
failure, and the loop stops successfully after the valid candidate.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: eebaa660-7029-4ce2-a6ad-2186e911cdd3
📒 Files selected for processing (2)
pkg/credentials/credentials.gopkg/credentials/credentials_test.go
Refs #23 Co-Authored-By: cairn-code <282421612+cairn-code@users.noreply.github.com>
|
@coderabbitai full review |
|
|
Addressed the review feedback in
Local verification: |
|
@coderabbitai full review |
|
Refs #23 Co-Authored-By: cairn-code <282421612+cairn-code@users.noreply.github.com>
Summary
Refresh expired Grok CLI OAuth tokens automatically so Grok remains visible in
limitswithout manually launching the interactive CLI. The previous probes were static or unsupported and could not refresh authentication.Fixes #22
Changes
pkg/credentials/credentials.gogrok modelsprobe.pkg/credentials/credentials_test.goTest plan
gofmt -w pkg/credentials/credentials.go pkg/credentials/credentials_test.gogo test ./...go vet ./...go build ./...grok modelsand verify it reports the authenticated account and available models.