Skip to content

fix(loop-tick): exclude drain cycles from zero-PR backoff (Codex P1 follow-up on #4146)#4148

Merged
AceHack merged 1 commit into
mainfrom
otto-cli/fix-4146-drain-mode-exclusion-2026-05-18-1357z
May 18, 2026
Merged

fix(loop-tick): exclude drain cycles from zero-PR backoff (Codex P1 follow-up on #4146)#4148
AceHack merged 1 commit into
mainfrom
otto-cli/fix-4146-drain-mode-exclusion-2026-05-18-1357z

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 18, 2026

Follow-up on #4146: the zero-PR backoff Codex flagged as a P1 issue shipped to main before this fix could land on its branch.

Finding (Codex on #4146)

Zero-PR backoff increments on every produced_pr=false, but drain-mode runs (thread-resolution / merge work on existing PRs) NEVER set produced_pr=true. A healthy drain-only period (e.g., 5 PRs all going through review) would falsely look like consecutive zero-PR failures and ratchet to 30x slowdown — delaying review-thread handling and merges.

Fix

if (r.mode !== "pickup") continue; — skip drain cycles entirely when counting.

Drain mode is excluded because its success signal is NOT produced_pr (no new PR is created) but rather thread-resolution + merge — which we don't currently track as a discrete success metric. Future work could add a produced_merge: true field to drain ratings and unify the counter.

Backoff now only triggers when pickup-mode (the cycle that's SUPPOSED to create new PRs) consistently fails. Healthy drain operation no longer slows the loop down.

Why this took a follow-up PR

I was authoring the fix-commit when #4146 auto-merged. My fix-commit (bb75cf2) was created but PATCH /refs/heads/<branch> returned 422 because the branch had already been auto-deleted on merge. Created a fresh branch off main with the same fix instead. The fix-commit on the orphan branch is functionally equivalent to this PR's 0d6c5bd.

Composes with #4146 (merged); applies the Codex P1 correction.

Co-Authored-By: Claude noreply@anthropic.com

…dex P1 follow-up on #4146)

PR #4146 was merged before this Codex P1 fix could land on its branch.
The finding: zero-PR backoff in #4146 increments on every produced_pr=
false, but drain-mode runs (thread-resolution / merge work on existing
PRs) never set produced_pr=true. So a healthy drain-only period would
falsely look like consecutive zero-PR failures and ratchet to 30x
slowdown — delaying review-thread handling and merges.

Fix: filter the counter on r.mode === 'pickup' — skip drain cycles
entirely when counting. Drain mode is excluded because the success
signal there is NOT produced_pr (no new PR is created) but rather
thread-resolution + merge, which we don't currently track as a discrete
success metric (could be future work).

Backoff now only triggers when pickup-mode (the cycle that's SUPPOSED
to create new PRs) consistently fails. Healthy drain operation no
longer slows it down.

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 18, 2026 13:54
@AceHack AceHack enabled auto-merge (squash) May 18, 2026 13:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

@AceHack AceHack merged commit bfb6976 into main May 18, 2026
30 checks passed
@AceHack AceHack deleted the otto-cli/fix-4146-drain-mode-exclusion-2026-05-18-1357z branch May 18, 2026 13:57
Sign up for free to 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.

2 participants