Repository navigation
[3472 by Claude Opus 5.5] Give the epic execution queue per-issue state instead of a single cursor - #3507
Conversation
…sequential and parallel epics behave as before. All 259 tests in the affected suites pass: the five core epic-queue suites plus my new one, `autoMergeGate`, `mcpEpicDispatch`, `mcpIntegration`, and ten root suites. Core, API, root and UI all typecheck, and lint passes on the changed source files. Storage - New table: a migration adds `epic_execution_queue_issues`, keyed by execution id and issue number. Each row stores its position, state, its own dispatch claim time, and for blocked issues a reason kind plus the readable text. Timestamps are epoch milliseconds. - States: pending, dispatched, done, blocked, skipped. The reason kinds are the seven cases from the issue: closed without merge, missing from plan, dispatch failure, agent blocker, awaiting human merge, label handoff wait, setup not ready. - Migrating existing queues: issues before the cursor become done. The head keeps its claim and its reason, with the kind worked out from the old text patterns. Later issues are pending. Children of an active parallel queue become dispatched, and the one named in a blocker message is marked blocked. Completed queues become all done. Running the migration twice adds nothing, and rolling it back puts the cursor, claim and reason back. - Old columns: `cursor`, `head_started_at` and `blocked_reason` stay on the queue table but are no longer read. `blocked_reason` now only holds the note for a queue cancelled before it ever started. Code - New module `epicQueueState.ts`: loads a queue with its per-issue rows, derives the old fields (`issues`, `cursor`, `head`, `headStartedAt`, `blockedReason`), and holds the guarded writers. - Guarded writes: every block, unblock, done, claim or completion only changes a row if the issue is still in the expected state and its execution is still the plan's active one. Dispatch claims compare on that issue's own claim time, so two processes can't dispatch the same issue twice. - Per-issue lookups: the queue logic, blocked head, human merge, label handoff, the API route (`appendToActiveQueue` now calls a new core `appendEpicQueueIssues`), MCP `implement_plan` (now reads a `queue.unstarted` flag instead of comparing the string), and the two `src/jobs` files all use the per-issue state instead of `issues[cursor]`. The `src/jobs` files read `queue.items` directly, because the root tests mock `@propr/core` with a fixed export list. - Responses: `summarizeEpicQueue`, and through it MCP and the REST queue endpoint, keeps all its old fields and adds `issueStates` (issue, state, reason kind, reason). The UI type `PlanExecutionQueue` has the new field as optional. Tests - Existing suites: only fixtures changed. They apply the new migration, mocked queues now carry `items`, and a few exact-match summary assertions now include `issueStates`. - New `epicQueueIssueStates.test.ts`: - Migration of an active sequential queue, an active parallel queue and a completed queue. - How each old reason text maps to a kind. - A restart mid-execution: the 15-minute retry still applies and an agent-blocked head is still held. - Two concurrent advances, two concurrent claim retries, and append protection. - Negative check: with the done-state guard and the claim guard both removed, the two concurrency tests fail. Small behaviour differences you may want to review 1. Marking setup complete now clears only the setup reason. Before, it cleared any reason, including an agent blocker recorded during setup. 2. A parallel execution's `blockedReason` is now the most recently blocked child that is still blocked. Before, clearing one child looked up the others' latest runs in task history to decide which blocker to show. The tests show the same values. 3. For a parallel execution, the first issue's PR used to be logged with the auto-merge opportunity "epic queue advance". Parallel executions now have no head, so it's logged as an initial PR. Only that label changes, not whether auto-merge is armed. There are no previews, because nothing visible in the UI changed.
|
/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 introduces persisted per-issue state and centralizes queue transitions, but needs localized corrections before merge, particularly around migration compatibility. ✅ Guarded dispatch claims — Dispatch compares the issue’s persisted claim timestamp and rechecks execution ownership, pause state, and pending status. ✅ Recoverable completion — A sequential execution interrupted after settling its last issue can complete during recovery. ✅ Targeted concurrency coverage — New tests exercise competing advances and expired-claim retries. This review is based on static analysis; no commands were run. The supplied current checks show 11 passed, five pending, and no failures. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Preserve all legacy parallel blockers
F2: 🔴 Retain support for requeueing settled issues
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe guarded state transitions and focused tests are useful, but migration can lose blocker information or reject previously valid queues, and requeueing settled issues now fails. These compatibility defects require correction 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 827b4d5
Summary of ChangesThat notification is from the earlier 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…` run. Its `mcpEpicDispatch` failures came from that environment (GitHub auth) and don't affect the result. The rerun with `NODE_ENV=test` passed both API suites, 75 tests with no failures, so the summary above still stands. That notification is from the earlier `PROPR_DEMO_MODE=true` run. Its `mcpEpicDispatch` failures came from that environment (GitHub auth) and don't affect the result. The rerun with `NODE_ENV=test` passed both API suites, 75 tests with no failures, so the summary above still stands. PR: #3507 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds persisted per-issue queue state, structured blocker reasons, and compatible response fields. It needs changes before merge because reusing settled rows allows stale observers to settle newly requeued work. ✅ Migration coverage — The migration preserves sequential dispatch claims and reconstructs parallel agent blockers from task history, with targeted tests. ✅ Ordinary concurrency protection — Per-issue claim comparisons and settled-state guards address concurrent retries and advances, with tests exercising both. The supplied current-head checks report 17 passed, no failures, and no pending checks. 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. F3: 🔴 Fence writes across issue requeues
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe migration and tests provide a solid foundation, and current checks pass. The demonstrated requeue race can silently skip requested work and requires correction 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 7dd33ca
Summary of ChangesI fixed F3. A delayed observer of an earlier queue occurrence can no longer settle, block, unblock or dispatch the requeued occurrence of that issue. The fence. Requeuing (
Every caller passes the occurrence it read. Regressions (in
With the position condition removed, all three fail; with it in place, they pass. In this suite the label-handoff module is mocked, so I covered blocker writes with test 2 rather than a failing-handoff variant, which would have passed whether or not the fix was in place. Verification: all six epic-queue suites pass (76 tests), as do both Not changed, and not affected by this defect:
🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ce can no longer settle, block, unblock or dispatch the requeued occurrence of that issue.
I fixed F3. A delayed observer of an earlier queue occurrence can no longer settle, block, unblock or dispatch the requeued occurrence of that issue.
**The fence.** Requeuing (`appendEpicQueueIssues`) always moves the issue's row to a new tail position, above every existing one. So the position an observer read identifies which occurrence it saw, and no new generation column is needed. `ownedIssue` now takes `{ issueNumber, position }` and matches on both, so every guarded writer built on it carries the fence:
- **Settlement:** `markQueueIssueDone` in `advanceEpicQueue` and the parallel completion path.
- **Blocker writes:** `blockQueueIssue` and `unblockQueueIssue` for closed-unmerged, missing-from-plan, dispatch-failed, label-handoff, setup-not-ready, awaiting-human-merge and agent-blocked.
- **Reopened-head clearing** in `startEpicQueueHead`: it was a raw update and now goes through `ownedIssue`.
- **Dispatch claim** in `dispatchPendingQueueHead`: it still compares on the issue's own claim time, and now on position as well.
Every caller passes the occurrence it read. `releaseEpicIssueLabels`, `markEpicQueueAwaitingHumanMerge` and the blocked-head helpers now carry the queue item instead of a bare issue number. The exported functions the API and root code call keep their signatures.
**Regressions** (in `packages/core/test/epicQueueIssueStates.test.ts`):
1. **The F3 sequence:** observer A is held in the label handoff while B advances #10 and starts #20, then #10 is requeued and A is released. #10 stays pending at the tail, and it runs again after #20 merges.
2. **A stale blocker:** an observer held before its plan-issue read sees the requeued #10 closed. The requeued row is not blocked.
3. **A stale dispatch:** an observer that read #10 as an unclaimed head is held before its claim, then #10 merges and is requeued. Nothing is dispatched while #20 runs.
With the position condition removed, all three fail; with it in place, they pass. In this suite the label-handoff module is mocked, so I covered blocker writes with test 2 rather than a failing-handoff variant, which would have passed whether or not the fix was in place.
**Verification:** all six epic-queue suites pass (76 tests), as do both `autoMergeGate` suites and the root `issueJobBlocked` suite. Core typechecks and lint passes on the changed source files. The ESLint config ignores the test file.
**Not changed, and not affected by this defect:**
- `readyEpicExecutionQueue` clears setup blocks by kind, not from a queue it read earlier.
- Execution creation replaces rows wholesale.
- One race can't be closed in the database: if a stale observer is held inside GitHub's label-removal call long enough for the requeued issue to be dispatched again, its removal could still hit the new run's labels on GitHub. The database fence stops that observer's writes but can't make the external call atomic with them.
PR: #3507
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR introduces persisted per-issue state with centralized transition guards and backward-compatible queue summaries. It needs a localized correction before merge: parallel children that restart after settling are no longer tracked correctly. ✅ Occurrence guards — Writes check execution identity and issue position, preventing delayed observers from modifying a requeued occurrence. ✅ Migration coverage — The added tests cover legacy claims, blocker classification, duplicate issue normalization, and parallel sibling blockers. The supplied checks report 16 passed, none failed, and one pending. 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. F4: 🔴 Keep restarted parallel children tracked
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe migration and concurrency guards are well developed, but the parallel restart regression leaves persisted state and blocker reporting incorrect. The passing checks provide useful coverage; the remaining validation check is 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 a7864d0
Summary of ChangesI fixed F4: a parallel child that was closed and then runs again while its sibling is still running is tracked again. When its new run stops on a blocker, the execution now shows it as What changed
The terminal statuses ( New tests in
Against the unfixed code, the first three fail. The fourth passes either way, because it checks that a late report changes nothing. Verification
I found nothing outside F4 that needed reporting. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…again while its sibling is still running is tracked again. When its new run stops on a blocker, the execution now shows it as `blocked` with the agent-blocker reason instead of `done`.
I fixed F4: a parallel child that was closed and then runs again while its sibling is still running is tracked again. When its new run stops on a blocker, the execution now shows it as `blocked` with the agent-blocker reason instead of `done`.
**What changed**
- **New writer `reopenParallelQueueIssue`** (`epicQueueState.ts`): moves a `done` parallel child back to `dispatched`. It only writes if the execution is still active and the child's issue is open again, and that issue check runs in the same statement as the write. A late event from the child's earlier closed or merged state can't reopen it.
- **Blocker handling** (`epicQueueBlockedHead.ts`): `activeQueueFor` reopens a `done` parallel child before it marks or clears the blocker. This still works when the status update for the reopen was lost.
- **Status changes** (`completeParallelEpicQueue`): a `done` child whose issue is open again is reopened. On the same path, marking a child `done` now requires its issue to still be merged or closed at write time. Completing the execution also requires that no child's issue is open. Without these checks, a status read just before a reopen could settle the reopened child, or complete the execution while it is running.
- **Recovery** (`reconcileQueueHead`): looks at every parallel child again, as it did before this PR. The stale-run cleanup only acts on in-progress issues, so a child that really is closed is left alone.
- **`markQueueIssueDone`**: takes `{ timestamp, guard }` instead of a bare timestamp, to stay within the lint parameter limit. The sequential call passes `{ timestamp }`, so its behaviour is unchanged.
The terminal statuses (`merged`, `closed`) are written as literals in `epicQueueState.ts`. Importing `PlanIssueStatus` there broke `autoMergeGate.test.ts`, which mocks `planIssueManager` without that export.
**New tests** in `epicQueueBlockedHead.test.ts`:
- A closed child is reopened and reports a blocker while its sibling runs. This is run twice: once with the status update and once without it. In both cases the child shows as blocked with its reason, recovery and the sibling's merge leave it blocked and the execution active, and a later normal run plus merge completes the execution.
- Recovery closes the stale run of a reopened child whose row is still `done`.
- A late blocker report for a child that is still merged doesn't reopen it.
Against the unfixed code, the first three fail. The fourth passes either way, because it checks that a late report changes nothing.
**Verification**
- All six core epic-queue suites plus `autoMergeGate`: 110 passed, 0 failed.
- After rebuilding core dist, `mcpEpicDispatch` and `mcpIntegration`: 75 passed. The seven root no-change and plan-issue suites: 64 passed.
- Core typecheck and lint on `taskPlanning/` with zero warnings are clean.
I found nothing outside F4 that needed reporting.
PR: #3507
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR replaces cursor-based progression with persisted per-issue state while retaining the existing queue response fields. It is ready to merge within the reviewed scope. ✅ Guarded progression — Issue writes check execution ownership and occurrence position; dispatch claims additionally compare the observed claim timestamp. ✅ Migration compatibility — The migration preserves sequential claims and blockers, recovers parallel blockers from task history, and restores legacy fields on rollback. ✅ Focused regression coverage — Added tests cover concurrent advancement, expired-claim retries, requeued occurrences, and reopened parallel children. This was a static review of the supplied diff and context; no commands or tests were run. The authoritative current-head checks report 17 passed and no failures or pending checks. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe implementation addresses the intended state migration with consistent ownership guards and targeted regression coverage. The supplied code reveals no verified merge blocker, and current-head checks are passing. Score: 9/10 🤖 Review Details
🤖 Review by ProPR |
AI Implementation Summary
Closes #3472
Branch:
3472/claude-opus-5-5-give-the-epic-execution-q-20261112-1932-t6nCommits: ✅ Changes committed (ab27450)
AI Processing Completed
Execution Details:
Summary:
Each issue in an epic execution now has its own persisted state, and sequential and parallel epics behave as before. All 259 tests in the affected suites pass: the five core epic-queue suites plus my new one,
autoMergeGate,mcpEpicDispatch,mcpIntegration, and ten root suites. Core, API, root and UI all typecheck, and lint passes on the changed source files.Storage
epic_execution_queue_issues, keyed by execution id and issue number. Each row stores its position, state, its own dispatch claim time, and for blocked issues a reason kind plus the readable text. Timestamps are epoch milliseconds.cursor,head_started_atandblocked_reasonstay on the queue table but are no longer read.blocked_reasonnow only holds the note for a queue cancelled before it ever started.Code
epicQueueState.ts: loads a queue with its per-issue rows, derives the old fields (issues,cursor,head,headStartedAt,blockedReason), and holds the guarded writers.appendToActiveQueuenow calls a new coreappendEpicQueueIssues), MCPimplement_plan(now reads aqueue.unstartedflag instead of comparing the string), and the twosrc/jobsfiles all use the per-issue state instead ofissues[cursor]. Thesrc/jobsfiles readqueue.itemsdirectly, because the root tests mock@propr/corewith a fixed export list.summarizeEpicQueue, and through it MCP and the REST queue endpoint, keeps all its old fields and addsissueStates(issue, state, reason kind, reason). The UI typePlanExecutionQueuehas the new field as optional.Tests
items, and a few exact-match summary assertions now includeissueStates.epicQueueIssueStates.test.ts:Small behaviour differences you may want to review
blockedReasonis now the most recently blocked child that is still blocked. Before, clearing one child looked up the others' latest runs in task history to decide which blocker to show. The tests show the same values.There are no previews, because nothing visible in the UI changed.
Detailed Logs:
eb7aa26d-f403-410d-a3ea-1a18009c6fa0Log files stored at:
/usr/src/app/logs/executions/issue-3472-2026-11-12T19-49-45-091Z-conversation.json/usr/src/app/logs/executions/issue-3472-2026-11-12T19-49-45-091Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3472.
💡 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!