Skip to content

feat: implement issue #2139 — Retry cron should hold retries until a Claude window's real reset, read from the budget poller's published result (split 1 of 2 from the weekly-cap issue) - #2159

Merged
don-petry merged 3 commits into
mainfrom
dev-lead/issue-2139-20261009-2048
Oct 9, 2026
Merged

don-petry merged 3 commits into
mainfrom
dev-lead/issue-2139-20261009-2048

Conversation

@don-petry

@don-petry don-petry commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Retry cron should hold retries until a Claude window's real reset, read from the budget poller's published result (split 1 of 2 from the weekly-cap issue)

From the issue: Split 1 of 2 from #1863 (which timed out at dev-lead's maximum action budget and asked to be split). As the fleet maintainer, I want the retry cron to read the dry-run budget poller's published result to learn whether a Claude window is exhausted and when it really resets, so that a weekly cap suppresses re-dispatch until its reset instead of retrying every two hours for up to seven days.

Risk

Medium — changes GitHub Actions workflow behavior, which is exercised only post-merge; verify via the affected workflow runs.

Test plan

Tests added/updated: tests/dev-lead/unit/test_dev_lead_retry_budget_hold.bats. Verification: bash scripts/dev-lead-lint.sh (shellcheck --severity=warning) ran pre-commit; the bats suite runs in CI.

Rollback

Revert this PR. No non-revertible side effects (no tags, migrations, or external state).

Monitoring

Watch the affected workflow run(s) in the Actions tab and this PR's Lint check for regressions.

Closes #2139

View guided diff Turn on auto-fix

…Claude window's real reset, read from the budget poller's published result (split 1 of 2 from the weekly-cap issue)
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 44 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 1e7aa6cf-7bb8-49bd-aa78-29411f4b63af

📥 Commits

Reviewing files that changed from the base of the PR and between bf54014 and 1c16a57.


📒 Files selected for processing (3)
  • .github/workflows/dev-lead-retry.yml
  • scripts/dev-lead-retry.sh
  • tests/dev-lead/unit/test_dev_lead_retry_budget_hold.bats


No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 5954198d-2517-48c4-bf78-dd9b745a6e65

📥 Commits

Reviewing files that changed from the base of the PR and between 1ba2304 and bf54014.


📒 Files selected for processing (3)
  • .github/workflows/dev-lead-retry.yml
  • scripts/dev-lead-retry.sh
  • tests/dev-lead/unit/test_dev_lead_retry_budget_hold.bats

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Automated retries marked as rate-limited are now held when session or weekly usage reaches its limit, until the applicable reset time. If both limits apply, retries remain on hold until the later reset.
    • Retries continue as usual when no limit applies or budget information is unavailable or invalid.

Walkthrough

The retry cron reads the budget-poller artifact once per run. It holds selected rate-limited retries while a qualifying session or weekly_all window has a future reset. The workflow adds actions: read for artifact access.

Changes

Budget-based retry holds

Layer / File(s) Summary
Read and evaluate budget-poller records
.github/workflows/dev-lead-retry.yml, scripts/dev-lead-retry.sh, tests/dev-lead/unit/test_dev_lead_retry_budget_hold.bats
The workflow adds actions: read. The retry script loads and evaluates the latest usable poll record. Tests cover qualifying windows, invalid or stale data, fail-open behavior, and poller record compatibility.
Apply holds to retry dispatch
scripts/dev-lead-retry.sh, tests/dev-lead/unit/test_dev_lead_retry_budget_hold.bats
Issue, fix-CI, and fix-reviews retry paths skip applicable dispatches when the hold remains active. Tests check retry behavior and confirm the artifact is read once per cron run.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant RetryCron as Retry cron
  participant ArtifactStore as GitHub Actions artifact
  participant RetryTarget as Retry target
  RetryCron->>ArtifactStore: Download budget-poller-log once
  ArtifactStore-->>RetryCron: Return poll records
  RetryCron->>RetryCron: Evaluate fresh session and weekly_all resets
  alt Hold is active
    RetryCron-->>RetryTarget: Skip rate-limited retry dispatch
  else Hold is inactive
    RetryCron->>RetryTarget: Dispatch retry
  end
Loading

Merge Risk: ⚪ Minimal · up to bf540

No introduced failure remains identified that should block merging after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 2 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the retry cron change, the budget poller integration, and the related issue. It is longer than necessary but remains specific and relevant.
Description check Passed The description includes all required sections: Problem, Risk, Test plan, Rollback, and Monitoring. It omits the Summary section, the checklist, and the Interaction contract section, but the required …
Linked Issues check Passed The changes implement #2139. scripts/dev-lead-retry.sh sources bp_download_latest_log, bp_last_ok, and bp_staleness, downloads once in budget_hold_init, and holds only rate-limited retries…
Out of Scope Changes check Passed The diff is limited to the retry workflow permission, the retry script integration, and focused tests for #2139. The script does not parse rate-limit message text, add credentials, modify `_emit_reset…

Full details: Docstring Coverage

Explanation

Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 2 files. (1 skipped: 1 unsupported.)



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-10-09T22:17:16Z.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a budget hold mechanism to the retry cron script (scripts/dev-lead-retry.sh) and adds a comprehensive suite of unit tests. The new mechanism reads the latest budget poller log artifact to hold rate-limited retries when usage windows are exhausted, failing open on any errors. The review feedback focuses on shell scripting optimizations and robustness, including replacing external process spawns (jq and cut) with native Bash comparisons and parameter expansions, safely handling command substitutions under set -e when creating temporary files, using cleanup traps, and preferring here-strings over piped echo commands.

Comment thread scripts/dev-lead-retry.sh Resolved
Comment thread scripts/dev-lead-retry.sh Resolved
Comment thread scripts/dev-lead-retry.sh Resolved
Comment thread scripts/dev-lead-retry.sh Resolved
Comment thread scripts/dev-lead-retry.sh Resolved
coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 9, 2026
Comment thread scripts/dev-lead-retry.sh Resolved
Comment thread scripts/dev-lead-retry.sh Resolved
don-petry and others added 2 commits October 9, 2026 16:20
…us capture in retry budget hold

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (partial)

A commit was pushed, but not every requested change was applied. Per requested item:

  • scripts/dev-lead-retry.sh:203 — applied
  • scripts/dev-lead-retry.sh:233 — applied
  • scripts/dev-lead-retry.sh:253 — not applied
  • scripts/dev-lead-retry.sh:267 — applied
  • scripts/dev-lead-retry.sh:633 — applied

The unaddressed items above still need work.

@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 3 files

You’re at about 96% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@don-petry
don-petry merged commit 946304c into main Oct 9, 2026
88 of 132 checks passed
@don-petry
don-petry deleted the dev-lead/issue-2139-20261009-2048 branch October 9, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants