Skip to content

fix: skip preflight during account blocks - #65

Open
kristofferR wants to merge 6 commits into
mainfrom
t3code/skip-preflight-when-blocked
Open

fix: skip preflight during account blocks#65
kristofferR wants to merge 6 commits into
mainfrom
t3code/skip-preflight-when-blocked

Conversation

@kristofferR

@kristofferRkristofferR commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Required local preflight currently calls CodeRabbit even when crq already knows the shared account quota is blocked. The guaranteed rate-limit response exits 2 and prevents agents from continuing otherwise-ready PR workflows.

Read shared quota state before invoking the local CLI. A live block now returns a successful structured skip with its reason and expiry; expired, unreadable, explicitly re-authenticated, or CRQ_PREFLIGHT_SKIP_BLOCKED=0 runs still use the normal preflight path. The toggle is available with the other fleet review settings and defaults on.

Validation: go test ./..., go vet ./..., and a live blocked-state preflight check.

Summary by CodeRabbit

  • New Features
    • crq preflight now skips local review requests when an active shared account block is detected.
    • Reports the skip status, reason, and expected unblock time.
    • Added CRQ_PREFLIGHT_SKIP_BLOCKED, enabled by default; set it to 0 to force requests.
    • Falls back to normal local CLI behavior when shared state cannot be read.
  • Documentation
    • Updated configuration references and preflight guidance to describe the new behavior.

@coderabbitai

coderabbitaiBot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dbabadd1-09d9-46f0-bbea-e5adaecbe81f

📥 Commits

Reviewing files that changed from the base of the PR and between 8c45ced and 198061a.

📒 Files selected for processing (14)
  • README.md
  • cmd/crq/main.go
  • internal/crq/cliquota_test.go
  • internal/crq/config.go
  • internal/crq/config_test.go
  • internal/crq/envkeys.go
  • internal/crq/fleetsettings.go
  • internal/crq/fleetsettings_test.go
  • internal/crq/preflight.go
  • internal/crq/preflight_test.go
  • internal/crq/state.go
  • internal/state/state.go
  • llms.txt
  • skills/coderabbit-queue/SKILL.md
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (1)
internal/{engine,state,crq}/**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

internal/{engine,state,crq}/**/*.go: Nothing in engine/state/crq enumerates bots: they key on the login and
consume the registry's hooks.

Files:

  • internal/crq/state.go
  • internal/crq/config_test.go
  • internal/crq/envkeys.go
  • internal/crq/cliquota_test.go
  • internal/crq/fleetsettings.go
  • internal/crq/config.go
  • internal/crq/preflight.go
  • internal/crq/fleetsettings_test.go
  • internal/state/state.go
  • internal/crq/preflight_test.go
🧠 Learnings (3)
📚 Learning: 2026-07-27T01:11:18.244Z
Learnt from: kristofferR
Repo: kristofferR/coderabbit-queue PR: 57
File: internal/crq/feedback.go:91-92
Timestamp: 2026-07-27T01:11:18.244Z
Learning: When reviewing code in `internal/crq` that deals with bot configuration, keep the separation of concerns intact: `Config.isConfiguredBot(login)` should only be evaluated against the fleet-wide primary `Config.Bot`. Do not override or reinterpret `Config.Bot` based on repo-specific reviewer/co-reviewer data. If repo-added co-reviewers are involved, they must be handled via repo-derived bot sets (e.g., `Config.evidenceBots()`), and not via `isConfiguredBot`. `Config.ForRepo(...)` should adjust co-reviewer-derived fields like `CoBots`, `RequiredBots`, `Reviewers`, and `FeedbackBots`, but intentionally not change the meaning of `Config.Bot` used by `isConfiguredBot`.

Applied to files:

  • internal/crq/state.go
  • internal/crq/config_test.go
  • internal/crq/envkeys.go
  • internal/crq/cliquota_test.go
  • internal/crq/fleetsettings.go
  • internal/crq/config.go
  • internal/crq/preflight.go
  • internal/crq/fleetsettings_test.go
  • internal/crq/preflight_test.go
📚 Learning: 2026-07-27T01:11:20.071Z
Learnt from: kristofferR
Repo: kristofferR/coderabbit-queue PR: 57
File: internal/crq/repoconfig.go:163-183
Timestamp: 2026-07-27T01:11:20.071Z
Learning: In internal/crq, treat the “observe → decide → apply” effects restriction as applying only to effects produced by review decisions. Explicit operator mutation commands (e.g., Service.SetReviewers, Service.ClearReviewers, enqueue/cancel flows) are allowed to perform state mutations outside the standard apply path, so review logic should not incorrectly require them to follow observe/decide/apply.
For CRQ_DRY_RUN: it should suppress review requests and fire-record writes, but it must not make explicit configuration/mutation commands (e.g., `crq reviewers set`) silently succeed without persisting the requested changes.
Ensure Service.applyFire revalidates repository reviewer overrides just before posting, to protect against stale/changed overrides since earlier reads.

Applied to files:

  • internal/crq/state.go
  • internal/crq/config_test.go
  • internal/crq/envkeys.go
  • internal/crq/cliquota_test.go
  • internal/crq/fleetsettings.go
  • internal/crq/config.go
  • internal/crq/preflight.go
  • internal/crq/fleetsettings_test.go
  • internal/crq/preflight_test.go
📚 Learning: 2026-07-28T06:12:02.107Z
Learnt from: kristofferR
Repo: kristofferR/coderabbit-queue PR: 58
File: internal/crq/service.go:2113-2116
Timestamp: 2026-07-28T06:12:02.107Z
Learning: In the internal/crq package, treat `rate-limit-command` and `gate-repo` as host-local configuration (not fleet-owned settings). `Service.readQuota` may accept a fleet-derived `Config` only to use the fleet-owned `Scope` and `CalibrationTTL`. Ensure the calibration probe command and any gate-repository logic continue to use the host-local service configuration, not the fleet-owned configuration.

Applied to files:

  • internal/crq/state.go
  • internal/crq/config_test.go
  • internal/crq/envkeys.go
  • internal/crq/cliquota_test.go
  • internal/crq/fleetsettings.go
  • internal/crq/config.go
  • internal/crq/preflight.go
  • internal/crq/fleetsettings_test.go
  • internal/crq/preflight_test.go
🔇 Additional comments (17)
internal/crq/config.go (1)

162-165: LGTM!

Also applies to: 360-361

internal/crq/fleetsettings_test.go (1)

110-139: LGTM!

Also applies to: 551-589

internal/crq/config_test.go (1)

538-554: LGTM!

internal/crq/preflight.go (1)

62-69: LGTM!

Also applies to: 93-166, 256-258, 367-370

internal/crq/cliquota_test.go (1)

278-290: LGTM!

internal/crq/preflight_test.go (1)

5-5: LGTM!

Also applies to: 68-297

cmd/crq/main.go (1)

1576-1593: LGTM!

Also applies to: 1666-1730

internal/crq/envkeys.go (1)

85-86: LGTM!

internal/crq/state.go (1)

66-68: LGTM!

internal/state/state.go (2)

591-591: LGTM!


627-632: LGTM!

internal/crq/fleetsettings.go (2)

130-134: LGTM!


856-857: LGTM!

README.md (2)

450-454: LGTM!


533-533: LGTM!

llms.txt (1)

489-492: LGTM!

skills/coderabbit-queue/SKILL.md (1)

334-339: LGTM!


📝 Walkthrough

Walkthrough

crq preflight now skips local review requests during active shared account blocks. The behavior is enabled by default, configurable through CRQ_PREFLIGHT_SKIP_BLOCKED, reported with skip metadata, and bypassed when state is unavailable, credentials are explicit, or the block does not match.

Changes

Blocked preflight handling

Layer / File(s)Summary
Policy configuration and fleet capabilities
internal/crq/config.go, internal/crq/envkeys.go, internal/crq/fleetsettings.go, internal/crq/state.go, internal/state/state.go, internal/crq/*_test.go
Adds CRQ_PREFLIGHT_SKIP_BLOCKED, enabled by default. Fleet settings render the value and track host capability support.
Shared block detection and reporting
internal/crq/preflight.go, internal/crq/preflight_test.go, internal/crq/cliquota_test.go
Adds skip metadata and SkipBlockedPreflight. Active matching blocks return a successful skipped report. Expired blocks, explicit credentials, disabled policy, and other CLI accounts continue normally.
Preflight command orchestration
cmd/crq/main.go
Uses a bounded context, checks shared quota before invoking the CLI, and falls back to normal preflight when detection cannot complete.
Preflight behavior documentation
README.md, llms.txt, skills/coderabbit-queue/SKILL.md
Documents skip results, unblock metadata, fallback behavior, and the environment override.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk:⚪ Minimal · up to 19806

The change skips local preflight only when a shared account block is active and otherwise preserves the normal path; no actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
participant PreflightCommand
participant CodeRabbitBinary
participant GitHub
participant SkipBlockedPreflight
participant CodeRabbitCLI
PreflightCommand->>CodeRabbitBinary: resolve selected binary
PreflightCommand->>GitHub: authenticate with bounded timeout
PreflightCommand->>SkipBlockedPreflight: inspect shared account-block state
SkipBlockedPreflight-->>PreflightCommand: return skipped report or continue
PreflightCommand->>CodeRabbitCLI: run local review when not skipped
Loading

Possibly related PRs

Poem

A rabbit sees the quota glow,
And skips the queue when blocks still show.
With unblock time and reason clear,
The local CLI waits near.
Set zero, and requests run free.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 21.43% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and concisely describes the main change: skipping preflight during active account blocks.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/skip-preflight-when-blocked

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kristofferR

Copy link
Copy Markdown
OwnerAuthor

@codex review

@kristofferR

Copy link
Copy Markdown
OwnerAuthor

@codex review

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:f63e29c9ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment threadinternal/crq/preflight.go Outdated
Comment threadcmd/crq/main.go
Comment threadinternal/crq/preflight.go
@kristofferR

Copy link
Copy Markdown
OwnerAuthor

@codex review

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:48c656f0d9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment threadinternal/crq/fleetsettings.go Outdated
@kristofferR

Copy link
Copy Markdown
OwnerAuthor

@codex review

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:ff86df158d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment threadcmd/crq/main.go
@kristofferR

Copy link
Copy Markdown
OwnerAuthor

@codex review

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:dd398ec528

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment threadcmd/crq/main.go Outdated
Comment threadcmd/crq/main.go
Comment threadinternal/crq/preflight.go
@kristofferR

Copy link
Copy Markdown
OwnerAuthor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit:198061a3ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kristofferR

Copy link
Copy Markdown
OwnerAuthor

@coderabbitai review

@coderabbitai

coderabbitaiBot commented Aug 15, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@kristofferR