Repository navigation
[3860 by Claude Opus 5.5] # Issue jobs refused for disk pressure are dropped silently; implement_plan returns 500 with no log - #3862
Conversation
I've fixed both bugs from issue #3860. All the targeted suites pass, including the BullMQ ones against a real Redis 7.2.5. Typecheck and lint are clean for core and the API, except for one existing lint warning in `AntigravityAgent.ts`, which I didn't touch. I didn't run the full test suite. 1. Issue jobs refused for disk pressure Retry with backoff. In core's `createWorker`, an issue job that admission refuses with `WorktreeDiskPressureError` is now delayed on the same job instead of failing (`packages/core/src/queue/issueDiskPressureDeferral.ts`). It waits 2, 5, 10 and then every 20 minutes, and these waits don't use up its 3 attempts. Each wait is logged as "Issue job refused for disk pressure: waiting for free disk space". The total wait is capped by a new setting, `WORKTREE_DISK_PRESSURE_MAX_WAIT_MS` (default 1 hour). When it runs out, the job fails for good with no further retries, and the error message still identifies disk pressure. The admission check itself is unchanged. Reporting the final refusal (`packages/core/src/services/issueDiskPressureRefusal.ts`): - The issue gets one comment saying disk pressure stopped the run and that nothing changed. To retry, it says to remove and re-add the trigger label, or to retry the issue from its plan. - A plan issue stuck in `processing` with no task goes back to `pending`. If it is part of a running epic execution, it shows as blocked (`dispatch_failed`) with the disk-pressure reason, so `get_plan` and the Studio show why it stopped. No silent dedupe. Both enqueue paths (core issue detection and the API's `enqueueIssueImplementationJob`) now check for an existing job with the same ID first. A failed or completed one is removed and replaced. A live one (for example, a job waiting for disk space) keeps the request, and that is logged rather than silently dropped. 2. `implement_plan` with a running epic queue - Clear refusal. A sequential or graph `implement_plan` while the plan's epic execution is still running now gets a 409 `EPIC_EXECUTION_ACTIVE` error ("This plan's epic execution is still running issues #…; retry when it finishes."). It is refused before anything is claimed, labelled or dispatched. Before, the queue creation threw a plain error, which came back as `OUTCOME_UNKNOWN`/500. I chose to refuse rather than append to the running queue, since its order and dependency edges are fixed when it starts. - Logging. Any MCP tool failure that the caller only sees as an internal error (including `OUTCOME_UNKNOWN` caused by one) is now logged as "MCP tool failed internally", with the tool, operation ID, repository, message and stack (`packages/api/mcp/internalFailureLog.ts`). Behaviour to be aware of - Submission intake jobs. These are also issue jobs, so they wait for disk space too now. The existing intake test sets `WORKTREE_DISK_PRESSURE_MAX_WAIT_MS=0`, which keeps the old behaviour of failing within seconds. - Automatic re-dispatch. A blocked epic issue can be re-dispatched by the queue's recovery sweep after its normal 15-minute retry interval. That re-dispatch re-adds the trigger label, which only starts a new job if polling picks the issue up. That's why the comment tells people to remove and re-add the label. - Repeat comments. The issue keeps its trigger label, so where polling is on it will be picked up again. During a long disk shortage it can get a refusal comment roughly every hour. Tests - New: `issueDiskPressureDeferral.test.ts` (schedule, deferral, final failure), `issueDiskPressureQueue.test.ts` (real BullMQ: a refused job is delayed rather than failed; an exhausted wait fails on that refusal; re-enqueuing after a retained failed job runs it), `issueDiskPressureRefusal.test.ts` (comment, plan issue state, no immediate re-dispatch), and `mcpInternalFailureLog.test.ts`. - Added to `mcpEpicDispatch.test.ts`: the 409 refusal in sequential and graph modes, and acceptance once the queue has finished. - Checking they catch the bug: the queue test shows a plain `add` being swallowed by the retained failed job. Removing the re-dispatch guard makes the refusal test fail. - Adjusted: `test/planIssueImplementationTrigger.test.ts` lists core's exports by hand in its mock, so I added the new enqueue helper to it. I updated the docs to match: the maintenance and configuration-reference pages, the API reference, `docs/mcp.md` and `.env.example`. There are no visual previews, since nothing user-facing changed on screen. ProPR-Agent: claude/claude-opus-5-5
|
/ultrafix goal=8 max=6 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 6) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
Please also add this requirement. It was appended to #3860 after this run started: The refusal at 19:00–19:01 UTC can't be diagnosed after the fact. The server has 40–55 GB free in normal operation, and with Required:
|
|
✅ Applied the requested follow-up changes in commit 9548462 Summary of ChangesDisk-pressure refusals now say what was measured, so a really full disk can be told apart from leaked The error. The job's own claim is shown as its own term. It is already on disk when the check runs, so it was always part of the total. If the other claims aren't all the same size, it says "N other claims totalling X" instead of "× X". Only the message survives a BullMQ round-trip, so Where the numbers now appear:
Claim listing. Each refusal logs one Tests:
I also added a paragraph to Review digestRisk-tiered paths
Diff size: 16 files changed, +406/−61 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
Disk-pressure refusals now say what was measured, so a really full disk can be told apart from leaked `readers/` claims. The targeted suites pass, and typecheck and zero-warning lint are clean for the files I changed. I didn't run the full suite.
**The error.** `WorktreeDiskPressureError` now carries a `measurement` with the filesystem path, `freeBytes` (`bavail * bsize`), `reserveBytes`, `reservedBytes` and `claimCount` of the other claims, and the job's `taskBytes`. The message keeps the old prefix and adds the numbers:
```
Worktree disk pressure: admission reserve unavailable; data retained (filesystem /tmp/git-processor: free 6.2 GiB < required 7.0 GiB = reserve 2.0 GiB + 4 other claims × 1.0 GiB + this job 1.0 GiB)
```
The job's own claim is shown as its own term. It is already on disk when the check runs, so it was always part of the total. If the other claims aren't all the same size, it says "N other claims totalling X" instead of "× X". Only the message survives a BullMQ round-trip, so `worktreeDiskPressureDetails()` reads the numbers from either the original error or the message. The new code is in `packages/core/src/storage/diskPressure.ts`, and `lifecycle.ts` re-exports it.
**Where the numbers now appear:**
- **Logs:** the worker's "Job failed" log, and both issue-deferral logs ("waiting for free disk space" and "the wait for free disk space ran out"). The final error message has them too, and the latest refusal's numbers are kept on the job as `diskPressureDetails`.
- **Issue comment** when the wait runs out ("Measured at the last refusal:"), plus its log line.
- **PR comment** for a refused PR comment job, plus its log line.
- **Ultrafix:** the "Ultrafix step refused for disk pressure: waiting for free disk space" log, the re-arm "waiting for free disk space on the worker" log, the waiting notice, and the stop notice posted when the wait runs out. They are saved in the loop's wait state so the stop notice can repeat them.
**Claim listing.** Each refusal logs one `[storage] Worktree admission refused (...)` warning. It lists every claim file it counted, with its size, owner host and pid, and age (taken from the file's last-modified time). The job's own claim is marked "(this job)". Claims that reserve nothing aren't counted or listed. An age like `3h 05m` on a pid 19 claim would point to a leak.
**Tests:**
- **New, `packages/core/test/worktreeDiskPressureDetails.test.ts`:** a real admission refusal on a temp filesystem, which checks every field, the separated own claim, the message, the single warning and its owner, pid and age line. It also covers recovering the numbers from the message alone, and the deferral and final-failure logs and messages.
- **Added to existing tests:** `issueDiskPressureRefusal.test.ts` for the issue comment, `test/prCommentUnstartedFailure.test.ts` for the PR comment and its log, and `test/ultrafixCiFailureRecovery.test.ts` for the Ultrafix log and both notices. The last two mock `@propr/core` with a fixed list of exports, so I added `worktreeDiskPressureDetails` to those mocks.
`packages/core/test/taskSubmissionIntake.test.ts` reports a failure at the file level, though all 7 of its tests pass. It exits 1 when GitHub auth isn't configured, as it does here. With `PROPR_DEMO_MODE=true` it never exited, and my 5-minute timeout stopped it. I didn't check it against the code before this change.
I also added a paragraph to `docs/docs/operations/maintenance.md` describing the numbers and how to spot leaked claims from the warning. There are no previews: nothing changes in the app's interface, only log lines and GitHub comment text.
PR: #3862
Comment by: @integry (ID: 7229594049)
Model: Claude Opus 5.5
ProPR-Agent: claude/claude-opus-5-5
|
CI failed: CodeQL Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit e634f43 Processed 2 comments:
Summary of ChangesI fixed the CodeQL "polynomial regular expression" alert in What was wrong: Fix: a new helper,
A filesystem path containing parentheses still parses correctly. Test: I added one to Checks run:
The CodeQL check itself will only clear when CI re-runs on the next push. There's no visual change, so I made no preview. Review digestRisk-tiered paths
Diff size: 2 files changed, +29/−2 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed the CodeQL "polynomial regular expression" alert in `packages/core/src/storage/diskPressure.ts`. **What was wrong:** `worktreeDiskPressureDetails` read the measurement back out of a refusal message with the regex `/\((filesystem .+ this job [^)]+)\)$/`. After a queue round-trip that message is uncontrolled input, and on strings that repeat `(filesystem ` or `( this job ` the regex can take polynomial time. **Fix:** a new helper, `measurementFromMessage`, replaces the regex with plain string searches that run in linear time. It returns the same text the regex captured: - the message must end with `)`. - the details start at the first `(filesystem `. - the last ` this job ` must be followed by a non-empty size with no `)` in it. A filesystem path containing parentheses still parses correctly. **Test:** I added one to `packages/core/test/worktreeDiskPressureDetails.test.ts`. It feeds in the two attack strings from the CodeQL report, each 100,000 repetitions long, and checks both return `null` in under a second. It also checks that a path like `/mnt/data (ssd)` still comes back intact. Locally, the two attack strings at 200,000 repetitions took 4 ms in total. **Checks run:** - `worktreeDiskPressureDetails.test.ts` (4 pass) and `issueDiskPressureRefusal.test.ts` both pass, run with `--experimental-test-module-mocks`. - Core `tsc --noEmit` is clean. - `eslint` is clean on `diskPressure.ts`. The lint config ignores the test file, so it wasn't linted. The CodeQL check itself will only clear when CI re-runs on the next push. There's no visual change, so I made no preview. PR: #3862 Comment by: @github-advanced-security[bot] (ID: 4724322111) Comment by: @propr-dev[bot] (ID: 7229985603) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
CI failed: Full Test Suite Shard 1/4 Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit d9ad1d4 Summary of ChangesI fixed the Shard 1/4 failure: two tests were still checking for the old disk-pressure message, from before this PR added the measurement to it. The cancelled Shard 2/4 had a third stale test, which I fixed too. All three now pass against a real Redis 7.2.5. Cause: the refusal message now ends with the measurement the follow-up comment asked for, e.g. Changes:
Checks:
Shards 3 and 4 were cancelled, so I couldn't see their results; the sweep above was my substitute. One other suite fails here: There's nothing visual in this change, so I made no previews. Review digestRisk-tiered paths
Diff size: 3 files changed, +12/−4 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed the Shard 1/4 failure: two tests were still checking for the old disk-pressure message, from before this PR added the measurement to it. The cancelled Shard 2/4 had a third stale test, which I fixed too. All three now pass against a real Redis 7.2.5.
**Cause:** the refusal message now ends with the measurement the follow-up comment asked for, e.g. `(filesystem /tmp/…: free 85.0 GiB < required 8.0 PiB = reserve 8.0 PiB + 0 other claims + this job 1.0 GiB)`. Tests that required the message to end at `data retained` failed.
**Changes:**
- **`packages/core/test/taskSubmissionIntakeQueue.test.ts`** (Shard 1/4): both tests now check for the full message, including the measurement, and that the measured path appears in it.
- **`packages/core/test/issueDiskPressureQueue.test.ts`**: the "wait ran out" test had the same stale check. CI ran it in Shard 2/4, which failed it before being cancelled, so it would have broken the next run.
- **`packages/core/src/queue/taskQueue.metrics.ts`**: this is the one code change. The second test also showed a real problem: the failure log kept only the first 100 characters of an error. When a stuck queued submission is later marked failed from that log, the message the user sees was cut off mid-path (`…(filesystem /tmp/propr-intake-1. Once the cause is fixed…`). That breaks the requirement that every user-facing report shows the measurement. I raised the limit to 400 characters. Putting the 100 back makes that test fail again.
**Checks:**
- These suites pass: the five core disk-pressure and intake suites, `test/queueMetrics.integration.test.ts`, the API intake routes suite, the three root suites that mention the message, and every suite that touches the storage lifecycle.
- Core typecheck is clean. The lint gates don't cover these files.
Shards 3 and 4 were cancelled, so I couldn't see their results; the sweep above was my substitute. One other suite fails here: `test/queue.test.ts` ("createWorker creates a worker with correct configuration"). It fails the same way with my metrics edit reverted, so the edit isn't the cause. Whether it's a local-environment issue, I don't know yet, because the run was cancelled before CI reached it.
There's nothing visual in this change, so I made no previews.
PR: #3862
Comment by: @propr-dev[bot] (ID: 7230259257)
Model: Claude Opus 5.5
ProPR-Agent: claude/claude-opus-5-5
|
CI failed: Full Test Suite Shard 4/4, Run Full Test Suite Please investigate and fix these CI failures.
Failure evidence
Depends on the failed job(s): Failure evidence
|
Full Test Suite ResultsValidation failed during: Test shard (shard 4).
View shard 4/4 outputDetails truncated; see the uploaded artifacts for complete failure rows and logs. |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds bounded disk-pressure deferral, terminal refusal reporting, and internal MCP failure logging. It needs a localized correction before merge: the new enqueue helper can still silently discard requests. ✅ Bounded deferral — The same issue job waits without consuming attempts, then raises an unrecoverable failure when its wait expires; unit and Redis integration tests cover these transitions. ✅ Useful diagnostics — Admission measurements survive message serialization and appear in refusal logs and user-facing reports. ✅ Explicit MCP refusal — Active epic executions produce a documented 409, with tests checking transaction rollback and absence of dispatch. The supplied issue specification is explicitly truncated, so requirements beyond its visible text cannot be assessed. Current checks show 24 passed, two pending, and no failures. 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: 🔴 Preserve requests through enqueue races and failures
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Exercise recovery after actual admissionThe Redis integration suite verifies initial deferral and exhaustion, but does not demonstrate a deferred job subsequently gaining admission. A test that lifts the injected reserve, promotes the delayed job, and verifies one processor execution plus cleared wait fields would strengthen coverage. This is optional because the supplied implementation and unit tests already support that transition. ScoreThe main refusal and diagnostic paths are well covered, but enqueue handling still permits the silent request loss this change seeks to eliminate. The remaining correction is localized; the two pending checks are not themselves blockers. 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 24f70fc Processed 2 comments:
Summary of ChangesI fixed the Shard 4/4 failure, and Cause: this PR's disk-pressure wrapper read Fix: two lines, matching what the worker already does:
Checks:
I didn't rerun the full shard. This change has no visible effect, so there are no previews. Review digestRisk-tiered paths
Diff size: 2 files changed, +3/−3 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
|
❌ ProPR could not start on The job failed 3 times before processing began: Post the command again once the cause is resolved. |
I fixed the Shard 4/4 failure, and `test/queue.test.ts` now passes locally. **Cause:** this PR's disk-pressure wrapper read `job.name` without checking that `job` exists. The test "createWorker creates a worker with correct configuration" calls the worker's processor without passing a job. So reading `job.name` threw a `TypeError` inside `repositoryStorageLifecycle.use(...)`. The `catch` in `deferIssueJobOnDiskPressure` then read `job.name` again and threw a second time. The worker code before this PR already allowed for a missing job (`job?.stalledCounter`); only the new lines didn't. **Fix:** two lines, matching what the worker already does: - `packages/core/src/queue/taskQueue.ts`: `job?.name === ISSUE_JOB_NAME` before `endIssueDiskPressureWait`. - `packages/core/src/queue/issueDiskPressureDeferral.ts`: `deferIssueJobOnDiskPressure` now accepts `DeferrableIssueJob | undefined` and checks `job?.name`. A missing job just rethrows the original error, so how real issue jobs are deferred doesn't change. **Checks:** - `test/queue.test.ts` passes, run through `scripts/run-test-suite.mjs` after rebuilding shared and core. - The PR's disk-pressure suites also pass: `issueDiskPressureDeferral`, `issueDiskPressureQueue`, `issueDiskPressureRefusal` and `worktreeDiskPressureDetails`. - Core `tsc --noEmit` and ESLint with `--max-warnings 0` on the two changed files are clean. I didn't rerun the full shard. This change has no visible effect, so there are no previews. PR: #3862 Comment by: @propr-dev[bot] (ID: 7230678633) Comment by: @github-actions[bot] (ID: 7230682971) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds bounded disk-pressure deferral, terminal refusal reporting, admission diagnostics, and explicit MCP conflict handling. It needs changes before merge because the new replacement and status-release paths can affect work they do not own. ✅ Bounded admission waits — Deferrals preserve the same job and attempt budget; exhaustion produces a recognizable unrecoverable failure. The added Redis integration tests cover these transitions. ✅ Useful failure diagnostics — Measurements survive serialization through the error message, and internal MCP failures are logged before operation handling converts them into receipts. The supplied original objective is truncated, so requirement validation is limited to its visible portion. This review is static; no commands or tests were run. Current checks report no failures and three pending checks; the historical shard failure is not treated as current. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F2: 🔴 Concurrent replacement can delete the new job
F3: 🔴 Refusal resets historical plan issues
SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Preserve measurements independently of truncation
ScoreThe implementation provides useful diagnostics and focused coverage, but two ownership problems remain in the newly introduced state mutations. Both can be corrected locally without redesigning the deferral mechanism. 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 c5f0a87
Summary of ChangesI fixed F1, F2 and F3. Each new regression test fails on the previous code and passes with the fix. The queue tests ran against a real Redis 7.4.11 that I built from source in F1 – a request is lost when the old job vanishes or can't be removed (
F2 – a competing replacement can delete the new job (same file)
F3 – a refusal reset historical plan issues (
New tests
Verification
Separate finding: Remaining gap: the lock covers every caller that adds these jobs. A worker only ever removes a finished job, never brings it back, and the failed-removal path handles that removal. The one window left is a lock holder that stalls for more than 30 s mid-replacement; then the lock expires and the race could happen again. Review digestRisk-tiered paths
Diff size: 4 files changed, +186/−27 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed F1, F2 and F3. Each new regression test fails on the previous code and passes with the fix. The queue tests ran against a real Redis 7.4.11 that I built from source in `/tmp`. **F1 – a request is lost when the old job vanishes or can't be removed** (`packages/core/src/queue/issueJobEnqueue.ts`) - If the old job disappears between being found and having its state read (BullMQ then reports `unknown`), the helper now treats it as absent and adds the new job. Before, it returned `already_queued` and added nothing. - If removing a finished job fails, the helper checks the job's state again: - **Job is gone:** it adds the new job. - **Job is live:** it returns `already_queued`. - **Job is still finished:** it re-throws the error. The daemon's `withRetry` then retries, instead of the helper reporting `added` for an add that BullMQ silently deduplicated against the old job. **F2 – a competing replacement can delete the new job** (same file) - All replacements of one job ID now run one at a time, under a lock in Redis keyed per job ID. The lock expires after 30 s, and only the request that took it can release it. - A second request therefore checks the job only after the first one's job has been added, finds it live and returns `already_queued`, so the first job and its data stay in place. - Both callers (the daemon's `processDetectedIssue` and the plan route's `enqueueIssueImplementationJob`) go through this helper. A search found nothing else that adds jobs under the `issue-<owner>-<repo>-<number>` IDs. - A request that waits more than 10 s for the lock fails with an error instead of going ahead. - Test fakes without a Redis connection skip the lock, as they did before. **F3 – a refusal reset historical plan issues** (`packages/core/src/services/issueDiskPressureRefusal.ts`) - The release now updates only the selected row: its ID must match, its status must be `processing` and it must have no task ID. These conditions are part of the journaled update itself. - The follow-on notification, draft-status check and activity event go only to that row's draft, and only if the row actually changed. **New tests** - `issueDiskPressureQueue.test.ts`: - a job that disappears while its state is read - a removal that fails, then a retry that succeeds - two concurrent replacements, checking that exactly one is `added` and the stored data is that request's - `issueDiskPressureRefusal.test.ts`: an older merged row in another draft stays untouched while the newer processing row goes back to `pending`. **Verification** - Both changed suites pass, the queue suite three runs in a row. - Core and API typechecks are clean (API after rebuilding core's `dist`), and lint is clean on the changed source files. - The caller suites pass: `test/issueDetection.integration.test.ts`, `test/taskIntentWithdrawal.test.ts`, `test/intentWithdrawalWebhook.test.ts` and `test/planIssueImplementationTrigger.test.ts`. **Separate finding:** `packages/core/test/taskSubmissionIntakeQueue.test.ts` fails as a whole file with no subtest results. It fails the same way with my changes reverted, so it isn't caused by this fix; I didn't investigate it. **Remaining gap:** the lock covers every caller that adds these jobs. A worker only ever removes a finished job, never brings it back, and the failed-removal path handles that removal. The one window left is a lock holder that stalls for more than 30 s mid-replacement; then the lock expires and the race could happen again. PR: #3862 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds bounded disk-pressure deferral, final refusal reporting, retained-job replacement, and MCP error diagnostics. It needs a localized correctness fix before merge. ✅ Preserved retry budget — Same-job deferral uses ✅ Explicit MCP refusal — Active epic execution now produces a structured 409, with tests verifying rollback of the new issue’s claim. The supplied current-head checks are green. The original issue specification is explicitly truncated, so requirements beyond its visible portion cannot be assessed. This review is based on static inspection; no commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F4: 🔴 Distinguish refused retries from unstarted jobs
SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Exercise recovery after successful admissionThe new Redis suite verifies deferral and exhaustion, but does not resume a deferred job after restoring capacity. An integration test covering that transition would strengthen confidence that the same job runs, retains its payload and attempt budget, and clears its waiting metadata. This is optional additional coverage; the constituent operations already have tests. ScoreThe implementation has substantial targeted coverage and passing current checks. One localized reporting defect remains: final admission failure is incorrectly treated as proof that the entire job never started. 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 a5a2df4
Summary of ChangesI've fixed F4. The final disk-pressure comment now says "could not start… Nothing was changed" only when the job records that no attempt ever got into the processor. Before, it made that claim even when an earlier attempt had run and failed. What changed
Tests
The three disk-pressure suites and There are no visual changes, so I made no previews. Review digestRisk-tiered paths
Diff size: 6 files changed, +98/−24 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
I've narrowed the PR to the five parts you listed. All the dispatch-row, takeover, generation/fencing and cross-producer replacement code is gone, along with its tests. All the suites I ran pass, including the BullMQ ones against a real Redis 7.2.5 built in `/tmp`. Core typecheck and lint on the changed core sources are clean. I didn't run the full test suite. **Removed** - The `issue_dispatches` migration, `issueDispatch.ts`, `issueJobSettlement.ts` and `issueDispatchLifecycle.test.ts`. - The replacement helper from the earlier commits (`enqueueIssueJobReplacingFinished` and its Redis lock). - Every file the redesign touched outside the disk-pressure work is back to the merge base, byte for byte. That covers the plan route, the follow-up route and its tests, `issueDetection.ts`, `taskSubmissionIntake.ts`, `taskQueue.types.ts`, `taskIntentWithdrawal.test.ts` and `planIssueImplementationTrigger.test.ts`. **Kept, and what changed** 1. **Deferral:** unchanged. A refused issue job is retried on the same job after 2, 5, 10, then every 20 minutes, without using its attempts, for at most `WORKTREE_DISK_PRESSURE_MAX_WAIT_MS`. 2. **Free-space numbers:** unchanged. The error, every log line and the final comment carry the measurement, there's one warning per refusal listing the counted claims, and the regex CodeQL flagged stays replaced. 3. **Final refusal:** - The plan issue is only changed if the issue's newest plan row is still `pending` or `processing` and is linked to this run. Linked means it has no task yet, or its task has this job's correlation ID. - Finished, historical and other-run rows are left alone, and their epic queue entry isn't blocked either. - The comment says "nothing was changed" only when no attempt of this job got past admission. Otherwise it says "The latest attempt was refused … after an earlier attempt of this run had already started." 4. **Re-enqueue:** this is the only new mechanism. When an issue job is finally refused for disk pressure, its own `failed` handler (`settleIssueDiskPressureFailure` in `taskQueue.ts`) posts the report and then calls `job.remove()`. It runs after the submission-intake handler has read the failed job, which that handler still needs. Nothing else removes or replaces jobs. 5. **`implement_plan`:** unchanged. Internal failures are logged with stack and operation ID, and a call while the plan's epic queue is active gets a 409 `EPIC_EXECUTION_ACTIVE` instead of a 500. **Tests** | Suite | Passed | |---|---| | Refusal reporting, deferral, measurement details | 24/24 | | Disk-pressure queue, real Redis | 4/4 | | Submission intake queue, real Redis | 2/2 | | API `mcpEpicDispatch` and `mcpInternalFailureLog` | 84 + 2 | | Root suites (plan trigger, PR-comment refusal, Ultrafix recovery, intent withdrawal, issue detection) | 275 | New and changed tests: - **Re-enqueue:** a finally refused job kept on failure (as polling's jobs are) is removed, and re-adding it under the same job ID runs it. This fails without the removal. A job that fails for any other reason keeps its normal retention. - **Plan issue:** a row owned by another run's task isn't touched; `merged`, `closed`, `under_review` and `in_refinement` rows are never reset; when the newest row is finished, an older `processing` row is left alone too. - **Wording:** a refused retry after an admitted attempt releases its own plan issue and says the latest attempt was refused. `packages/core/test/issueDiskPressureRefusal.test.ts` shows as untracked because an earlier commit on the branch deleted it. It needs to be part of the commit. The docs paragraph in `maintenance.md` now describes the removal and the linked/non-terminal rule instead of job replacement. No preview was made, since none of this is visible in the UI. PR: #3862 Comment by: @integry (ID: 7236941756) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
/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 EvaluationThe PR adds bounded disk-pressure deferral, failure reporting, admission diagnostics, and an explicit MCP refusal for active epic executions. It needs a localized correctness fix before merge. ✅ Preserved retry budget — Disk-pressure waits delay the same job without consuming attempts, with unit and Redis integration coverage. ✅ Actionable MCP refusal — Active sequential and graph executions return a structured 409, with tests verifying that refused requests leave no new claims. ✅ Useful diagnostics — Admission measurements survive error-message serialization and appear in logs and user-facing reports. This review is based on static tracing; no commands were run. The original issue specification is explicitly truncated, so omitted requirements cannot be assessed. Current-head checks report no failures, with six still pending. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F11: 🔴 Final cleanup can delete a replacement job
SuggestionsThese are optional follow-ups and are not sent to S5: 🟢 Exercise recovery of the delayed jobThe Redis tests verify initial deferral and successful execution of a newly enqueued job after final failure. An additional test that lifts disk pressure and resumes the original delayed job would cover successful admission, wait-field cleanup, and processor execution together. This is optional coverage strengthening; the supplied code does not establish a defect in that path. ScoreThe implementation has substantial focused coverage and useful diagnostics, but asynchronous cleanup can delete newly accepted work. Fixing that ownership error is necessary before merge. 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 9f04aac
Summary of ChangesI fixed F11: cleanup after a disk-pressure refusal no longer deletes a newer job that reuses the same job ID. The new regression fails on the old code and passes with the fix. What changed
There is no remaining race window: the check and the removal run as one Redis script. Tests (added to
Things to know
No preview, since nothing visible changed. Review digestRisk-tiered paths
Diff size: 3 files changed, +172/−8 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed F11: cleanup after a disk-pressure refusal no longer deletes a newer job that reuses the same job ID. The new regression fails on the old code and passes with the fix.
**What changed**
- **New file `packages/core/src/queue/removeOwnFailedJob.ts`.** It removes a failed job only if that job is still the one the handler holds:
- If BullMQ already deleted the job when it failed (`removeOnFail: true`, `0`, or `{count: 0}`), it does nothing. Both producers named in the finding set this.
- Otherwise it runs BullMQ's own `removeJob` script with an atomic check in front. The ID must still be in the queue's failed set, and the stored `timestamp` (set when the job was added) and `finishedOn` must match the held job. If not, it returns `not_owned` and touches nothing. A waiting, delayed or later-failed job under the same ID is left alone.
- **`settleIssueDiskPressureFailure` in `packages/core/src/queue/taskQueue.ts`** now uses this helper instead of an unconditional `job.remove()`, and its doc comment says so.
There is no remaining race window: the check and the removal run as one Redis script.
**Tests** (added to `packages/core/test/issueDiskPressureQueue.test.ts`, run against a real Redis 7.2.5 built locally)
- **End-to-end regression:** the old failure handler is paused while it reports, by holding its database access at a gate. During the pause the test confirms BullMQ already removed the failed job, adds a replacement under the same ID, and waits until it is delayed waiting for space. The handler is then released and the test checks that the replacement is still delayed. With the old `job.remove()` this test fails ("the replacement survives the old delivery's cleanup").
- **Direct test of the helper:** it removes the job it holds while that job is still the failed one. It returns `not_owned` and keeps the replacement when the replacement is waiting, delayed, or has failed itself. It returns `removed_on_fail` when BullMQ already removed the job. With the check taken out of the script, this test fails.
- **Results:** `node scripts/run-test-suite.mjs` passes the four disk-pressure and intake suites, including the 6 tests in `issueDiskPressureQueue`. `tsc` and the core lint are clean.
**Things to know**
- The helper loads BullMQ's packaged script from `bullmq/dist/cjs/scripts/removeJob-2.js`. BullMQ doesn't export that path officially, so a BullMQ upgrade could move it. The helper checks the script's key count and throws if it changes. The failure handler catches that error and logs a warning, so the issue job would then stay in the failed set instead of being removed.
- I checked the rest of the PR for the same mistake: no other changed code removes jobs by ID.
No preview, since nothing visible changed.
PR: #3862
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds bounded disk-pressure deferral, refusal reporting, admission diagnostics, and clearer MCP failures. It needs a localized recovery fix before merge. ✅ Preserves retry budgets — Disk-pressure deferrals retain the same BullMQ job and leave ✅ Protects replacement deliveries — Failed-job removal checks delivery timestamps and failed-set membership atomically before deleting a retained job. ✅ Explains MCP refusals — Active epic executions receive an explicit 409, while internal tool errors are logged with operation context. The original issue specification is truncated, so requirement assessment is limited to its visible content. The supplied current-head checks show no failures; Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F12: 🔴 Preserve recoverable evidence of early terminal failure
SuggestionsThese are optional follow-ups and are not sent to S6: 🟢 Exercise recovery on the delayed deliveryThe real-Redis tests verify deferral and successful execution of a newly enqueued replacement. An additional test that restores capacity and promotes the original delayed delivery would directly verify successful admission, wait-field cleanup, and processor execution on that same job. This is optional coverage beyond the demonstrated recovery defect. ScoreThe implementation has substantial focused coverage and passing current-head tests, but early terminal failure introduces a durable recovery gap that can leave submissions permanently queued. 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 88d761f
Summary of ChangesI fixed F12. A submission whose intake job fails for good on its first attempt (a disk-pressure wait that ran out) now gets settled by reconciliation, even if the worker's failure finalizer never finished. The problem: the only failure evidence left after The fix:
Tests:
Verification:
No other code compares failure counts against Review digestRisk-tiered paths
Diff size: 5 files changed, +83/−13 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
|
F11 and F12 both come from the one cross-cutting piece left in this PR: removing the failed job after a final disk-pressure refusal, so a later trigger can reuse the jobId. Please drop that piece from this PR. It moves to #3873, where a fresh jobId per dispatch makes removal unnecessary.
|
I fixed F12. A submission whose intake job fails for good on its first attempt (a disk-pressure wait that ran out) now gets settled by reconciliation, even if the worker's failure finalizer never finished. **The problem:** the only failure evidence left after `removeOnFail` deletes the job is the metrics failure log. Reconciliation only settles an absent intake once it sees `SUBMISSION_INTAKE_ATTEMPTS` (3) failures. An `UnrecoverableError` ends the job after one, so the submission stayed queued forever. **The fix:** - **`taskQueue.metrics.ts`** (`updateFailedMetrics`): a failure BullMQ won't retry is now logged with `final: true`. It is identified by `finishedOn` being set, the same test `finalizeSubmissionIntakeFailure` already uses. - **`taskQueue.types.ts`**: added an optional `final` field to `AiMetrics`. - **`taskSubmissionIntake.ts`**: - When it reads the failure log, `queueSubmissionIntakeEvidence().failures` now reports `final: true` if the latest job instance has a failure marked final. A mark on an older instance doesn't carry over. - `reconcileSubmissionIntake` settles an absent intake from either three failures or one final failure. It still runs every existing check first, including the dispatch lock and re-reading the job after the log read, so a replacement delivery still decides instead. **Tests:** - **Unit tests** (`taskSubmissionIntake.test.ts`): - A single final failure settles the submission. - A final failure on an older instance doesn't settle a newer instance's retryable failure. - A live replacement keeps the submission queued. - The log reader sets the final flag only for the latest instance. - **Real Redis/BullMQ regression** (`taskSubmissionIntakeQueue.test.ts`): it holds the submission's dispatch lock, so the finalizer can't settle it (standing in for an interrupted one), then lets the intake fail unrecoverably with `attemptsMade === 1` while BullMQ removes the job. After the lock is released, reconciliation settles it with "Implementation did not start: Worktree disk pressure: … after waiting 120 minutes (7 refusals) …". Re-adding a delivery under the same job ID keeps it queued. **Verification:** - Against a locally built Redis 7.2.5, all three affected suites pass: `taskSubmissionIntake` 12/12, `taskSubmissionIntakeQueue` 3/3, `issueDiskPressureQueue` 6/6. - I reverted each half of the fix in turn. Without the reconcile change, the unit case and the new Redis test fail. Without the `final` mark in the metrics, the new Redis test fails. - `tsc` passes for core, and eslint (zero warnings) passes for the three changed source files. Typechecking the two test files shows no errors from these changes, only existing missing-declaration errors for the `.js` migration imports. No other code compares failure counts against `SUBMISSION_INTAKE_ATTEMPTS`; `reconcileSubmissionIntake` was the only place with this assumption. Nothing here is visible in the UI, so there are no previews. PR: #3862 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
✅ Applied the requested follow-up changes in commit 6cd5fde Summary of ChangesI've removed the post-refusal job removal from this PR. A job that fails for good on disk pressure now stays in the queue as a failed job, as recoverable evidence. That resolves F12. What changed
Nothing else changed: the deferral with backoff, the free-space numbers, the plan-issue update only when linked and non-terminal, and the One thing worth knowing: the daemon and plan-route producers set Verification
I didn't run the full test suite. There's no visual change, so I made no preview. Review digestRisk-tiered paths
Diff size: 6 files changed, +81/−187 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
I've removed the post-refusal job removal from this PR. A job that fails for good on disk pressure now stays in the queue as a failed job, as recoverable evidence. That resolves F12. **What changed** - **Removal gone:** I deleted `packages/core/src/queue/removeOwnFailedJob.ts`, which held `isRemovedOnFail` and the "remove only the failed delivery" cleanup. `settleIssueDiskPressureFailure` in `taskQueue.ts` now only reports the refusal, and its doc comment says the failed job is kept. - **Tests:** I dropped the two removal tests (the replacement-during-report race and the cleanup-ownership test) and the hooks only they used. The tests that waited for the job to disappear now check that it stays `failed`. - **Final refusal comment** (`issueDiskPressureRefusal.ts`): it no longer says relabeling retries the issue. It now says: > **Relabeling will not retry this issue until the stale job `issue-…` is cleared** (or until #3873 lands). It then gives the commands an operator runs to clear the job, and says to relabel (or retry from the plan) after that: ``` redis-cli ZREM bull:<queue>:failed <jobId> redis-cli DEL bull:<queue>:<jobId> bull:<queue>:<jobId>:logs ``` The queue name is `github-issue-processor` unless `GITHUB_ISSUE_QUEUE_NAME` is set. If a job has no ID, the comment still says relabeling won't retry, names the queue and its failed set, and promises no automatic retry. I wrote #3873 as `#3873` so the link works when the comment is posted on other repos. - **Docs:** I rewrote the paragraph in `docs/docs/operations/maintenance.md` that described the removal and the automatic re-pickup by a later poll. It now explains that the job is kept, why a relabel doesn't run, and the commands to clear it. Nothing else changed: the deferral with backoff, the free-space numbers, the plan-issue update only when linked and non-terminal, and the `implement_plan` logging plus 409. One thing worth knowing: the daemon and plan-route producers set `removeOnFail: true`, so for their jobs BullMQ deletes the failed job anyway and a relabel works without clearing anything. The comment still gives the warning unconditionally, as you asked, and the commands do nothing harmful if the job is already gone. **Verification** - Core typecheck and lint on the changed source files are clean. The test files are outside core's eslint config, so they weren't linted. - I ran five disk-pressure and submission-intake suites against a locally built Redis 7.2.5, with real-Redis tests required; all 31 tests pass. - The integration test now proves the comment's own instructions work: while the failed job is kept, a relabel under the same ID doesn't run. The test pulls the `redis-cli` lines out of the generated comment and runs them, after which the job is gone and the next relabel runs. I didn't run the full test suite. There's no visual change, so I made no preview. PR: #3862 Comment by: @integry (ID: 7237586431) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds bounded disk-pressure deferral, terminal refusal reporting, and diagnostic logging for internal MCP failures. It needs a localized correction before merge: the recovery comments assume failed jobs are retained, although both supplied production producers explicitly remove them. ✅ Preserved retry budget — Disk-pressure waits delay the existing job without consuming attempts; the added Redis integration tests cover this behavior. ✅ Actionable MCP refusal — Active epic executions now produce an explicit 409, with tests checking transaction rollback and unchanged dispatch state. ✅ Useful diagnostics — Admission measurements survive error-message serialization and appear in refusal reports. This is a static review; no commands or tests were run. The original issue specification is truncated, limiting verification of its full acceptance criteria. Current checks show no failures and four pending checks. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F13: 🔴 Make recovery instructions reflect actual retention
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe implementation has substantial targeted coverage and improves diagnostics, but its recovery instructions contradict production retention settings and can damage a replacement job. Correct that path before merging; current validation remains pending. 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 38941d2
Summary of ChangesI fixed F13: the refusal comment's retry instructions now match whether the failed job was actually kept. The comment no longer gives the unconditional What changed
Tests
Verification
There's no visual change, so I made no preview. Review digestRisk-tiered paths
Diff size: 5 files changed, +184/−42 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed F13: the refusal comment's retry instructions now match whether the failed job was actually kept. The comment no longer gives the unconditional `ZREM`/`DEL` commands that could delete a replacement job using the same ID. **What changed** - **Retention check** (`taskQueue.ts`, new `failedJobRetention`): after the final disk-pressure failure, the worker checks what happened to the job and passes the result to the report: - **removed:** `removeOnFail: true` (the daemon poll and `enqueueIssueImplementationJob`), or the ID now belongs to a different job, told apart by its creation `timestamp`. - **retained:** this same job is in the failed set. - **unknown:** the check couldn't be done. - **Comment text** (`issueDiskPressureRefusal.ts`): - **removed:** an ordinary retry: "The refused job was removed from the worker's queue. To retry once space has been freed…, remove the `AI` label and add it again". No stale-job warning and no Redis commands. - **retained:** the "Relabeling will not retry … until the stale job is cleared" warning, followed by one guarded `redis-cli EVAL` command (built by the new `clearFailedJobCommand`). It removes the job and its logs only if the job is still in the failed set and its stored `timestamp` matches this job. Otherwise it prints `0` and changes nothing. - **unknown:** "If relabeling does not start a new run, the refused job is still kept…", followed by the same guarded command. - If the job has no ID or no timestamp, the comment gives no command and tells the operator to check the job before removing it. - **Docs** (`docs/docs/operations/maintenance.md`): the paragraph now says which producers remove jobs on failure and which keep them, and describes the guarded command in place of the old `ZREM`/`DEL` pair. **Tests** - **Integration** (`issueDiskPressureQueue.test.ts`, real Redis), new test with the producers' own `removeOnFail: true`: - the worker's report records `removed`, the job is gone, and the comment has no Redis commands. - a relabel then enqueues a replacement under the same ID. - a guarded command built for the removed job returns `0`, and the replacement keeps its hash and stays queued. - **Integration, retained test:** the report records `retained`. A command built for a different job under the same ID changes nothing. The command taken from the comment clears the job, and the next relabel runs. - **Unit** (`issueDiskPressureRefusal.test.ts`): covers the wording for all three cases, the case without a timestamp, and that the old unconditional `ZREM`/`DEL` lines are never produced. - **Shell check:** I pasted the exact command into a shell against the real `redis-cli`. It printed `0` and kept the job when the timestamp differed, and when the job wasn't in the failed set. On the matching job it printed `2` and left Redis empty. **Verification** - Core typecheck and lint on the two changed source files are clean. - Against a locally built Redis 7.2.5, with real-Redis tests required: - `issueDiskPressureQueue`: 5/5, run three times. - `issueDiskPressureRefusal`: 14/14. - `issueDiskPressureDeferral`: 8/8. - `taskSubmissionIntakeQueue`: 3/3. - `worktreeDiskPressureDetails`: 4/4. - `taskSubmissionIntake.test.ts` passes all 12 tests, but the process never exits and the command times out. It does the same with the HEAD versions of the changed files, so the hang isn't from this change. - I didn't run the full suite. There's no visual change, so I made no preview. PR: #3862 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds bounded disk-pressure deferral, terminal refusal reporting, and useful MCP failure diagnostics. It needs a localized correctness fix before merge: refusal reporting can block a replacement run’s epic queue after its ownership check becomes stale. ✅ Bounded deferral — The same BullMQ job is delayed without consuming attempts, with an unrecoverable failure when the configured wait expires. ✅ Actionable diagnostics — Refusal measurements survive serialization, and internal MCP failures are logged before mutation handling converts them into receipts. ✅ Retention-aware recovery — Retry instructions distinguish removed and retained jobs; the supplied Redis cleanup command checks the failed instance’s timestamp. This review is a static trace of the supplied code; no commands were run. The original issue specification is explicitly truncated, limiting requirement verification. Current checks show no failures, with two checks pending; the historical shard failure is not a current blocker. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F14: 🔴 Fence queue blocking against task takeover
SuggestionsThese are optional follow-ups and are not sent to S7: 🟢 Exercise recovery of the delayed jobThe Redis integration tests establish deferral and terminal failure, but do not directly demonstrate the same deferred job resuming successfully when space becomes available. An optional test that lifts the reserve, promotes that delayed job, and verifies processor entry and removal of wait fields would strengthen coverage of the main recovery path. ScoreThe implementation has substantial focused coverage and useful operational diagnostics, but the ownership gap in refusal settlement needs correction. Current checks have no reported failures, though two remain pending. 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 7de25cd
Summary of ChangesI fixed F14: a refusal can no longer block the queue item of a replacement run that takes over the plan issue while the refusal is being reported. The fix (
Supporting change ( Regression tests (
Verification:
Review digestRisk-tiered paths
Diff size: 3 files changed, +73/−17 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed F14: a refusal can no longer block the queue item of a replacement run that takes over the plan issue while the refusal is being reported.
**The fix** (`packages/core/src/services/issueDiskPressureRefusal.ts`, `releasePlanIssue`):
- The first ownership check (status, newest row, task linked by correlation ID) still runs before anything is written.
- The writes now happen in one database transaction. That transaction first reads the plan issue row again and goes on only if its status and `task_id` are unchanged since the first read.
- Inside that same transaction it blocks the queue item as `dispatch_failed`, renews its dispatch timestamp, and, if the issue is `processing`, moves it back to `pending` using the existing guarded update.
- If ownership changed, it writes neither the block nor the status change. The re-read throws an internal "taken over" error, which rolls back the transaction. The guarded status update throws the same error if it changes zero rows, so the queue block is undone along with it.
- In that case the outcome is `{ planIssueReleased: false, queueBlocked: false }`, and the issue still gets its comment. Follow-on notifications run only after the commit.
- The database is SQLite, whose transactions are serializable, so a takeover lands either before the re-read or after the commit. The case where the takeover comes after the commit is the existing "ownership changed after the refusal" case, so I didn't add any further locking.
**Supporting change** (`packages/core/src/config/planIssueStatusJournal.ts`): `updatePlanIssuesWithStatusJournal` now takes an optional `{ database }` (defaulting to `db`), so the status update and its journal entry run inside the caller's transaction. Existing callers are unaffected. This also matters because the SQLite pool has a single connection: calling the global `db` from inside the transaction would deadlock.
**Regression tests** (`packages/core/test/issueDiskPressureRefusal.test.ts`): two new cases, one for a `processing` plan issue and one for a `pending` one. Each installs a replacement task (`task-replacement` with a different correlation ID) after the refusal's first read and before any write. They check that:
- the plan issue stays `processing` and owned by the replacement.
- the queue item has no blocker and its dispatch timestamp is unchanged.
- no blocked events were recorded.
- the comment is still posted.
**Verification:**
- Against the old `issueDiskPressureRefusal.ts`, both new tests fail; with the fix, all 16 tests in the file pass.
- 31 related suites (21 in core, 4 at the repo root) passed with no failures (5 core tests were skipped).
- `tsc --noEmit` for core passed and eslint reported nothing on the changed source files.
`markEpicQueueIssueDispatchRefused` has no other callers, so the same defect doesn't occur anywhere else in the PR. I found nothing else worth reporting. The change isn't visible in any UI, so I made no previews.
PR: #3862
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationMerge-ready within the visible scope, conditional on the pending validation check completing successfully. The PR adds bounded disk-pressure deferral, terminal refusal reporting, and diagnostic logging for internal MCP failures. ✅ Preserved retry budget — Disk-pressure deferrals delay the same job without consuming attempts; exhausted waits produce an unrecoverable failure. ✅ Protected plan updates — Refusal reporting checks task ownership and rechecks status/task identity inside a transaction before changing plan state. ✅ Useful regression coverage — Added tests cover retention, terminal intake reconciliation, takeover protection, and explicit MCP conflict responses. This was a static review; no commands were run. The original issue specification is explicitly truncated, so requirements absent from the supplied text could not be assessed. Current checks report no failures, with one pending. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S8: 🟢 Test recovery after space returnsThe real-Redis tests in ScoreThe visible changes address both dispatch problems with substantial regression coverage and no verified merge blocker. Final readiness remains conditional on the pending check. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI Implementation Summary
Closes #3860
Branch:
3860/claude-opus-5-5-issue-jobs-refused-for-di-20261127-2208-xrsCommits: ✅ Changes committed (474884e)
AI Processing Completed
Execution Details:
Summary:
I've fixed both bugs from issue #3860. All the targeted suites pass, including the BullMQ ones against a real Redis 7.2.5. Typecheck and lint are clean for core and the API, except for one existing lint warning in
AntigravityAgent.ts, which I didn't touch. I didn't run the full test suite.1. Issue jobs refused for disk pressure
Retry with backoff. In core's
createWorker, an issue job that admission refuses withWorktreeDiskPressureErroris now delayed on the same job instead of failing (packages/core/src/queue/issueDiskPressureDeferral.ts). It waits 2, 5, 10 and then every 20 minutes, and these waits don't use up its 3 attempts. Each wait is logged as "Issue job refused for disk pressure: waiting for free disk space". The total wait is capped by a new setting,WORKTREE_DISK_PRESSURE_MAX_WAIT_MS(default 1 hour). When it runs out, the job fails for good with no further retries, and the error message still identifies disk pressure. The admission check itself is unchanged.Reporting the final refusal (
packages/core/src/services/issueDiskPressureRefusal.ts):processingwith no task goes back topending. If it is part of a running epic execution, it shows as blocked (dispatch_failed) with the disk-pressure reason, soget_planand the Studio show why it stopped.No silent dedupe. Both enqueue paths (core issue detection and the API's
enqueueIssueImplementationJob) now check for an existing job with the same ID first. A failed or completed one is removed and replaced. A live one (for example, a job waiting for disk space) keeps the request, and that is logged rather than silently dropped.2.
implement_planwith a running epic queueimplement_planwhile the plan's epic execution is still running now gets a 409EPIC_EXECUTION_ACTIVEerror ("This plan's epic execution is still running issues #…; retry when it finishes."). It is refused before anything is claimed, labelled or dispatched. Before, the queue creation threw a plain error, which came back asOUTCOME_UNKNOWN/500. I chose to refuse rather than append to the running queue, since its order and dependency edges are fixed when it starts.OUTCOME_UNKNOWNcaused by one) is now logged as "MCP tool failed internally", with the tool, operation ID, repository, message and stack (packages/api/mcp/internalFailureLog.ts).Behaviour to be aware of
WORKTREE_DISK_PRESSURE_MAX_WAIT_MS=0, which keeps the old behaviour of failing within seconds.Tests
issueDiskPressureDeferral.test.ts(schedule, deferral, final failure),issueDiskPressureQueue.test.ts(real BullMQ: a refused job is delayed rather than failed; an exhausted wait fails on that refusal; re-enqueuing after a retained failed job runs it),issueDiskPressureRefusal.test.ts(comment, plan issue state, no immediate re-dispatch), andmcpInternalFailureLog.test.ts.mcpEpicDispatch.test.ts: the 409 refusal in sequential and graph modes, and acceptance once the queue has finished.addbeing swallowed by the retained failed job. Removing the re-dispatch guard makes the refusal test fail.test/planIssueImplementationTrigger.test.tslists core's exports by hand in its mock, so I added the new enqueue helper to it.I updated the docs to match: the maintenance and configuration-reference pages, the API reference,
docs/mcp.mdand.env.example. There are no visual previews, since nothing user-facing changed on screen.Review digest
Risk-tiered paths
.env.example(+2/−0)packages/api/mcp/internalFailureLog.ts(added, +23/−0)packages/api/mcp/toolExecution.ts(+7/−1)packages/api/mcp/tools.ts(+16/−0)packages/api/routes/planIssueHelpers.ts(+5/−3)packages/core/src/daemon/issueDetection.ts(+11/−4)packages/core/src/index.ts(+7/−0)packages/core/src/queue/issueDiskPressureDeferral.ts(added, +157/−0)packages/core/src/queue/issueJobEnqueue.ts(added, +51/−0)packages/core/src/queue/taskQueue.ts(+27/−4)packages/core/src/services/issueDiskPressureRefusal.ts(added, +105/−0)packages/core/src/services/taskPlanning/epicQueueBlockedHead.ts(+27/−1)docs/docs/operations/api-reference.md(+1/−1)docs/docs/operations/configuration-reference.md(+1/−0)docs/docs/operations/maintenance.md(+1/−1)docs/mcp.md(+7/−0)packages/api/test/mcpEpicDispatch.test.ts(+33/−0)packages/api/test/mcpInternalFailureLog.test.ts(added, +96/−0)packages/core/test/issueDiskPressureDeferral.test.ts(added, +122/−0)packages/core/test/issueDiskPressureQueue.test.ts(added, +163/−0)packages/core/test/issueDiskPressureRefusal.test.ts(added, +117/−0)packages/core/test/taskSubmissionIntakeQueue.test.ts(+2/−0)test/planIssueImplementationTrigger.test.ts(+4/−0)Diff size: 23 files changed, +985/−15 lines
View task for the run's logs and conversation.
This PR was created automatically by ProPR after processing issue #3860.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!