Skip to content

principal-review.yml discards an already-posted valid review verdict when the final write step hits the org's weekly Claude rate cap #426

Closed

Description

@libravault-xyz

What

PR #397's first principal-review run (32457396797) completed a full review — posted as a CHANGES_REQUESTED GitHub PR review with an explicit ## Principal review — verdict: \human-merge`line, plus two newly-filed issues (#406, #400) — but crashed withis_error: true/api_error_status: 429on the very next turn (writingprincipal-verdict.txt`), because it hit the org's 7-day/weekly Claude API usage cap:

"type": "rate_limit_event",
"rate_limit_info": {
  "status": "rejected",
  "resetsAt": 1787346000,
  "rateLimitType": "seven_day",
  "overageStatus": "rejected",
  "overageDisabledReason": "org_level_disabled",
  "isUsingOverage": false
}

...immediately followed by a synthetic zero-token assistant turn and "result": "You've hit your weekly limit · resets 9pm (UTC)". 48 turns in, well under the --max-turns 65 cap raised by #297, so this is not that issue's turn-budget failure mode — it's a distinct trigger with the same "crash discards already-valid work" shape.

Because principal-verdict.txt was never written, principal-review.yml's crash-handling branch (~lines 309-333) found "no usable verdict file" and routed the PR to status:needs-info with a generic "crashed or exhausted its turn budget" comment — discarding a fully valid, already-posted review and its two filed sub-issues. The PR then sat in that state for ~18 hours (2026-08-21 07:28 → 2026-08-22 01:27) until the pipeline health-check routine independently diagnosed the real cause and the human-merge-sweep-agent retried it. That retry (32543462572) re-ran the entire review from scratch and reached byte-for-byte the same conclusions (compare review #4990818640 vs. review #4998543494) — a second, fully paid ~$2+/30k-output-token run that added no information over the first one.

Why

Two compounding gaps:

  1. principal-review.yml's crash-recovery only trusts the local principal-verdict.txt file. The agent's actual verdict was already durably posted via gh pr review before the crash — viewable any time via gh api repos/LibraVault/reader/pulls/397/reviews — but the workflow has no fallback that checks the most recent PR review body for a verdict: \X`line when the file is missing. It only recovers a verdict from the file (theCRASH_VERDICT` check at line ~312-315), not from GitHub's own record of what the agent already posted.
  2. The pipeline health-check routine has no authorized self-heal pattern for this. Its own comment on this PR (2026-08-21T22:32:27Z) states explicitly: "it does not match any of the 5 known failure patterns this routine tracks, and is not self-healing" and recommends filing this as its own tracked issue if it recurs. resetsAt is deterministic and present in the crash log, so an auto-retry after that timestamp is mechanically straightforward — today it requires a human or the (much less frequent) human-merge-sweep pass to notice and retry.

Fix

  • Before falling back to status:needs-info on a crashed agent step, have principal-review.yml check gh pr view <PR> --json reviews for the latest review's body for a verdict: \(auto-merge|human-merge)`` line and use it (flagging the crash in the routing comment, same as the existing "had already written verdict before dying" path) rather than discarding a completed review.
  • Add "org weekly/7-day rate-limit hit mid-run" (rate_limit_info.rateLimitType == "seven_day", api_error_status: 429) as a recognized, self-healable pattern (pattern 6) for the pipeline health-check routine: label it distinctly from a generic crash, and auto-retry (status:needs-review) once resetsAt has passed, instead of requiring a human-merge-sweep pass to notice.
  • Optional/lower priority: some early-warning signal (even just the health-check routine surfacing remaining weekly quota) before the cap is hit outright — the pipeline now runs dev-agent + qa-agent + principal-review-agent + human-merge-sweep-agent + the 2-hourly health check off the same shared org quota with overage deliberately disabled (org_level_disabled), so this can recur as the agent fleet's usage grows.

Evidence

Activity

  1. added
    bug
    status:ready-for-dev
    on Aug 22, 2026
  2. added
    status:in-progress
    on Aug 22, 2026
  3. libravault-xyz commented on Aug 22, 2026

    @libravault-xyz
    CollaboratorAuthor

    Automated pipeline health check: This issue's own status:ready-for-dev/status:in-progress labels are stale — its linked PR, #430, already exists and has advanced to status:needs-review.

    Same already-flagged gap as #401/#402/#403/#386/#371/#351/#138/#428: the triage-and-implement step's success/routing paths never revisit the originating issue's status labels once a PR is opened. Not self-healing (label cleanup on an already-advanced issue isn't in this routine's authorized action set); noting this as another instance (9th so far).


    Generated by Claude Code

  4. added a commit that references this issue on Aug 22, 2026
    96a97a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstatus:in-progressstatus:ready-for-dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions