Repository navigation
[Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes - #3649
Conversation
Why the sweep saw a "stranded" loop. The sweep decided a loop was stranded with a single queue scan. That scan looked only at `waiting`, `active` and `delayed` jobs, and nothing recorded that a step had just been enqueued. So any scan that missed the review meant the loop looked idle and got re-armed under a new epoch, which supersedes that review. A miss can happen while the job moves between queue states during a capacity or PR-lock wait, or when the job sits in a state the scan didn't list, such as `prioritized`. An existing test (`a re-arm that misses a pending review in the queue scan supersedes it`) had pinned this as intended behaviour; I replaced it. I couldn't prove from the logs which of these happened in the three stalled loops. What changed - New `src/jobs/ultrafixStepEnqueueMarker.ts`: every enqueued step now records its job ID, epoch, time and delay in Redis. - Re-arm check (`ultrafixStrandedLoopRearm.ts`): before re-arming, the sweep looks that job up directly. If it is in any live state, or it can't be found and less than its delay plus 10 minutes has passed, the loop is left alone. The sweep then schedules a later check instead of acting. A job that `failed` or `completed` is not held, so a step that really failed is still recovered at once (failed jobs are kept for 7 days, so they stay visible). - Queue scan: it now covers all live states, including `prioritized`, `waiting-children` and `paused`. - Failure count: re-arming never added to the "failed N times in a row" count; only jobs that exhaust their attempts do. Since the sweep no longer supersedes live jobs, that count can no longer grow without real failures. I didn't change the counting itself. - Stop notice: for the recovery limit it used to say "Max cycles were exhausted". It now says the steps failed 3 times in a row and to restart with `/ultrafix`. - Label: it is now removed on every failed finish, including the "CI did not settle" stop. This reverses the documented behaviour, which left the label on the PR. Removing the label clears the loop state, so the PR status stops showing Ultrafix as in progress. - Docs: `docs/docs/features/pr-commands.md` is updated to match. Tests. The three regression tests are in `test/ultrafixCiFailureRecovery.test.ts`: 1. A delayed review was just enqueued, the sweep runs before it starts, and the scan misses it: no re-arm, same epoch, the review then runs, and nothing is counted as failed. 2. The review is waiting for agent capacity (moved back to delayed): no re-arm. A `prioritized` job is also seen by the scan. 3. The recovery-limit test now checks that one stop notice is posted with the failure reason and that the label is removed. I added a fourth test showing a job that has vanished is re-armed only after the grace period, and a label-removal check to the CI-timeout test. Results. All 24 Ultrafix suites and `checkRunHandler` pass, and so does the docs manifest test. Root typecheck and lint with `--max-warnings 0` on the changed files are clean. The four new or changed tests fail when the fix is temporarily disabled. The real-Redis integration suite didn't run because there's no Redis in this container. The scenario with about seven loops running at once was tested only through these simulated queue states, not under real load. The change touches the stop-notice code that #3593 also edits, though only with a few added lines. There are no visual previews because nothing visible in the UI changed. Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
Epic progress: 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes1 out of 1 PRs merged ✅
Merged child PRs: #3643 ✅ This epic PR has been merged into main. This comment is updated automatically by ProPR as child PRs open, change and merge. |
✅ Epic ready for final merge: 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passesAll 1 child PR has been merged into this epic branch. This epic PR is ready for final review and merge. Posted automatically by ProPR |
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationReady to merge within the visible scope. The change directly addresses premature re-arming and improves failed-loop cleanup without disproportionate complexity. ✅ Preserves queued work — The epoch-matched marker checks the specific job before re-arming, protecting delayed and running steps when the queue scan misses them. ✅ Bounds recovery delays — Missing jobs receive a finite grace period, while completed and failed jobs immediately permit recovery. ✅ Improves stop visibility — Repeated-failure stops receive an accurate explanation, and unsuccessful completion paths now remove the The supplied current-head checks report 19 passed and no failures or pending checks. This was a static review; no commands were run. The issue excerpt is truncated, so objective validation is limited to its visible requirements; the supplied diff is complete. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Cover marker decision boundariesConsider focused tests for ScoreThe implementation addresses the visible failure scenario, includes meaningful regression coverage, and has passing current-head checks. No merge blockers were verified. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
Please implement the "Correction" section at the end of issue #3642, which this PR does not cover yet. Keep everything already in the PR and add:
|
|
✅ Applied the requested follow-up changes in commit 8f4558c Summary of ChangesI've implemented the Correction section from #3642. When the worker refuses an Ultrafix step for disk pressure, the loop now waits and retries that step, and it posts one waiting notice instead of a refusal comment per attempt. If space doesn't come back, it stops with a notice that gives the real reason, last score and cycle. Everything already in the PR is kept, and the new regression tests pass. Waiting instead of failing
Stop notice when space doesn't return
Tests
Docs: Decision for you: the wait is 57 minutes, short of the full hour. Your example gaps (2, 5, 10, 20) add up to 37 minutes, so I added a second 20-minute wait; the schedule is one constant, Limitation: if the job for the No previews, since nothing visible in the UI changed. Review digestRisk-tiered paths
Validation evidence
Diff size: 12 files changed, +529/−32 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…e worker refuses an Ultrafix step for disk pressure, the loop now waits and retries that step, and it posts one waiting notice instead of a refusal comment per attempt. If space doesn't come back, it stops with a notice that gives the real reason, last score and cycle. Everything already in the PR is kept, and the new regression tests pass. I've implemented the Correction section from #3642. When the worker refuses an Ultrafix step for disk pressure, the loop now waits and retries that step, and it posts one waiting notice instead of a refusal comment per attempt. If space doesn't come back, it stops with a notice that gives the real reason, last score and cycle. Everything already in the PR is kept, and the new regression tests pass. **Waiting instead of failing** - When a step's job has used up its attempts and the error is `WorktreeDiskPressureError`, the refusal is recorded on the loop as a wait (new `src/jobs/ultrafixDiskPressureWait.ts`, wired in through `ultrafixExhaustedStep.ts`). It does not count toward the "failed N times in a row" limit. - The same step is retried after 2, 5, 10, 20 and 20 minutes, 57 minutes in total. The re-arm code itself enforces this, so neither the daemon sweep nor a check event can retry sooner. If a fix was refused, the fix is retried, not swapped for a review. - The first refusal posts "⏳ Ultrafix is waiting for free disk space on the worker" once. Later refusals post nothing, and the per-attempt "could not start" comment from `prCommentUnstartedFailure.ts` is skipped for these steps. - Once a step is admitted and completes, the wait ends and the loop carries on as usual. **Stop notice when space doesn't return** - After the sixth refusal (about an hour), the loop finishes as failed with the reason "The worker had no free disk space". The notice says how long it waited, how many times the step was refused and that the loop stopped at cycle N of M, and the `ultrafix` label is removed. - "Last score: unknown" on #3637 happened because an active loop has no final score until it finishes. The loop now keeps its latest review score as it goes, and the stop notice uses it. This also fixes the score on the recovery-limit stop notice. **Tests** - In `test/ultrafixCiFailureRecovery.test.ts`: - Two refusals then a successful admission: the loop continues, posts one notice and no refusal comments, and nothing is counted as failed. - Persistent refusals: the loop ends with one stop notice ("Last score: 5", "no free disk space", "stopped at cycle 1 of 5"), and the label is removed. - A refusal for a job that is no longer the loop's current step still gets the ordinary refusal comment. - In `test/prCommentTaskStateFinalizers.test.ts`, a new test checks that the per-attempt comment is skipped. - I temporarily broke five parts of the fix one at a time; the new tests caught each one. - All 33 Ultrafix-related suites, `checkRunHandler` and the docs manifest test pass. Typecheck and zero-warning lint on the changed files are clean. - The real-Redis integration suite was skipped because there's no Redis in this container, and nothing was tried against a real worker with a full disk. **Docs:** `docs/docs/features/pr-commands.md` now describes the disk-space wait. Decision for you: the wait is 57 minutes, short of the full hour. Your example gaps (2, 5, 10, 20) add up to 37 minutes, so I added a second 20-minute wait; the schedule is one constant, `ULTRAFIX_DISK_PRESSURE_RETRY_DELAYS_MS`, if you want it changed. Limitation: if the job for the `/ultrafix` command itself is refused, it still gets the ordinary "post the command again" comment. That is the existing behaviour, and only the loop's own review and fix steps wait for space. No previews, since nothing visible in the UI changed. PR: #3649 Comment by: @integry (ID: 6941588329) Model: Claude Opus 5.5
|
/ultrafix goal=8 max=4 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 4) First action:
|
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR addresses premature rearming and adds disk-pressure backoff, clearer stop reasons, and label cleanup. It needs a localized correction before merging: a failed waiting-notice publication is treated as successful and never retried. ✅ Queue ownership protection — The enqueue marker checks the specific job’s state, preserving live work while allowing recovery after a missing job’s grace period. ✅ Transient refusal handling — Disk-pressure refusals preserve the failure streak and retry the refused action. Regression tests cover recovery and persistent exhaustion. All supplied current-head checks are passing or skipped. This review used static analysis only; no commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Retry failed waiting-notice publication
SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Cover the final permitted fixAdd a disk-pressure regression for the final fix that normal continuation still permits. The documented stranded-loop cycle rules can stop a loop after its final review, while the new recovery path selects the refused action inside ScoreThe implementation has useful regression coverage and passing current-head checks, but its new reporting path can silently lose the required waiting notice. The correction is localized. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 294d433
Summary of ChangesI fixed F1: a waiting notice that GitHub rejects is now retried, and it counts as posted only after it has actually been posted once. The new regression test passes, and it fails against the previous handler. The fix
Tests (in
I checked the other places that read the disk-space wait (the re-arm, the stop decision and the stop notice). None of them used the refusal count to mean "notice posted", so nothing else needed changing. Nothing visible in the UI changed, so there are no previews. Review digestRisk-tiered paths
Validation evidence
Diff size: 4 files changed, +101/−11 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ried, and it counts as posted only after it has actually been posted once. The new regression test passes, and it fails against the previous handler. I fixed F1: a waiting notice that GitHub rejects is now retried, and it counts as posted only after it has actually been posted once. The new regression test passes, and it fails against the previous handler. **The fix** - **Separate "posted" flag** (`src/jobs/ultrafixDiskPressureWait.ts`): the disk-space wait now has its own `noticePosted` flag, separate from the refusal count. Each new refusal of the same wait keeps the flag. - **When the notice is posted** (`src/jobs/ultrafixExhaustedStep.ts`): it is posted on any refusal while `noticePosted` is unset and retries are not used up. The old rule was "only when `refusals === 1`". - If `post` returns `null`, a warning is logged and the notice is posted again on the next refusal. - If it succeeds, `markDiskPressureNoticePosted` sets the flag. That write only goes through if the step's epoch is still current, the loop is still in the same wait (same step, same start, no step completed since), and the stored state hasn't changed since it was read. It retries up to three times. - The ordinary per-attempt refusal comment stays suppressed in both cases. - **Remaining race:** GitHub may accept the comment and then the loop move on before the flag is saved. A later refusal in that same wait could then post the notice a second time. Posting a comment and writing to Redis can't be done as one step, so this window can't be closed; it is logged. - **Docs:** `docs/docs/features/pr-commands.md` now says a rejected notice is posted again on the next refusal. **Tests** (in `test/ultrafixCiFailureRecovery.test.ts`) - **New test:** the first refusal's post fails, so the flag stays unset. The second refusal posts the waiting notice once and sets the flag. The third refusal posts nothing. - **Existing disk-pressure tests:** their fake GitHub returned no comment id, which the code now treats as a failed post. They now return an id, as GitHub does, so they still check for exactly one notice. - **Results:** - The Ultrafix suites, `prCommentTaskStateFinalizers` and the docs manifest test pass, apart from the file below. - `test/commentEventHandler.ultrafix.test.ts` fails 27 of 31 tests, with or without this change. - tsc and zero-warning eslint on the changed files are clean. I checked the other places that read the disk-space wait (the re-arm, the stop decision and the stop notice). None of them used the refusal count to mean "notice posted", so nothing else needed changing. Nothing visible in the UI changed, so there are no previews. PR: #3649 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR addresses the sweep race and adds disk-pressure backoff, notice suppression, and terminal label cleanup. It needs changes before merge because disk-pressure recovery does not fully distinguish retrying an authorized step from recovering a superseded loop. ✅ Queue visibility — The enqueue marker checks individual job state, and queue scans now include prioritized and paused jobs. ✅ Transient refusal handling — Disk-pressure refusals preserve the failure streak and use a bounded retry schedule, with tests covering recovery and persistent refusal. ✅ Current checks — The supplied status reports 19 passed checks and no failures or pending checks. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F2: 🔴 Preserve the final permitted fix retry
F3: 🔴 Retire disk waits after external takeover
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe implementation has useful regression coverage and passing checks, but cycle-boundary and takeover handling leave two correctness gaps in the new retry behavior. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 7c6ef24
Summary of ChangesI fixed F2 and F3. Each has a new regression test, and each test fails when its fix is reverted. No preview was made because this is backend behaviour only. F2: the final permitted fix is now retried after a disk refusal
F3: other work now retires an old disk wait
I also added both cases to the disk-space paragraph in Verification: lint (zero warnings) and Found separately, not changed: the sweep in Review digestRisk-tiered paths
Validation evidence
Diff size: 5 files changed, +153/−20 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
… test fails when its fix is reverted. No preview was made because this is backend behaviour only. I fixed F2 and F3. Each has a new regression test, and each test fails when its fix is reverted. No preview was made because this is backend behaviour only. **F2: the final permitted fix is now retried after a disk refusal** - In `src/jobs/ultrafixResumeClaim.ts` (`evaluateStrandedLoopRearm`), a loop that is still waiting for disk space is now checked against the budget of the step that was refused: a fix needs fewer than `maxCycles` completed fixes, a review fewer than `maxCycles` completed reviews. That is the rule the normal continuation used to schedule the step. - Previously, the final fix after the final review was stopped as "cycles exhausted". Loops without a disk wait keep the old rule, so the documented case of a stranded loop stopping after its final review is unchanged. - New test: five reviews done, the normal flow schedules the fifth fix, the worker refuses it, and after the backoff the sweep retries the fix instead of stopping the loop. The retried fix then completes, bringing the fix count to 5. **F3: other work now retires an old disk wait** - The wait in `src/jobs/ultrafixDiskPressureWait.ts` now records the epoch that owns it. It only counts while the loop state is on that epoch, and recovery also requires the current automatic-work epoch to match. A manual follow-up moves that epoch without updating the loop state, so it supersedes the wait. - In `src/jobs/ultrafixStrandedLoopRearm.ts`, the recovery reads the current epoch once, before any decision. It uses that same value both to judge whether the wait is still current and for the atomic epoch reservation, so the wait can't be judged current against one epoch and then handed to a different one. - When the recovery takes the loop over, the reservation either moves a retried wait to the new epoch or, if the wait was superseded, deletes it. A deleted wait can't come back on a later recovery. - New test: a fix is refused, then a manual follow-up pushes a new head. The fix is not retried, the wait is deleted, a review is deferred for CI on the new head, and once checks pass the review is queued. I also added both cases to the disk-space paragraph in `docs/docs/features/pr-commands.md`. **Verification:** lint (zero warnings) and `tsc` are clean on the changed files. `ultrafixCiFailureRecovery` passes 61/61, and the other Ultrafix suites and `prCommentTaskStateFinalizers` pass. `ultrafixRecoveryRedisIntegration` reported 0 tests. `commentEventHandler.ultrafix.test.ts` fails 27 of its 31 tests, and an untouched copy of HEAD gives the same 4 pass / 27 fail, so those failures predate this change. **Found separately, not changed:** the sweep in `sweepUltrafixResumeCandidates` still skips a loop until the retry time saved with its retry record, even after other work has replaced the disk wait. After a manual follow-up, the sweep can start the recovery review up to 20 minutes late. The recovery itself no longer waits in that case, and check events are not delayed. This is an avoidable delay, not an unavoidable race. Fixing it would mean the sweep reading the loop state and epoch, which is outside F2/F3. PR: #3649 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR addresses the enqueue/rearm race and adds disk-pressure recovery with bounded retries, clearer stop notices, and label cleanup. No merge blocker is demonstrated by the supplied code. Merge readiness is conditional on the four pending test shards completing successfully. ✅ Queue ownership protection — Recovery checks the current epoch’s enqueue marker and individual job state before taking over a loop. ✅ Transient refusal handling — Disk-pressure refusals preserve the failure streak, retry the refused action, and retain notice-publication state. Regression tests cover recovery, exhaustion, and the final permitted fix. This was a static review; no commands were run. The original issue excerpt is truncated, so requirement validation uses its visible portion and the complete authorized follow-up. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Cover score persistence with escalationAdd a regression combining enabled escalation with subsequent disk-pressure exhaustion. ScoreThe implementation addresses the visible objective with substantial targeted regression coverage. No actionable defect was verified; the supplied checks report no failures, with four test shards still pending. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
✅ Epic merged: 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passesEpic PR #3649 has been merged into main. 1 out of 1 PRs merged into main through this epic PR. All planned epic work is now merged. Posted automatically by ProPR |
0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes
This Epic PR aggregates all changes for the plan: 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes
Issues in this Epic
Auto-close
When this PR is merged, the following issues will be automatically closed:
Fixes #3642
Created automatically by ProPR