Skip to content

[3473 by Claude Opus 5.5] Schedule epic issues by dependency graph with a max_parallel limit enforced in code - #3515

Merged
integry merged 5 commits into
3470-epic-scheduler-primitives-nrjfrom
3473/claude-opus-5-5-schedule-epic-issues-by-d-20261112-2304-xrj
Nov 13, 2026
Merged

integry merged 5 commits into
3470-epic-scheduler-primitives-nrjfrom
3473/claude-opus-5-5-schedule-epic-issues-by-d-20261112-2304-xrj

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #3473

Branch: 3473/claude-opus-5-5-schedule-epic-issues-by-d-20261112-2304-xrj
Commits: ✅ Changes committed (8af86a9)


AI Processing Completed

Execution Details:

Summary:
I've added a graph mode to epic executions: an issue starts once every prerequisite from the plan's dependsOn is merged into the epic branch, and at most maxParallel issues run at once. Tests pass: the core epic-queue suites (94 tests, two of them new), mcpEpicDispatch (76, including 4 new graph tests), mcpIntegration, autoMergeGate, four root suites, the docs suites and three UI suites. Core, API, root and UI typecheck, and lint passes on everything I changed.

How it works

  • One pure scheduler (epicQueueSchedule.ts). It takes the issues, their edges, their states, merged prerequisites from outside the execution, and the limit. It returns which issues to start now (in publication order), which are ready, which are in flight, and what each waiting issue still waits on. Sequential is modelled as a chain with a limit of 1, and parallel as a graph with no edges and no limit.
  • Storage: a new migration adds mode and max_parallel to the execution and depends_on to each issue row. The prerequisites are copied from plan_issues.depends_on_issues when the execution starts. Only graph executions write these columns, so existing executions read exactly as before.
  • Dispatch (epicQueueGraph.ts): each pass settles issues by their saved plan status. Merged becomes done; closed without merge becomes closed_unmerged, which holds only its dependents. It then retries lost dispatches with the same 15-minute claim retry as today. Finally it starts newly ready issues: it locks the execution row and claims each issue with a guarded write that rechecks pause and status. So concurrent advances, the reconcile sweep and restarts can't exceed the limit or start an issue twice.
  • Counting the limit: an issue keeps its slot from its claim until it merges, including while it's blocked. An issue someone started by hand also counts.
  • Prerequisites outside the execution count only once merged. Any status change in the plan triggers a pass, so merging one of them starts its dependents.
  • Branches: every issue, including downstream ones, starts on the epic branch, so it already contains its prerequisites' merged work. No stacked PRs.
  • Completion: the execution completes when every issue is done or skipped, and finalization runs once.

Entry points

  • MCP implement_plan accepts epicExecution: "graph" and maxParallel (1–20, unbounded if omitted). Only the first ready issue goes through the implement handler; it creates the epic branch. The queue starts every other issue, which moves the fan-out out of the tool loop.
  • REST implement route accepts the same two fields. The request must name the first ready pending issue.
  • Rejected combinations: graph without useEpic, graph with several models, graph with epicAdvanceOn: "terminal", maxParallel without graph mode, and a selection where no issue is ready. All are rejected before anything is claimed.
  • Defaults are unchanged: sequential stays the default, and sequential and parallel keep their old code paths and behaviour.

Status reporting: get_plan, get_operation and the REST execution-queue response now include executionMode and maxParallel. Each issue also gets schedule (waiting, ready, in_flight, done, skipped or blocked), dependsOn and waitingOn. These fields now appear for sequential and parallel executions too, so I updated the existing tests that compared the full summary.

Other changes

  • Planner Studio: while a graph or parallel execution is active, the "first unmerged issue" warning no longer appears, and the issues the queue still holds show as queued.
  • Auto-merge and human-merge waits now apply to every issue a graph execution has in flight, not only a sequential head.
  • Lint fixes: to stay under the 400-line limit I moved the epic-label recovery code into epicQueueLabelRecovery.ts and planEpicDispatch into mcp/epicDispatchPolicy.ts; toolsPlanning still re-exports it.
  • Docs updated: the epic execution section of docs/mcp.md, docs/docs/features/mcp.md and docs/docs/features/planning.md. They note that enforcing a goal's maxParallelTasks through this queue is a follow-up, and that limits.max_parallel_tasks stays a separate cap.

Testing notes

  • The core tests use in-memory SQLite, which runs one transaction at a time, so the concurrent-advance test can't exercise the Postgres row lock.
  • The API test files only pass when run from the repo root. From inside packages/api, @propr/core loads the built dist and the GitHub mocks don't apply.

I didn't create a visual preview: the UI change only removes a warning in graph executions and marks issues as queued.

Detailed Logs:

  • Conversation: 241 messages
  • Session: 6aa2946a-3a79-42a7-9b61-d6016fe9177f

Log files stored at:

  • conversation: /usr/src/app/logs/executions/issue-3473-2026-11-12T23-47-46-125Z-conversation.json
  • output: /usr/src/app/logs/executions/issue-3473-2026-11-12T23-47-46-125Z-output.txt
Latest Conversation Messages
ASSISTANT: [content unavailable]

ASSISTANT: I've added a graph mode to epic executions: an issue starts once every prerequisite from the plan's `dependsOn` is merged into the epic branch, and at most `maxParallel` issues run at once. Tests pass...


This PR was created automatically by ProPR after processing issue #3473.


💡 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!

…y prerequisite from the plan's `dependsOn` is merged into the epic branch, and at most `maxParallel` issues run at once. Tests pass: the core epic-queue suites (94 tests, two of them new), `mcpEpicDispatch` (76, including 4 new graph tests), `mcpIntegration`, `autoMergeGate`, four root suites, the docs suites and three UI suites. Core, API, root and UI typecheck, and lint passes on everything I changed.

How it works
- One pure scheduler (`epicQueueSchedule.ts`). It takes the issues, their edges, their states, merged prerequisites from outside the execution, and the limit. It returns which issues to start now (in publication order), which are ready, which are in flight, and what each waiting issue still waits on. Sequential is modelled as a chain with a limit of 1, and parallel as a graph with no edges and no limit.
- Storage: a new migration adds `mode` and `max_parallel` to the execution and `depends_on` to each issue row. The prerequisites are copied from `plan_issues.depends_on_issues` when the execution starts. Only graph executions write these columns, so existing executions read exactly as before.
- Dispatch (`epicQueueGraph.ts`): each pass settles issues by their saved plan status. Merged becomes done; closed without merge becomes `closed_unmerged`, which holds only its dependents. It then retries lost dispatches with the same 15-minute claim retry as today. Finally it starts newly ready issues: it locks the execution row and claims each issue with a guarded write that rechecks pause and status. So concurrent advances, the reconcile sweep and restarts can't exceed the limit or start an issue twice.
- Counting the limit: an issue keeps its slot from its claim until it merges, including while it's blocked. An issue someone started by hand also counts.
- Prerequisites outside the execution count only once merged. Any status change in the plan triggers a pass, so merging one of them starts its dependents.
- Branches: every issue, including downstream ones, starts on the epic branch, so it already contains its prerequisites' merged work. No stacked PRs.
- Completion: the execution completes when every issue is done or skipped, and finalization runs once.

Entry points
- MCP `implement_plan` accepts `epicExecution: "graph"` and `maxParallel` (1–20, unbounded if omitted). Only the first ready issue goes through the implement handler; it creates the epic branch. The queue starts every other issue, which moves the fan-out out of the tool loop.
- REST implement route accepts the same two fields. The request must name the first ready pending issue.
- Rejected combinations: graph without `useEpic`, graph with several models, graph with `epicAdvanceOn: "terminal"`, `maxParallel` without graph mode, and a selection where no issue is ready. All are rejected before anything is claimed.
- Defaults are unchanged: sequential stays the default, and sequential and parallel keep their old code paths and behaviour.

Status reporting: `get_plan`, `get_operation` and the REST execution-queue response now include `executionMode` and `maxParallel`. Each issue also gets `schedule` (waiting, ready, in_flight, done, skipped or blocked), `dependsOn` and `waitingOn`. These fields now appear for sequential and parallel executions too, so I updated the existing tests that compared the full summary.

Other changes
- Planner Studio: while a graph or parallel execution is active, the "first unmerged issue" warning no longer appears, and the issues the queue still holds show as queued.
- Auto-merge and human-merge waits now apply to every issue a graph execution has in flight, not only a sequential head.
- Lint fixes: to stay under the 400-line limit I moved the epic-label recovery code into `epicQueueLabelRecovery.ts` and `planEpicDispatch` into `mcp/epicDispatchPolicy.ts`; `toolsPlanning` still re-exports it.
- Docs updated: the epic execution section of `docs/mcp.md`, `docs/docs/features/mcp.md` and `docs/docs/features/planning.md`. They note that enforcing a goal's `maxParallelTasks` through this queue is a follow-up, and that `limits.max_parallel_tasks` stays a separate cap.

Testing notes
- The core tests use in-memory SQLite, which runs one transaction at a time, so the concurrent-advance test can't exercise the Postgres row lock.
- The API test files only pass when run from the repo root. From inside `packages/api`, `@propr/core` loads the built `dist` and the GitHub mocks don't apply.

I didn't create a visual preview: the UI change only removes a warning in graph executions and marks issues as queued.
@propr-dev

propr-dev Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

/ultrafix goal=8 max=10
Triggered automatically by the requested execution settings.

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

propr-dev Bot commented Nov 12, 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 12, 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 12, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR adds dependency-based epic scheduling with durable claims and concurrency limits. It needs changes before merge: unclaimed issues can become permanently blocked after reopening, and manually started issues are reported incorrectly.

✅ Deterministic scheduling — The pure scheduler handles dependency readiness, publication order, and available slots, with diamond and limit tests.

✅ Serialized queue claims — Graph dispatch locks the execution row and guards issue claims against pause, execution ownership, and persisted issue status.

This review used static analysis only; no commands were run. The supplied checks show no failures and five pending checks.

Merge blockers

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

F1: 🔴 Reopened unclaimed issues remain blocked

  • Required behavior: Graph execution must recover from closed issues and dispatch eligible pending work once its prerequisites are satisfied.

  • Evidence: packages/core/src/services/taskPlanning/epicQueueGraph.ts, settleGraphIssue, driveIssue, and claimReadyGraphIssues.

    1. An issue is waiting for a prerequisite and has never been claimed, so dispatchedAt is null.
    2. Someone closes it. The graph pass records state: 'blocked' with closed_unmerged, retaining the null dispatch timestamp.
    3. Someone reopens it to pending, and its prerequisites subsequently merge.
    4. Every subsequent graph pass returns from driveIssue at item.dispatchedAt === null, without clearing the closure block. The scheduler considers only pending queue rows, so this issue is never claimed.

    The execution remains active indefinitely unless someone implements the issue outside the queue. Reconciliation repeats the same early return; transactions and claim guards cannot restore eligibility. The reopening test covers an already dispatched issue, which bypasses this failure.

    static trace: followed closure, reopening, reconciliation, and scheduler eligibility through the supplied code.

  • Minimum fix: Clear recoverable closure blocks on unclaimed issues when their persisted status returns to pending, restoring the pending queue state before scheduling. Preserve unrelated blockers and recheck the persisted status when updating.

F2: 🔴 Manually running issues report as ready

  • Required behavior: Execution summaries must accurately distinguish ready, waiting, and in-flight issues, including issues started manually.

  • Evidence: packages/core/src/services/taskPlanning/epicQueueState.ts, epicScheduleIssues and summarizeEpicQueue; packages/core/src/services/taskPlanning/epicQueueGraph.ts, runningWithoutClaim.

    1. A selected graph issue remains unclaimed with queue state pending and a null dispatch timestamp.
    2. Someone starts it manually, changing its plan status to processing.
    3. claimReadyGraphIssues supplies runningWithoutClaim to the scheduler, correctly counting that issue against the limit.
    4. summarizeEpicQueue supplies no equivalent status information. The same issue consequently reports ready if its prerequisites are satisfied, or waiting otherwise, while it is actually running and consuming capacity.

    REST and MCP readers therefore receive an incorrect execution schedule. Reconciliation does not repair this discrepancy: driveIssue returns immediately for the unclaimed nonterminal issue without recording its running state. The existing manual-start test verifies capacity but never checks that issue’s reported schedule.

    static trace: compared the scheduling inputs used for guarded dispatch with those used for public summaries.

  • Minimum fix: Include persisted in-progress plan statuses in the graph summary’s scheduling inputs, or durably adopt manually running issues so dispatch and reporting share the same in-flight evidence.

Suggestions

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

S1: 🟢 Exercise PostgreSQL claim contention

Add a PostgreSQL integration test with competing graph advances at the concurrency limit. The SQLite test verifies outcomes under serialized transactions but cannot exercise the row-lock behavior on which concurrent claims rely. This is additional assurance, not a demonstrated locking defect.

Score

The implementation has useful separation and substantial coverage, but recovery and reporting defects remain in supported graph workflows. Current checks have no reported failures, with five still pending.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 21s
  • Tokens: 80,778 (79,065 in / 1,713 out)
  • Cost: $0.77

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 F2 S1

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit b18802f

Addressed 1 AI review comment (IDs: 6839451788)

Addressed findings F1, F2

Summary of Changes

I fixed both findings in core. The new tests pass, and both of them failed against the old code.

F1: a reopened issue the queue never claimed stayed blocked. On each pass, an unclaimed issue that isn't terminal now goes through a new reopenUnclaimedIssue step in epicQueueGraph.ts. Before, driveIssue just returned for these issues.

  • It removes the block only when the reason is closed_unmerged. Any other blocker, such as missing_from_plan, stays.
  • The update rechecks in the same statement that the issue is still not claimed, still blocked for that reason, and that its saved plan status is still not merged or closed. A pass that read stale data can't unblock an issue that was closed again.
  • The issue goes back to pending, so it starts once its prerequisites merge.

F2: an issue started by hand was reported as ready or waiting. The scheduler and the summary now use the same evidence.

  • getEpicExecutionQueue loads a new runningWithoutClaim list for graph executions. It holds the unclaimed issues whose plan status is in progress (not pending, merged or closed).
  • The scheduling helpers (epicScheduleIssues / epicQueueSchedule) read that list. That covers both the claim step and summarizeEpicQueue, which the REST and MCP readers use.
  • I removed the separate runningWithoutClaim helper from epicQueueGraph.ts. The claim step reads the queue after taking its lock, so it sees the list as of that moment.

Tests (packages/core/test/epicQueueGraph.test.ts):

  • New: an issue is closed while waiting and never claimed, then reopened. It goes back to pending/waiting and starts after its prerequisite merges.
  • New: an unrelated missing_from_plan block is kept, and an issue that stays closed stays blocked across passes.
  • Extended: the existing manual-start test now also checks that the issue started by hand reports in_flight.

Verification:

  • The core epic-queue, epic-execution-queue and autoMergeGate suites pass (126 tests), as do mcpEpicDispatch and mcpIntegration (79 tests).
  • The core typecheck passes.
  • ESLint passes on the two changed source files. The test file isn't covered by the ESLint config, so it wasn't linted.

There are no visible UI changes, so I didn't make a preview.

Separate observation, not changed: notifyEpicQueue in planIssueManager.ts only starts a queue pass when an issue becomes merged or closed. So clearing the block after a reopen happens on the next merge or the next reconcile sweep, not at the moment of the reopen. That still starts the issue as required, because its prerequisites merging is itself a terminal change that triggers a pass.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 5m 5s
  • Tokens: 1,259,886 (1,250,394 in / 9,492 out)
  • Cost: $0.76

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

… of them failed against the old code.

I fixed both findings in core. The new tests pass, and both of them failed against the old code.

**F1: a reopened issue the queue never claimed stayed blocked.** On each pass, an unclaimed issue that isn't terminal now goes through a new `reopenUnclaimedIssue` step in `epicQueueGraph.ts`. Before, `driveIssue` just returned for these issues.
- It removes the block only when the reason is `closed_unmerged`. Any other blocker, such as `missing_from_plan`, stays.
- The update rechecks in the same statement that the issue is still not claimed, still blocked for that reason, and that its saved plan status is still not merged or closed. A pass that read stale data can't unblock an issue that was closed again.
- The issue goes back to `pending`, so it starts once its prerequisites merge.

**F2: an issue started by hand was reported as `ready` or `waiting`.** The scheduler and the summary now use the same evidence.
- `getEpicExecutionQueue` loads a new `runningWithoutClaim` list for graph executions. It holds the unclaimed issues whose plan status is in progress (not pending, merged or closed).
- The scheduling helpers (`epicScheduleIssues` / `epicQueueSchedule`) read that list. That covers both the claim step and `summarizeEpicQueue`, which the REST and MCP readers use.
- I removed the separate `runningWithoutClaim` helper from `epicQueueGraph.ts`. The claim step reads the queue after taking its lock, so it sees the list as of that moment.

**Tests** (`packages/core/test/epicQueueGraph.test.ts`):
- New: an issue is closed while waiting and never claimed, then reopened. It goes back to `pending`/`waiting` and starts after its prerequisite merges.
- New: an unrelated `missing_from_plan` block is kept, and an issue that stays closed stays blocked across passes.
- Extended: the existing manual-start test now also checks that the issue started by hand reports `in_flight`.

**Verification:**
- The core epic-queue, epic-execution-queue and `autoMergeGate` suites pass (126 tests), as do `mcpEpicDispatch` and `mcpIntegration` (79 tests).
- The core typecheck passes.
- ESLint passes on the two changed source files. The test file isn't covered by the ESLint config, so it wasn't linted.

There are no visible UI changes, so I didn't make a preview.

**Separate observation, not changed:** `notifyEpicQueue` in `planIssueManager.ts` only starts a queue pass when an issue becomes merged or closed. So clearing the block after a reopen happens on the next merge or the next reconcile sweep, not at the moment of the reopen. That still starts the issue as required, because its prerequisites merging is itself a terminal change that triggers a pass.

PR: #3515
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 13, 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 13, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Full Test Suite Shard 2/4

Please investigate and fix this CI failure.

  • Check: Full Test Suite Shard 2/4
  • Result: failure
  • Commit: b18802f8c5eb (b18802f8c5eb5daf76558a40edff78d0569fb039)
  • Details: View CI failure

Failure evidence

.github:11
Process completed with exit code 1.

.github:35407
Process completed with exit code 1.

.github:2
Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@11d5960. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/

@propr-dev

propr-dev Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit fa173ea

Summary of Changes

I fixed the Shard 2/4 failure. Only one test failed in the shard: packages/api/test/mcpObservableSurface.test.ts, which checks that every backticked lowercase word in docs/mcp.md is either an MCP tool name or listed as a known non-tool word. This branch's new epic-queue docs added nine words that weren't listed: the execution modes (sequential, parallel, graph), schedule, and the schedule states (waiting, ready, in_flight, done, blocked). CI stopped at the first one, sequential.

I added those nine words, with a comment, to the non-tool list in packages/api/test/mcpObservableSurface.test.ts. The docs are unchanged.

The test now passes locally and lint passes on the file. I didn't rerun the rest of the shard, since no other test in it failed.

No visual preview, because this is a test-only change.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot]
  • Time: 4m 21s
  • Tokens: 783,316 (780,498 in / 2,818 out)
  • Cost: $0.42

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: 6839794525✓

…shard: `packages/api/test/mcpObservableSurface.test.ts`, which checks that every backticked lowercase word in `docs/mcp.md` is either an MCP tool name or listed as a known non-tool word. This branch's new epic-queue docs added nine words that weren't listed: the execution modes (`sequential`, `parallel`, `graph`), `schedule`, and the schedule states (`waiting`, `ready`, `in_flight`, `done`, `blocked`). CI stopped at the first one, `sequential`.

I fixed the Shard 2/4 failure. Only one test failed in the shard: `packages/api/test/mcpObservableSurface.test.ts`, which checks that every backticked lowercase word in `docs/mcp.md` is either an MCP tool name or listed as a known non-tool word. This branch's new epic-queue docs added nine words that weren't listed: the execution modes (`sequential`, `parallel`, `graph`), `schedule`, and the schedule states (`waiting`, `ready`, `in_flight`, `done`, `blocked`). CI stopped at the first one, `sequential`.

I added those nine words, with a comment, to the non-tool list in `packages/api/test/mcpObservableSurface.test.ts`. The docs are unchanged.

The test now passes locally and lint passes on the file. I didn't rerun the rest of the shard, since no other test in it failed.

No visual preview, because this is a test-only change.

PR: #3515
Comment by: @propr-dev[bot] (ID: 6839794525)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR adds dependency-aware epic execution through a pure scheduler, durable queue state, and MCP/REST entry points. It needs a localized correction before merge: issues started manually lose their reserved capacity when closed without merging.

✅ Clear scheduling logic — The pure scheduler handles dependency readiness, publication ordering, and capacity limits, with diamond-graph and boundary tests.

✅ Serialized queue claims — Graph dispatch locks the execution row and guards individual claims against duplicate dispatch, paused drafts, and changed issue status.

✅ Compatible defaults — Sequential remains the default, and graph-specific request combinations are validated before queue creation.

The supplied checks show 17 passed, none failed, and one pending. This review uses static tracing of the supplied code; no commands or tests were run.

Merge blockers

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

F3: 🔴 Preserve slots for manually started blockers

  • Required behavior: A graph issue holds its slot until it merges, including while blocked; issues started manually must count toward the same limit.

  • Evidence: packages/core/src/services/taskPlanning/epicQueueState.ts, runningUnclaimedIssues and epicScheduleIssues; packages/core/src/services/taskPlanning/epicQueueGraph.ts, settleGraphIssue and claimReadyGraphIssues.

    1. An active graph execution has maxParallel: 1, with independent issues A and B. A is started manually before the queue claims it, so its queue row retains dispatched_at = null.
    2. While A has status processing, runningUnclaimedIssues includes it. The scheduler correctly counts A and leaves B pending.
    3. A closes without merging. The terminal-status notification drives the graph, and settleGraphIssue records A as blocked with closed_unmerged.
    4. The subsequent queue read excludes A from runningWithoutClaim because its plan status is now closed. A also has neither a dispatch timestamp nor state dispatched, so epicScheduleIssues no longer counts its slot.
    5. claimReadyGraphIssues therefore claims and starts B, although A remains blocked and unmerged. The same closure would retain capacity if A had originally been claimed by the queue.

    The execution-row lock cannot prevent this: the serialized calculation itself omits A. Subsequent passes cannot reconstruct its earlier running state from the current status. The added manual-start test covers processing followed by merge, not processing followed by closure.

    static trace: This sequence follows the supplied status notification, graph settlement, queue-read, and scheduling paths. No execution was performed.

  • Minimum fix: Durably record that an observed manually started issue owns a slot, and preserve that reservation through blocked/closed states until settlement. Ensure adopting this reservation does not redispatch the existing run. Add a regression covering a manually started issue closing without merge while an independent issue waits at the limit.

Suggestions

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

S2: 🟢 Exercise PostgreSQL claim contention

The concurrent-advance test uses SQLite, so it does not exercise the PostgreSQL execution-row lock. A PostgreSQL integration test with competing advances would strengthen confidence in the capacity guarantee. This is optional: the supplied lock-and-claim implementation does not itself demonstrate a concurrency defect.

Score

The implementation has substantial coverage and clear separation of scheduling from dispatch, but the manual-start capacity regression needs correction. Current checks show no failures, with validation still pending.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 20s
  • Tokens: 81,204 (79,747 in / 1,457 out)
  • Cost: $0.76

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 F3 S2

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 86e3c8d

Addressed 1 AI review comment (IDs: 6840267075)

Addressed finding F3

Summary of Changes

I fixed F3. When a graph issue that someone started by hand closes without being merged, it now keeps its slot, so the queue no longer starts the next issue in its place. The two new regression tests pass, and both fail against the old code.

The fix (packages/core/src/services/taskPlanning/epicQueueGraph.ts)

  • Recording the slot: when a pass sees an unclaimed issue whose plan status shows it is running (not pending, merged or closed), adoptManualStart gives it the same queue claim a queue-started issue gets (dispatched_at, and state dispatched). The write only applies while the row is still unclaimed and the plan status isn't pending.
  • After closure: once the issue closes, settleGraphIssue blocks it with closed_unmerged as before. The claim stays through that block, so the scheduler keeps counting the slot until the issue merges. That matches what already happened for issues the queue started.
  • No second start: recording the slot starts nothing. The queue's normal retry only re-drives the issue if its plan status goes back to pending, after the usual 15-minute window, exactly as for a queue claim. If a person reopens a closed issue and starts it again, its closure block is cleared first and nothing is started.
  • Late notifications: a "processing" notification can arrive after the issue has already closed. advanceEpicQueue (epicExecutionQueue.ts) now passes the notified issue and status into the pass, so that notification still records the slot. Without this, the closed status left nothing showing the issue had ever run.

New tests (packages/core/test/epicQueueGraph.test.ts)

  • Close, reopen, merge: with a limit of 1, issue 1 is started by hand and then closes without merge. Issue 2 stays waiting, including after a reconcile sweep. When issue 1 is reopened and run again past the retry window, it isn't started a second time; when it merges, issue 2 starts.
  • Late notification: a delayed "processing" notification arrives after the issue already closed. The issue ends up blocked as closed_unmerged with its claim kept, and issue 2 doesn't start.

Checks: all 8 core epic-queue suites pass (98 tests), as does packages/api/test/mcpEpicDispatch.test.ts (76). Core typecheck is clean and ESLint passes on both changed source files; ESLint has no config for the core test file, so it skipped that one.

Separate from F3:

  • A remaining gap: if no pass or notification ever sees the issue running before it closes (say the status notification is dropped), there is no record that it ran. The closed status alone can't tell it apart from an issue someone closed without starting it, so in that case the slot is still lost.
  • A side effect: a hand-started issue counts as in flight for isEpicQueueIssueInFlight once its slot is recorded. Auto-merge and human-merge waits and blocker handling now treat it like a queue-started issue, which is consistent but wasn't there before.

There's no visual change, so I didn't make a preview.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 6m 2s
  • Tokens: 1,236,898 (1,224,431 in / 12,467 out)
  • Cost: $0.85

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

… closes without being merged, it now keeps its slot, so the queue no longer starts the next issue in its place. The two new regression tests pass, and both fail against the old code.

I fixed F3. When a graph issue that someone started by hand closes without being merged, it now keeps its slot, so the queue no longer starts the next issue in its place. The two new regression tests pass, and both fail against the old code.

**The fix** (`packages/core/src/services/taskPlanning/epicQueueGraph.ts`)
- **Recording the slot:** when a pass sees an unclaimed issue whose plan status shows it is running (not pending, merged or closed), `adoptManualStart` gives it the same queue claim a queue-started issue gets (`dispatched_at`, and state `dispatched`). The write only applies while the row is still unclaimed and the plan status isn't pending.
- **After closure:** once the issue closes, `settleGraphIssue` blocks it with `closed_unmerged` as before. The claim stays through that block, so the scheduler keeps counting the slot until the issue merges. That matches what already happened for issues the queue started.
- **No second start:** recording the slot starts nothing. The queue's normal retry only re-drives the issue if its plan status goes back to `pending`, after the usual 15-minute window, exactly as for a queue claim. If a person reopens a closed issue and starts it again, its closure block is cleared first and nothing is started.
- **Late notifications:** a "processing" notification can arrive after the issue has already closed. `advanceEpicQueue` (`epicExecutionQueue.ts`) now passes the notified issue and status into the pass, so that notification still records the slot. Without this, the closed status left nothing showing the issue had ever run.

**New tests** (`packages/core/test/epicQueueGraph.test.ts`)
- **Close, reopen, merge:** with a limit of 1, issue 1 is started by hand and then closes without merge. Issue 2 stays waiting, including after a reconcile sweep. When issue 1 is reopened and run again past the retry window, it isn't started a second time; when it merges, issue 2 starts.
- **Late notification:** a delayed "processing" notification arrives after the issue already closed. The issue ends up blocked as `closed_unmerged` with its claim kept, and issue 2 doesn't start.

**Checks:** all 8 core epic-queue suites pass (98 tests), as does `packages/api/test/mcpEpicDispatch.test.ts` (76). Core typecheck is clean and ESLint passes on both changed source files; ESLint has no config for the core test file, so it skipped that one.

**Separate from F3:**
- **A remaining gap:** if no pass or notification ever sees the issue running before it closes (say the status notification is dropped), there is no record that it ran. The closed status alone can't tell it apart from an issue someone closed without starting it, so in that case the slot is still lost.
- **A side effect:** a hand-started issue counts as in flight for `isEpicQueueIssueInFlight` once its slot is recorded. Auto-merge and human-merge waits and blocker handling now treat it like a queue-started issue, which is consistent but wasn't there before.

There's no visual change, so I didn't make a preview.

PR: #3515
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 13, 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 13, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR adds dependency-based epic scheduling with durable claims, concurrency limits, and consistent status reporting. It needs a localized correction before merge: manual executions can lose their slot when they finish between reconciliation passes.

✅ Shared scheduling logic — Dispatch and status summaries use the same pure scheduler, with tests covering diamonds, limits, and external prerequisites.

✅ Serialized queue claims — Graph dispatch locks the execution row and guards individual claims against duplicate claims, paused drafts, and changed issue statuses.

This review uses static analysis of the supplied code; no commands were run. Current checks report 17 passed, none failed, and one pending.

Merge blockers

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

F4: 🔴 Persist manual starts through real status notifications

  • Required behavior: An issue started manually must count toward maxParallel and retain its slot after closing without merge.

  • Evidence: packages/core/src/services/taskPlanning/epicQueueGraph.ts, driveIssue, adoptManualStart, and driveGraphExecution.

    1. An active graph has maxParallel: 1, issue A claimed and running, and unclaimed pending issues B and C. Someone starts B manually.
    2. B becomes processing, then closes without merge before another reconciliation pass. The actual updatePlanIssue notification path in planIssueManager.ts filters out nonterminal statuses, so the graph never receives B's running notification.
    3. B's closure notification reaches driveIssue with persisted status closed and observedRunning: false. Neither adoption condition matches. B becomes closed_unmerged but retains a null dispatchedAt.
    4. A merges. The scheduler sees B as blocked but not in flight, frees the only slot, and starts C. B's manually started, unmerged execution should still hold that slot.

    The execution-row lock cannot recover missing running evidence. runningWithoutClaim also excludes closed statuses, so subsequent reconciliation never repairs B's lost claim. The new manual-start tests directly invoke advanceEpicQueue with processing, bypassing the production notification filter.

    static trace: Verified against the changed graph driver and scheduler, the new manual-start tests, and the supplied notifyEpicQueue/updatePlanIssue excerpts. proposed regression: Exercise processing followed by closure through updatePlanIssue, without an intervening sweep, then merge A and assert C remains unstarted.

  • Minimum fix: Persist the manual-start claim when the real status-update path observes a graph issue entering an in-progress state, including while paused. Route those transitions to the graph driver or record the claim directly, while preserving sequential and parallel behavior. Add the production-path regression described above.

Suggestions

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

S3: 🟢 Exercise PostgreSQL claim contention

The SQLite concurrency test checks useful scheduling outcomes but cannot exercise PostgreSQL row-lock contention. An integration test using independent PostgreSQL connections would strengthen confidence in simultaneous claims and limit enforcement. This is optional; no defect in the queue-claim locking itself was established.

Score

The scheduler and coverage are substantial, but the production notification gap breaks an explicit slot-accounting guarantee. Passing checks do not cover that path; one validation check remains pending.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 12s
  • Tokens: 83,135 (81,668 in / 1,467 out)
  • Cost: $0.78

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 F4 S3

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 28d67da

Addressed 1 AI review comment (IDs: 6840735344)

Addressed finding F4

Summary of Changes

I fixed F4. When an issue in a graph execution moves to an in-progress status through the real plan-status writers, the queue now records it as holding a slot right away, even while the plan is paused. So if that issue was started by hand and then closes without merging before the next sweep, it still holds its slot, and the queue doesn't start another issue in its place.

What changed

  • planIssueManager.ts: notifyEpicQueue dropped every status that wasn't final (merged or closed). That is why the graph never saw B start in the review's scenario. It now passes every status on. All three writers go through it: updatePlanIssue, updatePlanIssueStatus and updatePlanIssueByPr.
  • epicExecutionQueue.ts: onPlanIssueStatusChanged still sends final statuses to advanceEpicQueue, as before. In-progress statuses now matter only to graph executions; sequential and parallel executions ignore them, so their behaviour is unchanged.
  • epicQueueGraph.ts: the new recordObservedGraphStart only writes the issue's claim, for an issue the queue never claimed. It settles nothing and starts nothing. It reuses the existing guarded writes: if the issue had been closed and reopened, its closure note is cleared, and the claim is written only if the row is still unclaimed and the issue isn't back to pending. A person's start already counts against the limit before this write, so no lock is needed.

Tests: the new packages/core/test/epicQueueGraphStatusPath.test.ts uses the real planIssueManager with no mocked notification filter.

  • Review scenario: limit of 1, issue 1 started by the queue. Issue 2 goes to processing and then closed through updatePlanIssue, with no sweep in between. When issue 1 merges, issue 3 is not started.
  • While paused: the same sequence through updatePlanIssueStatus while the plan is paused. After resuming and merging issue 1, the slot is still held.
  • Sequential unchanged: an in-progress update leaves a sequential execution as it was.

Both graph tests fail against the old code and pass with the fix; the sequential test passes either way. 301 tests pass across the core epic-queue suites, the root and core suites that use the plan-status writers, mcpEpicDispatch and mcpIntegration. Core typecheck and lint on the changed source files pass. ESLint ignores the new test file, as it does the existing core test files.

One remaining gap, outside F4: the status write never fails because the queue couldn't be updated, by design. So if the in-progress notification itself errors and the issue closes before the next sweep, the claim is still lost. Closing that would mean writing the claim in the same transaction as the status change. I left it alone.

There's no visual change, so I didn't create a preview.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (high)
  • Requested By: @propr-ultrafix
  • Time: 6m 25s
  • Tokens: 1,949,397 (1,932,471 in / 16,926 out)
  • Cost: $1.11

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

…in-progress status through the real plan-status writers, the queue now records it as holding a slot right away, even while the plan is paused. So if that issue was started by hand and then closes without merging before the next sweep, it still holds its slot, and the queue doesn't start another issue in its place.

I fixed F4. When an issue in a graph execution moves to an in-progress status through the real plan-status writers, the queue now records it as holding a slot right away, even while the plan is paused. So if that issue was started by hand and then closes without merging before the next sweep, it still holds its slot, and the queue doesn't start another issue in its place.

**What changed**
- **`planIssueManager.ts`**: `notifyEpicQueue` dropped every status that wasn't final (merged or closed). That is why the graph never saw B start in the review's scenario. It now passes every status on. All three writers go through it: `updatePlanIssue`, `updatePlanIssueStatus` and `updatePlanIssueByPr`.
- **`epicExecutionQueue.ts`**: `onPlanIssueStatusChanged` still sends final statuses to `advanceEpicQueue`, as before. In-progress statuses now matter only to graph executions; sequential and parallel executions ignore them, so their behaviour is unchanged.
- **`epicQueueGraph.ts`**: the new `recordObservedGraphStart` only writes the issue's claim, for an issue the queue never claimed. It settles nothing and starts nothing. It reuses the existing guarded writes: if the issue had been closed and reopened, its closure note is cleared, and the claim is written only if the row is still unclaimed and the issue isn't back to pending. A person's start already counts against the limit before this write, so no lock is needed.

**Tests**: the new `packages/core/test/epicQueueGraphStatusPath.test.ts` uses the real `planIssueManager` with no mocked notification filter.
- **Review scenario**: limit of 1, issue 1 started by the queue. Issue 2 goes to processing and then closed through `updatePlanIssue`, with no sweep in between. When issue 1 merges, issue 3 is not started.
- **While paused**: the same sequence through `updatePlanIssueStatus` while the plan is paused. After resuming and merging issue 1, the slot is still held.
- **Sequential unchanged**: an in-progress update leaves a sequential execution as it was.

Both graph tests fail against the old code and pass with the fix; the sequential test passes either way. 301 tests pass across the core epic-queue suites, the root and core suites that use the plan-status writers, `mcpEpicDispatch` and `mcpIntegration`. Core typecheck and lint on the changed source files pass. ESLint ignores the new test file, as it does the existing core test files.

**One remaining gap, outside F4**: the status write never fails because the queue couldn't be updated, by design. So if the in-progress notification itself errors and the issue closes before the next sweep, the claim is still lost. Closing that would mean writing the claim in the same transaction as the status change. I left it alone.

There's no visual change, so I didn't create a preview.

PR: #3515
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 13, 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 13, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR adds dependency-based epic scheduling with durable claims, optional concurrency limits, and consistent API/UI status reporting. No merge-blocking defect was verified in the supplied code. It is ready to merge within the reviewed scope, conditional on the pending validation check completing successfully.

✅ Shared scheduling logic — Readiness, dependency waits, and slot accounting use the same pure scheduler for dispatch and status reporting.

✅ Durable dispatch claims — Graph dispatch locks the execution row, rereads scheduling state, and guards individual claims against pause and persisted issue status.

✅ Focused regression coverage — Added tests cover dependency diamonds, concurrency limits, lost dispatch recovery, manual starts, paused execution, and invalid request combinations.

This was a static review of the supplied diff and context; no commands or tests were run. The supplied current-head status reports 17 passed checks, no failures, and one pending check.

Merge blockers

No merge blockers.

Suggestions

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

S4: 🟢 Exercise PostgreSQL claim concurrency

Add an integration test using separate PostgreSQL connections to advance the same graph concurrently near its concurrency limit. The SQLite tests verify scheduling outcomes, but serialize transactions and therefore do not exercise the execution-row lock under database contention. This would strengthen confidence in the existing implementation; no concrete lock failure was demonstrated in this review.

Score

The implementation provides cohesive scheduling logic and substantial coverage of the changed behavior, with no verified blocker. Production-database concurrency remains less directly tested, and validation is still pending.

Score: 8/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 53s
  • Tokens: 84,478 (83,567 in / 911 out)
  • Cost: $0.77

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 S4

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 13, 2026
@integry
integry merged commit 34a14f0 into 3470-epic-scheduler-primitives-nrj Nov 13, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant