Skip to content

[Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes - #3649

Merged
integry merged 4 commits into
mainfrom
3642-epic-0-9-y57
Nov 17, 2026
Merged

integry merged 4 commits into
mainfrom
3642-epic-0-9-y57

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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

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>
@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Epic progress: 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes

1 out of 1 PRs merged ✅

██████████ 100%

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.

@propr-dev propr-dev Bot added the AI label Nov 17, 2026
@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

✅ Epic ready for final merge: 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes

All 1 child PR has been merged into this epic branch. This epic PR is ready for final review and merge.


Posted automatically by ProPR

@integry
integry marked this pull request as ready for review November 17, 2026 06:44

integry commented Nov 17, 2026

Copy link
Copy Markdown
Owner

/ultrafix goal=8 max=10

@propr-dev propr-dev Bot added the ultrafix label Nov 17, 2026
@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Ultrafix loop started (goal: 8/10, max cycles: 10)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

Ready 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 ultrafix label.

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 blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S1: 🟢 Cover marker decision boundaries

Consider focused tests for findLiveCurrentEpochStep covering epoch mismatch, completed and failed jobs within grace, unreadable queue responses, and live jobs beyond grace. The integration tests already exercise the principal regression and missing-job expiry; these additional cases would protect the helper’s remaining branches against future changes. This is optional coverage, not a demonstrated defect.

Score

The 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

  • Model: GPT-6 Astra
  • Time: 25s
  • Tokens: 55,759 (55,342 in / 417 out)
  • Cost: $0.47

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S1

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 17, 2026
@propr-dev propr-dev Bot changed the title ◕ 1/1 [Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes ✅ 1/1 [Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes Nov 17, 2026

integry commented Nov 17, 2026

Copy link
Copy Markdown
Owner

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:

  1. When an Ultrafix step cannot start because the worker refuses it for disk pressure (WorktreeDiskPressureError from packages/core/src/storage/lifecycle.ts; the refusal comment comes from src/jobs/prCommentUnstartedFailure.ts), treat it as transient: retry the same step with backoff (about 2, 5, 10, 20 minutes, roughly an hour in total), do not count it toward the consecutive-failure limit, and post a single "Ultrafix is waiting for free disk space on the worker" notice instead of one refusal comment per attempt.
  2. If space does not return within that time, stop the loop with a stop notice that names the real reason, the real last score and the real cycle number (on [3598 by Claude Opus 5.5] MCP: contradictory state fields and mixed timestamp formats in results #3637 the notice said "Last score: unknown. Max cycles were exhausted" at cycle 1 of 6 with a last score of 6/10).
  3. Regression tests: two consecutive disk-pressure refusals followed by a successful admission continue the loop; persistent refusals end it with the correct notice and without the ultrafix label.

@propr-dev propr-dev Bot changed the title ✅ 1/1 [Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes ◕ 1/1 [Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes Nov 17, 2026
@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 8f4558c

Summary of Changes

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 [3598 by Claude Opus 5.5] MCP: contradictory state fields and mixed timestamp formats in results #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.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (9 files)
    • src/jobs/prCommentTaskStateFinalizers.ts (+11/−4)
    • src/jobs/ultrafixDiskPressureWait.ts (added, +147/−0)
    • src/jobs/ultrafixExhaustedStep.ts (added, +47/−0)
    • src/jobs/ultrafixFailedStep.ts (+87/−14)
    • src/jobs/ultrafixFailedStepFinalizer.ts (+8/−3)
    • src/jobs/ultrafixLoopContinuation.ts (+4/−0)
    • src/jobs/ultrafixOrchestrationService.ts (+4/−1)
    • src/jobs/ultrafixResumeClaim.ts (+6/−0)
    • src/jobs/ultrafixStrandedLoopRearm.ts (+27/−9)
  • Low risk (3 files)
    • docs/docs/features/pr-commands.md (+1/−0)
    • test/prCommentTaskStateFinalizers.test.ts (+19/−0)
    • test/ultrafixCiFailureRecovery.test.ts (+168/−1)

Validation evidence

  • No repository validation commands ran.

Diff size: 12 files changed, +529/−32 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 18m 19s
  • Tokens: 7,792,768 (7,742,254 in / 50,514 out)
  • Cost: $3.33
  • Subscription usage: Fable +1%

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 6941588329✓

…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
@propr-dev propr-dev Bot changed the title ◕ 1/1 [Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes ✅ 1/1 [Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes Nov 17, 2026

integry commented Nov 17, 2026

Copy link
Copy Markdown
Owner

/ultrafix goal=8 max=4

@propr-dev propr-dev Bot added the ultrafix label Nov 17, 2026
@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Ultrafix loop started (goal: 8/10, max cycles: 4)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

@propr-dev propr-dev Bot changed the title ✅ 1/1 [Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes ◕ 1/1 [Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes Nov 17, 2026
@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The 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 blockers

Every finding below was introduced by this PR and must be resolved before merging.

F1: 🔴 Retry failed waiting-notice publication

  • Category: correctness

  • Required behavior: Disk-pressure refusals must produce a single waiting-for-free-disk-space notice instead of leaving the PR without an explanation.

  • Evidence: src/jobs/ultrafixExhaustedStep.ts:35–42, handleExhaustedUltrafixStep

    static trace:

    1. The first disk-pressure refusal persists diskPressureWait with refusals: 1.
    2. The subsequent await post(...) encounters a GitHub failure. The supplied postPrComment implementation catches that failure and returns null.
    3. The handler ignores the result and returns reportedOnPullRequest: true, suppressing the ordinary refusal comment in prCommentTaskStateFinalizers.ts.
    4. Subsequent refusals have refusals > 1, so they never attempt to publish the waiting notice.

    A temporary GitHub failure therefore leaves the PR without the promised explanation throughout the remaining disk wait. Redis fencing and backoff preserve the retry obligation, but neither tracks successful notice publication. The new tests cover successful posting only.

  • Minimum fix: Track successful waiting-notice publication separately from the refusal count. Leave publication pending when post returns null, retry it during subsequent recovery, and suppress further notices only after successful publication. Add a regression where the first publication fails and a later attempt succeeds exactly once.

Suggestions

These are optional follow-ups and are not sent to /fix.

S2: 🟢 Cover the final permitted fix

Add 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 enqueueRearmReview. Existing disk-pressure tests exercise an earlier cycle; boundary coverage would strengthen confidence without requiring broader changes.

Score

The 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

  • Model: GPT-6 Astra
  • Time: 1m 34s
  • Tokens: 66,266 (64,744 in / 1,522 out)
  • Cost: $0.59

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix F1 S2

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 294d433

Addressed 1 AI review comment (IDs: 6942512811)

Addressed finding F1

Summary of Changes

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.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (2 files)
    • src/jobs/ultrafixDiskPressureWait.ts (+41/−2)
    • src/jobs/ultrafixExhaustedStep.ts (+14/−8)
  • Low risk (2 files)
    • docs/docs/features/pr-commands.md (+1/−1)
    • test/ultrafixCiFailureRecovery.test.ts (+45/−0)

Validation evidence

  • No repository validation commands ran.

Diff size: 4 files changed, +101/−11 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 7m 12s
  • Tokens: 1,164,092 (1,153,908 in / 10,184 out)
  • Cost: $0.75
  • Subscription usage: Weekly +1%

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 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
@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The 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 blockers

Every finding below was introduced by this PR and must be resolved before merging.

F2: 🔴 Preserve the final permitted fix retry

  • Category: correctness

  • Required behavior: A disk-pressure refusal must retry the same step with backoff rather than prematurely exhaust the loop’s cycle budget.

  • Evidence: src/jobs/ultrafixStrandedLoopRearm.ts, enqueueRearmReview; src/jobs/ultrafixResumeClaim.ts, evaluateStrandedLoopRearm.

    1. The normal continuation schedules the final permitted fix after a review.
    2. Admission refuses that fix for disk pressure. No action completes, so the loop retains its post-review action counts.
    3. After backoff, recovery evaluates the stranded-loop completion decision before reaching the new action selection in enqueueRearmReview.
    4. The existing stranded-loop budget rule stops a loop after its final review—even though normal continuation had already authorized its final fix. Consequently, the refused fix receives no retry and the notice reports exhausted cycles.

    Static trace: the supplied recovery documentation explicitly describes this final-review boundary and distinguishes it from a preserved deferred final fix. The new refusal record stores an action, but does not preserve that deferred-step authorization or change the budget decision for a non-exhausted disk wait. The added persistent-refusal test operates below the cycle limit and does not cover this boundary.

  • Minimum fix: Allow a current, non-exhausted disk-pressure wait to retry its already authorized step at the cycle boundary. Add a regression covering refusal and successful retry of the final permitted fix.

F3: 🔴 Retire disk waits after external takeover

  • Category: correctness

  • Required behavior: Recovery after intervening work must review the new head; an old disk-pressure wait must not authorize retrying a superseded fix.

  • Evidence: src/jobs/ultrafixDiskPressureWait.ts:65, getDiskPressureWait; src/jobs/ultrafixStrandedLoopRearm.ts, rearmFromSnapshot and enqueueRearmReview.

    1. An Ultrafix fix is refused, recording a disk wait against the current completed-step count.
    2. A manual follow-up runs and pushes a new head. As described in the supplied recovery contract, this advances the automatic-work epoch while leaving the Ultrafix loop active.
    3. The follow-up is not a completed Ultrafix step, so the wait’s completed-step count still matches.
    4. On recovery, getDiskPressureWait therefore returns the old wait. enqueueRearmReview selects its fix action instead of reviewing the changed head, and readiness is evaluated for a fix, which does not wait for CI.

    Static trace: wait validity checks only completed-step counts; the wait carries no ownership identity. Epoch reservation fences the newly queued job but does not invalidate the stale action used to select it. This permits a superseded fix to run against a changed head without the recovery review.

  • Minimum fix: Distinguish the wait’s own retry handoffs from external takeover. Retire the wait when unrelated work supersedes its step, then use normal review recovery. Test a refused fix followed by a manual follow-up push.

Suggestions

These are optional follow-ups and are not sent to /fix.

No suggestions.

Score

The 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

  • Model: GPT-6 Astra
  • Time: 1m 34s
  • Tokens: 68,379 (66,951 in / 1,428 out)
  • Cost: $0.61

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix F2 F3

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 7c6ef24

Addressed 1 AI review comment (IDs: 6943184036)

Addressed findings F2, F3

Summary of Changes

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.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (3 files)
    • src/jobs/ultrafixDiskPressureWait.ts (+39/−4)
    • src/jobs/ultrafixResumeClaim.ts (+13/−5)
    • src/jobs/ultrafixStrandedLoopRearm.ts (+23/−10)
  • Low risk (2 files)
    • docs/docs/features/pr-commands.md (+1/−1)
    • test/ultrafixCiFailureRecovery.test.ts (+77/−0)

Validation evidence

  • No repository validation commands ran.

Diff size: 5 files changed, +153/−20 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 9m 41s
  • Tokens: 2,543,073 (2,521,374 in / 21,699 out)
  • Cost: $1.43

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 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
@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The 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 blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S3: 🟢 Cover score persistence with escalation

Add a regression combining enabled escalation with subsequent disk-pressure exhaustion. continueUltrafixLoop persists the score separately before passing its earlier updatedState snapshot to applyReviewEscalation. Coverage confirming that the eventual stop notice retains the latest score would strengthen confidence in this interaction. The supplied context does not establish that escalation overwrites it, so this is optional coverage rather than a verified defect.

Score

The 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

  • Model: GPT-6 Astra
  • Time: 3m 14s
  • Tokens: 72,097 (71,397 in / 700 out)
  • Cost: $0.62

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S3

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 17, 2026
@propr-dev propr-dev Bot changed the title ◕ 1/1 [Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes ✅ 1/1 [Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes Nov 17, 2026
@integry
integry merged commit cd5a181 into main Nov 17, 2026
45 checks passed
@propr-dev propr-dev Bot changed the title ✅ 1/1 [Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes [Epic] 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes Nov 17, 2026
@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

✅ Epic merged: 0.9.2 release fixes: Ultrafix loop ends as failed right after CI passes

Epic 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

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

Labels

Projects

None yet

1 participant