Repository navigation
[Epic] Scheduler primitives: dependency edges, graph-aware epic queue, blocked-item hook - #3500
Conversation
…y finished, so it means nothing new. The results stand as reported: 99 of 101 passed, and the other two pass after the test updates.
…All new and existing tests in the touched suites pass. I fixed F1, F2 and F3, and each now has a regression test. All new and existing tests in the touched suites pass. ## F1: dependencies dropped when a refinement omits them `packages/core/src/services/taskPlanning/refinementOutput.ts`: `restoreDroppedIds` is now `restoreOmittedIdentity`. When the model returns a complete plan, each item matched to an existing task (by id, or by the existing single-title match that recovers a dropped id) keeps that task's `dependsOn` if the response leaves the field out (or sends `null`). An explicit `dependsOn: []` still removes them all. References to tasks the refinement deleted are still pruned by `preparePlanItemsFromModel` when the plan is stored. - The refinement prompt in `plannerPrompts.ts` now says that leaving `dependsOn` out keeps the current prerequisites, and that `[]` removes them. - The edit-operation path (update/replace/extend) already kept dependencies, because it merges into the current task. Both callers of `normalizeRefinedPlan` (core refinement and the API's `resolveRefinementOutcome`) get the fix. - New tests: a body-only complete refinement where one task drops `dependsOn` and one drops both its id and `dependsOn`; an explicit `[]`; and pruning of a kept dependency on a task the refinement removed. ## F2: restoring a deleted task could make the plan unsaveable New helper `propr-ui/src/hooks/planTaskDependencies.ts` (`restoreDeletedTask`), used by `restoreTask`: - The restored task's own prerequisites are checked against the tasks currently in the plan. - If a relationship's other task is still deleted, the link is set aside in a ref inside the hook and reconnected when that task is restored. This works in both orders: dependent deleted first or prerequisite deleted first. - A final prune drops any link that edits made in the meantime turned into a cycle, so the saved plan always passes the server's graph validation. - New tests: the exact sequence from the finding (delete `api`, delete `schema`, restore `api`, check the saved plan is valid, then restore `schema`), plus the reverse deletion order. ## F3: item ids changed when a legacy publication resumed In `packages/api/mcp/toolsPlanning.ts`, the publication claim now also writes `plan_json` with the generated ids when the stored draft lacked some. This happens before any issue is created or recorded, so a partial publication's stored plan names the items its `plan_issues` rows record, and a resume reads the same ids. Drafts that already have ids are not rewritten. - New test: an id-less draft, failure on the second issue, then resume. It checks that the partial plan's ids match the first row's `plan_item_id`, and that the final rows and stored plan keep those same ids. With the claim write temporarily removed, this test fails. - One side effect: for legacy drafts only, plan history now gets a snapshot at the claim as well as at completion. ## Verification - **UI:** the hook and TaskPlanner tests pass (47 files, 293 tests); `tsc` and eslint are clean. - **Core:** `refinementOutput` (11 tests) and `executeDraftDependencies` pass, and core `tsc` is clean. - **API:** all 12 tests in `planItemDependencies` pass, and eslint is clean on the changed files. - The API test process never exits after its tests finish, so runs end on the timeout. That also happens for a test that doesn't reach any changed code, so it comes from the container, not this change. - I didn't run the companion `planProvenanceUpdates` suite: I queued it behind `planItemDependencies`, and that run hit the exit hang and was killed first. - No visual preview: these are data and state fixes with no new UI. ## Separate observation (not changed) Core `executeDraft` (REST finalize) also generates ids in memory for id-less drafts and saves them only at the end. That path has no resume, and re-finalizing deletes the old `plan_issues` rows, so ids can't change across a recovery the way F3 did. But if the process crashes mid-run, rows are left naming item ids that aren't in the stored plan, until the next re-finalize. PR: #3490 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
… prerequisites only, and plans the model writes are reduced to their direct prerequisites before they're stored. Plans users save are left alone. The new and touched tests all pass, and lint and typecheck are clean. Both changes are in: the planner prompts now ask for direct prerequisites only, and plans the model writes are reduced to their direct prerequisites before they're stored. Plans users save are left alone. The new and touched tests all pass, and lint and typecheck are clean. **1. Prompts.** I put the rule in one constant, `DEPENDS_ON_DIRECT_PREREQUISITES_RULE`, in `plannerPrompts.ts`. It says `dependsOn` lists direct prerequisites only, and a task must not list one that is already a prerequisite, directly or indirectly, of another task it lists. It gives the example "for a chain A → B → C, C lists only B, not A", and says order in the plan implies nothing, so a task with no `dependsOn` is independent. The constant is added to three places: - the generation prompt. - the refinement rules. - the per-file task instructions. These are actually in `packages/core/src/services/taskPlanning/planFileGeneration.ts`, not `plannerPrompts.ts`, so that file imports the constant. **2. Reduction.** The new pure helper is `reducePlanItemDependencies` in `packages/shared/src/planItemGraph.ts`: - It drops a `dependsOn` entry when that entry can be reached through another entry of the same task. - The remaining entries keep their order, and the field is deleted when nothing is left (via `withDependencies`). - Tasks it doesn't change come back as the same objects. `preparePlanItemsFromModel` runs it last, after the existing clean-up that removes cycles, so it only ever sees an acyclic graph. Generation and refinement both go through this. REST draft update, MCP `create_plan` / `update_plan` and restore don't call it. One side effect: a refinement that returns a user-written plan also gets reduced, because refinement output always goes through `preparePlanItemsFromModel`. So if a user saved a plan with extra indirect entries and then refines it, those entries go away. **Tests** - **Shared:** chain (C: [A, B] becomes [B], whatever the order of the entries); diamond unchanged; a 5-step chain reduced to the immediate predecessor, both for the last task alone and for every task listing all earlier ones; a minimal graph returned unchanged, object for object; `preparePlanItemsFromModel` reduces while `normalizePlanItems` doesn't. - **API:** a chain with an extra indirect entry is stored as written through `create_plan`, `update_plan` and the REST draft update. The test compares parsed content rather than the raw string, because the MCP input schema already reorders object keys (that was true before this change). Entries and their order are kept exactly. - **Prompts:** a test checks the rule appears in all three prompts. Results: shared 11/11, `planItemDependencies` 13/13, `refinementOutput` and `planFileGeneration` 51/51, and the docs, `mcpDocs` and `mcpIntegration` suites all pass. ESLint passes for core and api, and `tsc` for shared, core and api. Shared has no ESLint config, so its files weren't linted. **Docs.** `docs/docs/features/planning.md` and `docs/mcp.md` now say `dependsOn` holds direct prerequisites. I also added that plan order implies no dependency, and that only generated and refined plans have indirect entries removed. There are no preview images, since nothing in the UI itself changed. The "Depends on" row will just show fewer entries for generated plans. PR: #3490 Comment by: @integry (ID: 6824696181) Model: Claude Opus 5.5
…P publication after recent edits preserves the complete pre-publication plan` in `packages/api/test/planRevisions.test.ts`, which expected 2 plan revisions and got 3. All 247 other units in the shard passed. The other three shards were cancelled by CI after this one failed; they didn't fail themselves. I fixed the CI failure. Shard 1/4 had one failing test, `MCP publication after recent edits preserves the complete pre-publication plan` in `packages/api/test/planRevisions.test.ts`, which expected 2 plan revisions and got 3. All 247 other units in the shard passed. The other three shards were cancelled by CI after this one failed; they didn't fail themselves. **Cause:** this branch deliberately gives item ids to older drafts that have none, at the moment `publish_plan` claims the plan. Another test on the branch already covers that. Storing those ids changes the plan, which has two effects: 1. The claim saves the plan as it was before publication, as intended. 2. The first issue-link write then saves the same plan with the new ids added. That's the extra third revision. The later issue-link writes still merge into it. The test's plan has no ids, so it went through this path. Drafts created on this branch already have ids, so they get no extra revision; it only happens once, for older drafts. **Fix (test only, no production code changed):** the test now runs twice: - **With item ids:** it checks the original behaviour — 2 revisions, and the newest one is exactly the plan from before publication. - **Without item ids:** it checks 3 revisions. The middle one is exactly the plan from before publication, and the newest is the same plan with every item given an id. **Verification:** all 21 tests in `planRevisions.test.ts` pass locally, and ESLint with zero warnings allowed is clean. I had to shorten a few lines, because the file is at the lint rule's 400-line limit. The test process hangs after the last test, which is a known issue in this package's tests and not a failure. A one-off typecheck of the file reports a single error, a missing type declaration for the migration it imports on line 6. That line isn't part of this change. There are no visual previews because nothing in the UI changed. PR: #3490 Comment by: @propr-dev[bot] (ID: 6825699035) Model: Claude Opus 5.5
…nged now still saves the plan with only direct prerequisites when that plan has redundant ones. I fixed F4. A refinement that returns the stored plan unchanged now still saves the plan with only direct prerequisites when that plan has redundant ones. **Cause:** `refinementPlanUpdates` (`packages/api/routes/plannerHelpers/planRevisions.ts`) kept the stored plan whenever the model's output was byte-identical to it. That threw away the reduction from `preparePlanItemsFromModel`. So with B depending on A and C depending on `[A, B]`, C kept the redundant A. **Fix:** the helper now checks whether preparing the plan changed any item's `dependsOn`: - **If it did,** the reduced plan is always written. `plan_cause` becomes `refinement`, unless the stored plan already matches the reduced one. The outgoing plan goes into revision history with its original cause. - **If it didn't,** the old shortcut still applies. An identical result changes nothing and keeps its provenance. This also covers plans saved before item ids existed: adding ids alone still doesn't count as a refinement. Both callers, the background refinement path and the HTTP handler in `generationHandlers.ts`, go through this helper, so both get the fix. Generation (`taskPlanningService.ts`) always stores the prepared plan and has no such shortcut, so it wasn't affected. **Regression tests** in `packages/api/test/planItemDependencies.test.ts`, run end to end through a real refinement against SQLite: - A user-saved chain with a redundant edge, returned unchanged as `modified`, is stored as `ui → [api]`. `plan_cause` becomes `refinement` and the user's plan is kept in history as `manual_edit`. I swapped in the HEAD version of the helper and this test fails there, so it catches the bug. - An already-reduced plan returned unchanged stays the same, keeps `manual_edit`, and creates no revision. **Verification:** - **Passing:** `planItemDependencies` (15 tests), `planProvenanceUpdates` (9/9) and `plannerBackgroundLifecycle` (21/21) all pass. ESLint (`--max-warnings 0`) and `tsc --noEmit` are clean. - **One failure, not from this change:** `planRevisions` passed 20 of 21. The failing test is "HTTP handlers check ownership and input and refuse restoring a busy plan", which got 200 where it expected 403. It fails the same way with the HEAD helper, so it comes from how I ran it: these suites need `PROPR_DEMO_MODE=true` here, and the ownership check probably behaves differently in that mode. I made no previews because nothing visible changed. PR: #3490 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
…_on_issues` as an array of issue numbers, the same as the issues list. F5 is fixed: the issue-update response now returns `depends_on_issues` as an array of issue numbers, the same as the issues list. **What changed** - `resolveIssueForResponse` in `packages/api/routes/planIssueRouteUtils.ts` is the one function both REST issue handlers use to format their responses. It now also runs `withPlanIssueDependencies`, so `createUpdateIssueHandler` returns `plan_item_id` as a string or `null` and `depends_on_issues` as a `number[]`. A stored `'[42]'` comes back as `[42]`, and older rows with `null` come back as `[]`. - The two list responses in `createGetIssuesHandler` (paged and unpaged) used to call `withPlanIssueDependencies` themselves. They now rely on the same function, so all three responses are formatted in one place. **Same-defect check** I looked at every other API path that returns plan issue rows: - The MCP `get_plan` tool already converts the rows the same way. - The epic-queue, MCP dispatch, issue-summary and dashboard queries only read a few columns or use the rows internally; none of them return `depends_on_issues`. There was no other occurrence to fix. **Tests** - I added two cases to `test/planIssueHandlers.followup.test.ts`. Each updates an issue's status, then checks the response: one starts from a stored `'[42]'` and expects `[42]`, the other starts from a legacy row with `null` and expects `[]` and `plan_item_id: null`. All 11 tests in that file pass. With the fix taken back out, both new cases fail. - `test/planRefinementSettlement.test.ts`, which covers the list handler, passes (25 of 25), as does `packages/api/test/planItemDependencies.test.ts` (15 of 15). The `packages/api` typecheck and lint on the changed route files are clean. - `packages/api/test/mcpEpicDispatch.test.ts` has 57 failing tests here, all with "GitHub auth not configured" because this container has no GitHub app credentials. I ran it again with the HEAD versions of the two route files and the same tests failed in the same way, so the failures don't come from this change. There's no visible UI change, so I didn't capture previews. PR: #3490 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
…-item-ids-and-d-20261112-1213-okq [3470 by Claude Opus 5.5] Add stable item ids and dependsOn edges to the plan schema and persist them on plan issues
Epic progress: Scheduler primitives: dependency edges, graph-aware epic queue, blocked-item hook6 out of 6 PRs merged ✅
Merged child PRs: #3490, #3504, #3507, #3515, #3518, #3523 ✅ This epic PR has been merged into main. This comment is updated automatically by ProPR as child PRs merge. |
… has prerequisites is now linked on GitHub as "blocked by" them. Both publication paths do it through one shared helper. The new tests and the publication suites pass, apart from one environment failure in `mcpWorkflows`, explained below.
How the GitHub API works (checked against the current docs): the add call is `POST /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by` with `{ issue_id }`. That is the blocking issue's internal REST `id`, not its number. It needs repository Issues: write, which the GitHub App already requests, and it accepts both installation and user tokens. The docs don't say what happens if you add a link that already exists, so the code never relies on it.
What the helper does (`packages/core/src/services/planDependencyLinks.ts`):
- Second pass: it runs only after every issue exists, so a prerequisite created after its dependant is still linked.
- No duplicates: for each dependant it first lists the existing blockers and adds only the missing ones. If an add returns 422, it lists again and counts the link as existing when it is now there. A resumed or repeated publication therefore never duplicates a link.
- Issue ids: taken from the issue creation response where available, otherwise looked up with `GET /repos/{owner}/{repo}/issues/{n}`. Nothing new has to be stored, so plans published earlier and resumed publications work.
- Best effort: it never throws. Each link is recorded as `created`, `existing` or `failed` (with the error), and failures are logged.
- No dependencies, no calls: a plan without dependencies makes no extra GitHub calls.
REST finalize (`taskExecutionService.ts`, `githubIssueService.ts`): runs the helper with the installation credential and stores the result in the draft's `context_config.dependencyLinks`. A linking error never fails finalize.
MCP `publish_plan` (`toolsPlanning.ts`, `planItems.ts`, `planPublication.ts`):
- Runs the helper with the caller's credential after the prerequisites are recorded and before the final write. The issue id comes from the creation response, or from the marker lookup on resume.
- Each link request stays inside the publication lease, and the claim is renewed before each dependant issue. The only thing in this step that can stop a publication is losing or failing to renew the claim; a GitHub failure on a link cannot, and it leaves no partial state.
- The publish result includes `dependencyLinks.links`, and `get_plan` shows `dependencyLinks` with the created and existing counts and the list of failed links.
Not done: sub-issue links. Plans have no parent tracking issue, as the issue anticipated; this is documented.
Docs: `docs/mcp.md`, `docs/docs/features/planning.md` and the permission table in `docs/docs/operations/github-auth.md` now cover the behaviour, the Issues: write permission, and what happens without it.
Tests:
- Core helper (new): a small graph, a forward reference with id lookup, repeat runs, the 422 race, failures recorded per link, and no calls without dependencies.
- REST (`executeDraftDependencies`, extended): links created; a 403 still leaves the publication `executed`; no link calls for a plan without dependencies.
- MCP (`mcpPublishPlanDependencyLinks`, new): a graph with a forward reference, resume after a partial publication, resume finding links already on GitHub, a 403 that leaves the publication successful with `get_plan` listing the failed links, and no extra calls for a plan without dependencies.
Results:
- 9/9 core tests and 5/5 new MCP tests pass. The existing `mcpPublishPlan` (21) and `planRevisions` (21) suites still pass.
- `mcpWorkflows` fails in this container because there's no Redis: it stops at the follow-up dispatch on line 250, after its `publish_plan` check on line 233 has passed.
- The API node test runs pass but hang at exit, which is a known pattern in this package.
- Typecheck is clean for core and api, and `eslint --max-warnings 0` is clean on the touched files.
There's nothing visual to show, so I made no preview.
…eady exists, it now compares the prerequisite issue's GitHub REST `id`, not its issue number. A blocker from another repository that happens to have the same number no longer stops the link from being created or reported as in place.
I fixed F1. When the helper decides a "blocked by" link already exists, it now compares the prerequisite issue's GitHub REST `id`, not its issue number. A blocker from another repository that happens to have the same number no longer stops the link from being created or reported as in place.
**What changed** (`packages/core/src/services/planDependencyLinks.ts`):
- **Listing:** the existing blockers are now kept as their REST ids. Paging still counts every entry returned, including any without an id.
- **The check:** the helper uses the prerequisite's REST id, either captured when the issue was created or looked up with `GET /repos/{owner}/{repo}/issues/{n}`, both to skip existing links and to make the add call. If that lookup fails, the link is recorded as `failed`, as before.
- **The 422 path:** an add that GitHub rejects with 422 now counts as `existing` only if the prerequisite's own id shows up on the second list. An unrelated blocker no longer counts as confirmation.
- **One trade-off:** on a resume where the creation responses aren't available, the helper now makes one id lookup for each prerequisite that was already linked. Before, it skipped those by number alone.
- **Callers:** both publication paths (REST finalize and MCP `publish_plan`) use this one helper, and neither filters blockers by repository anywhere else, so neither caller needed a change.
**New tests:**
- **Core:** an issue blocked by `other/elsewhere#70` (a different id) still gets linked to the plan's own #70, and a second run then recognises that link. A second test covers a 422 where the only listed blocker is the cross-repository #70: the link is now recorded as `failed` instead of `existing`.
- **MCP:** a publication is interrupted, then a cross-repository blocker #201 appears on issue 202 before the resume. The resume still creates the link to the plan's #201.
- **Fake GitHub:** both test fakes can now list extra blockers from other repositories.
**Results:**
- **Core helper:** 8/8 pass. Run against the helper as it was before this fix, the two new core tests fail and the other six pass.
- **REST (`executeDraftDependencies`):** 3/3 pass.
- **MCP (`mcpPublishPlanDependencyLinks`):** 6/6 pass, including the new one. The run then hangs at exit, a known pattern in this package. I didn't run the new MCP test against the old code.
- **Typecheck:** clean for core and api.
- **Lint:** `eslint --max-warnings 0` is clean on the changed source file and the API test. The core test files are outside the lint config, already the case before this PR.
There's nothing visual to show, so I made no preview.
PR: #3504
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
I fixed the Shard 2/4 failure; the test now passes locally. **Cause:** `packages/api/test/mcpObservableSurface.test.ts` checks every backticked word in `docs/mcp.md`. Each one has to be either an MCP tool name or listed in the test's `nonToolTokens` allowlist. This PR added a line to the docs saying each blocked-by link is recorded as `created`, `existing` or `failed`. `created` and `failed` were already on the list; `existing` wasn't, so the test failed with: ``` docs/mcp.md names existing, but it is neither an admin-visible tool nor an explicit non-tool token ``` **Fix:** I added `existing` to `nonToolTokens`, with a comment saying it is a dependency-link status that `publish_plan` reports. The change is two lines in that test file; no product code changed. **Checks:** - The test fails with that same message on the current commit and passes with the fix. - `eslint --max-warnings 0` is clean on the file. - The test needs to be run from the repo root. Run from `packages/api`, it fails earlier with "Documentation is unavailable", because it looks for the docs relative to the current directory. There's nothing visual to show, so I made no preview. PR: #3504 Comment by: @propr-dev[bot] (ID: 6832595938) Model: Claude Opus 5.5
…dependencies-to-20261112-1727-c57 [3471 by Claude Opus 5.5] Sync plan dependencies to GitHub as "blocked by" links when a plan is published
…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.
…` 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
…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
…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
…pic-execution-q-20261112-1932-t6n [3472 by Claude Opus 5.5] Give the epic execution queue per-issue state instead of a single cursor
…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.
… 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
…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
… 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
…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
…pic-issues-by-d-20261112-2304-xrj [3473 by Claude Opus 5.5] Schedule epic issues by dependency graph with a max_parallel limit enforced in code
… durable event, raises an Inbox card and a realtime update, and a blocked or pending issue can be skipped or retried through REST, MCP and Planner Studio. Every suite I ran passes, and typecheck, zero-warning lint and the OpenAPI check are clean. Blocked events - A new migration adds an `epic_queue_blocked_events` table. Every queue write that blocks or clears an issue now records the change in the same transaction as the guarded state write, so it doesn't matter which process made it. - Blocking an issue with the same kind and reason again records nothing and keeps the original blocked time. A different blocker on the same issue first records the old one as resolved (`replaced`), then records the new one. Clearing records how it ended: `cleared`, `retried`, `skipped` or `settled`. - After commit, each event is published as plan-domain realtime activity (`blocked`, or `progressed` for a resolution). Each new blocker also raises one `plan` Inbox card for the plan owner and the instance members, and that card is deduplicated per blocked state. An agent-reported blocker raises no plan card, so its existing task notification stays the only one. If a process crashes after commit but before delivery, the recovery sweep delivers the missed event. - Clients can read an execution's events with a cursor through `GET …/execution-queue/blocked-events` and the MCP tool `list_plan_blocked_events`. Skip and retry (`POST …/issues/:n/skip` and `…/retry`; MCP tools `skip_plan_issue` and `retry_plan_issue`) - Both actions require the `executionId` (now included in the queue summary) and accept an optional `expectedState`. Both are idempotent: repeating one answers `already_skipped` or `already_retried`. They're refused with a clear code for a stale execution (`STALE_EXECUTION`), an issue in flight (`IN_FLIGHT`, which includes a pending issue someone started by hand) or one that's already done (`ALREADY_DONE`). - Skip: a chain moves on to the next issue. In a graph, issues that depend on the skipped one stay waiting and list it in `waitingOnSkipped`. They start only after a skip with `satisfiesDependents: true`, and skipping again with that option releases them. Skip never closes or edits the GitHub issue. - Retry: the blocker is cleared and the issue goes back through the queue's normal dispatch. - A failed dispatch is redispatched immediately. - An agent-reported blocker puts the plan issue back to pending, then dispatches it. - An issue closed without merge is reopened on GitHub first. - A missing issue is checked again, and blocks again if it is still missing. - A wait for a human merge and a label handoff keep their claim and are re-evaluated rather than re-run. - An issue still in setup is refused with `NOT_RETRYABLE`, because setup recovery handles it. - Retry doesn't go through `implement_plan`, so an issue started through MCP can be retried even though its implementation receipt is still there. Changes you might not expect - Skipped issues needed two scheduler fixes: a skipped parallel child is no longer treated as reopened, and a parallel execution can now complete while one of its issues is skipped. - Skipping doesn't finish the epic PR on its own. Its final label is only added once every plan issue has finished, and a skipped issue stays pending in the plan, so that labeling stays owed until it's done. Planner Studio: a blocked row shows the blocker kind and reason with Retry and Skip buttons. In a graph it also offers "Skip and start #N". Queued rows get a Skip control, and an issue waiting on a skipped prerequisite says so. Open views refresh when a `blocked` or `progressed` activity arrives for the plan, and the Inbox labels these cards "Epic issue blocked". Two screenshots (desktop and mobile) are attached as previews. Docs and tests - Conventions: the routes are registered with OpenAPI docs and regenerated client types. `docs/mcp.md`, `docs/mcp-coverage.md` and the user-facing MCP feature page are updated, and the allowlist in `mcpObservableSurface` has the new words. - New tests: core tests cover what the issue asked for: one event per blocked state under repeated sweeps, a new event for a different blocker, resolution on clear, the cursor, skip in a chain and in a graph with both options, retry of every blocker kind, and refusals. Delivery tests use the real notification service. New MCP tests are in `mcpEpicDispatch`, and new UI tests sit next to the changed components. - Results: 260 tests pass across the core epic suites, the MCP, OpenAPI, route-authorization and notification-projection suites. The 87 root tests that touch the queue pass, as do all 49 Planner Studio UI test files. - Existing tests I edited: eight existing core epic suites and `mcpIntegration` now apply the new migration. Four summary assertions now expect the new `executionId` field.
… both jobs, the "Audit committed dependency resolution" step failed because new security advisories were published against dependencies the branch already used. Main has the same old versions, so other branches will hit the same failure. I fixed both failures. Neither came from this PR's code. In both jobs, the "Audit committed dependency resolution" step failed because new security advisories were published against dependencies the branch already used. Main has the same old versions, so other branches will hit the same failure. **Cause:** `scripts/audit-dependencies.mjs` (`audit:runtime`) reported blocking advisories against: - `hono` 4.13.12: GHSA-3gg2-335m-rxc6, GHSA-46wx-v44x-9hh2 and GHSA-4h7h-rv7c-7m2v, among others. All are fixed in 4.13.16 or later. - `@hono/node-server` 2.1.5: GHSA-qv5m-9pm6-hqp3 and GHSA-jpvv-r467-5p4w, fixed in 2.1.6. The CI log only named `hono`. This one showed up when I re-ran the audit after the `hono` bump. **Fix:** two version bumps, with no new audit exceptions: - In `package.json`, I raised the pinned `overrides.hono` from `4.13.12` to `4.13.18`. - In `package-lock.json`, `hono` is now 4.13.18 and `@hono/node-server` is now 2.1.8. Those are the only two entries that changed. I made the lock edits with npm 11. **Checks:** - `npm run audit:runtime` and `npm run desktop:audit:packaging` both pass. - Running `npm install --package-lock-only` with npm 10 (the version CI uses) leaves the lock unchanged. - `npm ci --dry-run` succeeds. This change has nothing visible to show, so I made no previews. PR: #3518 Comment by: @propr-dev[bot] (ID: 6842390332) Comment by: @propr-dev[bot] (ID: 6842391444) Model: Claude Opus 5.5
… "Validate Changes". ESLint flagged the `PlanIssueRow` render function in `propr-ui/src/components/TaskPlanner/PlanIssueRow.tsx` at complexity 22, over the limit of 20. The `queueState && onQueueAction && …` guard this PR added was enough to push it over. I fixed the UI Lint failure, which was the step that failed "Validate Changes". ESLint flagged the `PlanIssueRow` render function in `propr-ui/src/components/TaskPlanner/PlanIssueRow.tsx` at complexity 22, over the limit of 20. The `queueState && onQueueAction && …` guard this PR added was enough to push it over. **The fix:** I moved that guard into a small `RowQueueNotice` component in the same file. It renders `PlanIssueQueueNotice` only when the row has both a queue state and an action handler, which is what the inline check did, so behaviour is the same. **Checks:** - `npm run lint` in `propr-ui` (zero-warning ESLint) now passes. - `tsc --noEmit` is clean. - The 6 `PlanIssue*` test files (48 tests) pass. The "Slow Test" note on `creation-short-window.pw.ts` (10.1 minutes) was only a timing annotation; that test didn't fail, so I left it alone. Nothing changed on screen, so I didn't make new preview images. PR: #3518 Comment by: @github-actions[bot] (ID: 6843464620) Comment by: @propr-dev[bot] (ID: 6843464997) Model: Claude Opus 5.5
…vious code and pass now. All 119 core epic tests pass, as do the 78 MCP dispatch tests and the 12 root tests that touch the queue. Typecheck and zero-warning lint are clean. I fixed F1 and F2. The new regression tests fail on the previous code and pass now. All 119 core epic tests pass, as do the 78 MCP dispatch tests and the 12 root tests that touch the queue. Typecheck and zero-warning lint are clean. **F1 – a retry of a parallel issue was lost if the plan was paused** - **Cause:** the retry tried to start the issue once, right away. A paused plan skipped that attempt, and nothing tried again later. - **Fix:** the parallel queue's own pass now starts any issue that is owed a retry. That pass already runs on resume, in the recovery sweep and whenever a child issue changes status, so a pause or a crash after the retry commits now only delays the start. It uses the existing guarded dispatch, so a paused plan still holds the issue and the claim prevents a double start. - **How it tells retried issues apart:** an issue counts as owed a retry in two cases. Either it's pending in both the queue and the plan, which in a parallel execution only a retry can cause, or its latest event is the retry and its plan status is still pending. The second case covers a crash after the claim but before the issue was labelled; like a chain's head, it is started again after 15 minutes. - **Scope:** issues started when the execution was created are never re-dispatched by this. - **Changes:** the retry action now just calls `startEpicQueueHead` for every mode, so I removed `dispatchEpicQueueIssue`, which nothing else used. The new logic is in `epicQueueParallelRetry.ts` because `epicExecutionQueue.ts` would otherwise go over the 400-line lint limit. **F2 – an event was marked delivered before it was published** - **Fix:** in `epicQueueBlockedNotify.ts`, `notified_at` is now set only after the Inbox card is stored and the publisher reports success. Before, a thrown error or a `false` result was ignored. - **Recovery:** an event that wasn't published stays unmarked, and the sweep delivers it again. The replay adds no second Inbox card, because the card's deduplication key makes the insert a no-op. - **One trade-off:** while Redis is down, each sweep retries up to 100 events and repeats those no-op card writes until publishing works again. **New tests** - `epicQueueBlockedEvents.test.ts`: - A retry while paused stays pending and returns `already_retried` if repeated. Neither a sweep nor a sibling issue finishing starts it while paused. Resume starts it exactly once. - A retry committed before a crash is started by the sweep. - A retried issue whose claim was taken but never labelled is started again only after 15 minutes. An initial child is not. - `epicQueueBlockedNotify.test.ts`: - Events whose publish returns `false` or throws stay undelivered, and that covers resolution events too. - Recovery then publishes one update, keeps one card per user, and marks the event delivered. **Something I found but didn't change:** a child that started with the parallel execution has the same weak spot. If the process stops after its claim but before it's labelled, nothing recovers it. That existed before this PR and wasn't in F1, so I left it alone. To run these suites locally, set `PROPR_DEMO_MODE=true`. Without it, the GitHub-auth check makes the files exit early. There are no visual changes, so I made no previews. PR: #3518 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
…lanning/epicQueueActions.ts` and added four regression tests. All four fail on the previous code and pass now. I fixed both F3 and F4 in `packages/core/src/services/taskPlanning/epicQueueActions.ts` and added four regression tests. All four fail on the previous code and pass now. **F3: skip no longer accepts an issue that already merged** - Skip now checks whether the plan issue is `merged`, for pending and blocked rows alike, and refuses with `ALREADY_DONE`. The check happens twice: once before the write, and again inside the transactional skip update, so a merge landing between the two is also caught. - If the guarded write changes nothing and the issue has merged by then, skip also reports `ALREADY_DONE` rather than `STATE_CHANGED`. - The merge is still settled normally afterwards, so the dependents start. - The same check covers a blocked row (for example one waiting for a human merge) whose plan issue merged. That case was the same defect, so it's included. **F4: retry reserves the issue before reopening it on GitHub** - I added a `retry_reserved_at` column to this PR's existing migration (`20261113000000_add_epic_queue_blocked_events.js`) rather than a new migration file. - When retrying an issue closed without merge, retry first sets the reservation with a guarded write on the exact blocked row it read. Only after that does it read the plan status and call the GitHub reopen. The final write that clears the blocker requires that same reservation and removes it. - **Competing actions:** while a reservation holds, both skip and a second retry are refused with the existing `IN_FLIGHT` code (skip checks it in its guarded update too). No new error code was needed, so the API and MCP docs are unchanged. - **Recovery:** if the reopen fails or the row changes, the reservation is released. If the process stops partway, the reservation lapses after `RETRY_RESERVATION_MS` (5 minutes), after which skip or retry can proceed. The other blocker kinds have no outside side effect, so they don't reserve, but they still respect someone else's live reservation. - **What this does not cover:** if GitHub accepted the reopen and the process then crashed, the issue stays reopened. That race with an external API can't be made atomic, and I didn't try to. **Tests** (in `packages/core/test/epicQueueBlockedEvents.test.ts`) - Skip refuses a merged prerequisite whose queue row hasn't settled, both pending and blocked. - Skip refuses when the merge lands just before its guarded write; the test injects the merge at that point. - A skip and a retry attempted during a retry's reopen are both refused, and the issue is reopened only once. - A failed reopen releases the reservation, and one left behind by a stopped process lapses. **Verification** - All 126 core epic tests pass. - The `mcpEpicDispatch` and `mcpIntegration` suites pass (81 tests) when run as CI does, with `NODE_ENV=test`. Without it, every test in them fails on the GitHub auth check, on the old code as well as mine. - Typecheck and zero-warning lint on the changed source files are clean. There's no visible change, so I made no preview. **One thing I noticed but left alone:** retry doesn't check for a merged plan issue either. That's outside F3, which only covers skip. PR: #3518 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
…ent-when-an-epi-20261113-0213-zd9 [3474 by Claude Opus 5.5] Emit an event when an epic queue issue becomes blocked, and add skip and retry actions
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThis PR adds plan dependencies, graph scheduling, per-issue queue state, blocked-event delivery, and automation subscriptions. The implementation has substantial targeted coverage, but needs a correction before merge. ✅ Shared dependency publication — REST and MCP use the same second-pass GitHub linking helper, including existing-link detection and per-link failure reporting. ✅ Durable automation admission — Event receipts use idempotency keys and transactional revision/cursor checks, with recovery for failed enqueue attempts. The supplied current-head status reports 38 passing checks and no failures. This review is limited: six files are explicitly omitted, including the central queue state and execution implementations, and the issue specifications are truncated. No commands or tests were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F5: 🔴 Reject duplicate IDs during refinement
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe shared helpers, recovery mechanisms, and extensive tests are strong, and current checks pass. However, silent identity and dependency loss requires correction; omitted queue implementations also limit verification of the broader change. Score: 6/10 🤖 Review Details
Files omitted from review diff6 files were omitted from the review diff. Large, binary, generated, and lockfile changes are deprioritized. Did not fit the review context budget
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit c155839
Summary of ChangesI fixed F5. When a model's plan gives two tasks the same valid id, generation and refinement now reject it with an error that names the task. Before, the second copy was quietly renamed and its dependents lost their prerequisite. A rejected refinement leaves the stored plan, and the plan's recorded origin ( What changed
Tests
Not covered by a test: the generation check is two lines in Separate observation, not changed: the rule that edit-style refinements ( There are no previews because nothing visible changed in the UI. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…lid id, generation and refinement now reject it with an error that names the task. Before, the second copy was quietly renamed and its dependents lost their prerequisite. A rejected refinement leaves the stored plan, and the plan's recorded origin (`plan_cause`), exactly as they were. I fixed F5. When a model's plan gives two tasks the same valid id, generation and refinement now reject it with an error that names the task. Before, the second copy was quietly renamed and its dependents lost their prerequisite. A rejected refinement leaves the stored plan, and the plan's recorded origin (`plan_cause`), exactly as they were. **What changed** - **Shared helper** (`packages/shared/src/planItemGraph.ts`): a new `duplicatePlanItemIdErrors` lists every item whose valid id an earlier item already has. Each entry names the item, for example: *Task 2 "API" (id "schema") reuses the id "schema" of task 1. Item ids must be unique.* - **`preparePlanItemsFromModel`** now throws a new `PlanItemIdConflictError` on a repeated valid id instead of renaming it. Missing or malformed ids (blank, too long, null) are still replaced with fresh ones, and the dependency cleanup is unchanged. - **Refinement** (`refinementOutput.ts`): `normalizeRefinedPlan` checks for duplicates before trying to recover task identities, so the F5 scenario is rejected. Edit-style output is checked too: an `add` edit that reuses an existing id is rejected. The failure uses the new reason `duplicate_id` and lists the offending tasks. - **Refinement retry** (`refinement.ts`): as with other invalid output, the model gets one more try. The retry prompt now tells it which task reused which id. If the second answer still repeats an id, the refinement fails and the plan is kept. - **Generation** (`taskPlanningService.ts`): a generated plan with repeated ids fails before anything is saved, with the same item-specific message. - **Storage** (`refinementPlanUpdates`) needed no change. A plan that skips the normalisation step still reaches `preparePlanItemsFromModel`, which now throws there. That happens inside the existing error handling, so the stored plan is preserved on that path too. **Tests** - Shared: repeated valid ids are rejected with the item named; malformed and missing ids are still repaired. - Core: the F5 scenario (Schema and API both returned as `schema`, UI depending on `api`) is rejected with `duplicate_id`; so is an `add` edit that reuses an existing id. - API (`plannerBackgroundLifecycle.test.ts`): the full background refinement for F5, both through normalisation and with a result already marked as normalised. Each asserts the stored plan is byte-identical and `plan_cause` is unchanged. - I didn't run the new tests against the old code. Tracing it: the old normaliser accepted the F5 plan, and the old storage step renamed the duplicate and saved the changed plan, so these assertions would fail there. - All 60 test files that touch refinement, plan items or dependencies pass under `scripts/run-test-suite.mjs`. ESLint (max 0 warnings) and `tsc` are clean for core and api. **Not covered by a test:** the generation check is two lines in `generatePlan`, which is only exercised by the end-to-end plan generation suite, so it has no unit test. The duplicate detection it calls is tested. **Separate observation, not changed:** the rule that edit-style refinements (`update`/`replace`) never change a task's id already held; only `add` edits could introduce a duplicate. There are no previews because nothing visible changed in the UI. PR: #3500 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 plan dependencies, graph scheduling, per-issue queue state, blocked events, and automation subscriptions. The visible implementation has substantial targeted coverage, but I cannot call it merge-ready because the diff omits central queue implementation files. The linked acceptance criteria are also truncated. ✅ Shared dependency linking — REST and MCP publication use the same helper, resolve forward references, and record GitHub link failures without failing publication. ✅ Guarded automation admission — Event-run insertion checks the definition revision and subscription cursor inside its transaction, preventing stale subscription decisions from creating receipts. ✅ Targeted recovery coverage — Added tests address interrupted publication, failed enqueue recovery, concurrent dispatch, and legacy queue migration. The supplied current-head status reports zero failures and five pending checks. I ran no commands or tests, as requested. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Complete central queue reviewReview the omitted ScoreThe visible changes show careful validation and recovery work, with no verified blocker. Omitted central implementation files leave a material verification gap despite the extensive supplied tests and currently non-failing checks. Score: 7/10 🤖 Review Details
Files omitted from review diff10 files were omitted from the review diff. Large, binary, generated, and lockfile changes are deprioritized. Did not fit the review context budget
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
|
|
/review fable |
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — fableOverall EvaluationThis epic PR delivers the six linked issues: stable plan item ids and The implementation is unusually careful about the invariants the issues ask for: writes are compare-and-set on the issue's own row and fenced by ✅ Occurrence-fenced per-issue writes — ✅ Exactly-once blocked events with an outbox — ✅ Fenced event-run admission — Ready to merge within scope; the suggestions below are optional. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Remove the stale "scheduling does not use these edges yet" sentence
S4: 🟢 Confirm the parallel first-child auto-merge arming change is intended
S5: 🟢 Make retry's answer for a skipped issue consistent
S6: 🟢 Source the task terminal-state set from the shared lifecycle
S7: 🟢 Reuse the Inbox projection's recipient resolution
S8: 🟢 Assign ids when a pre-id revision is restored
S9: 🟢 Deliver post-commit events through the caller's connection
S10: 🟢 Split the blocked-events suite
ScoreA large, well-tested implementation of all six issues with careful fencing of concurrent queue writes, exactly-once blocked events and admission-fenced event runs; all current-head checks pass and no PR-introduced defect could be demonstrated, leaving only documentation drift and optional hardening. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
/merge |
|
🔀 Resolved merge conflicts from Conflicting Files
Resolution SummaryAll three conflicts are resolved and no conflict markers remain anywhere in the repository. The OpenAPI generator check passes (317 routes, 79 documented, 238 undocumented), and ESLint reports no problems in 1.
2.
3.
🤖 Resolution Details
System-triggered merge conflict resolution |
…s-nrj Automatically resolved merge conflicts after merging target branch into PR branch. Resolved conflicts in: - CHANGELOG.md - docs/static/openapi/propr-api.yaml - packages/api/mcp/tools.ts PR: #3500 Model: Claude Opus 5.5
|
/merge |
|
🔀 Resolved merge conflicts from Conflicting Files
Resolution SummaryThe resolution is done: no conflict markers remain anywhere in the repo, and the merged files typecheck cleanly. 99 of 101 tests in the related suites pass. The two failures are in plans and to-dos tests in Overall,
Checks run
🤖 Resolution Details
System-triggered merge conflict resolution |
…s-nrj Automatically resolved merge conflicts after merging target branch into PR branch. Resolved conflicts in: - CHANGELOG.md - docs/static/openapi/propr-api.yaml - packages/api/mcp/toolsAutomations.ts - packages/api/routes/automationDefinitionRoutes.ts - packages/client/src/generated/apiTypes.ts - packages/core/src/services/agents/agentDefinitionStore.ts - packages/core/src/services/agents/agentRunTrigger.ts - propr-ui/src/components/Agents/agentEditorForm.ts PR: #3500 Model: Claude Opus 5.5
|
After the merge with
Please fix both without changing behaviour and without disabling or relaxing either rule:
Then run |
|
✅ Applied the requested follow-up changes in commit aba2376 Summary of ChangesI fixed both lint warnings. What changed
Verification
This is an internal refactor with no visible change, so I didn't create any previews. 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
… warnings in `packages/core`, `packages/api` and the repository root, and the agent definition tests all pass. I fixed both lint warnings. `npm run lint` now reports zero warnings in `packages/core`, `packages/api` and the repository root, and the agent definition tests all pass. **What changed** - **New file `packages/core/src/services/agents/agentDefinitionNewRow.ts`.** It builds the row that `createAgentDefinition` inserts, using three small helpers: - `newContentColumns`: name, description, repositories, prompt, attachments, alias, model and extensions. - `newBehaviourColumns`: capabilities, previous reports, autonomy mode, event triggers and pause-when-unproductive. - `newScheduleColumns`: cron, timezone, enabled flags and `next_run_at`. `newAgentDefinitionRow(input, id, timestamp)` combines the three. Every default and serialisation step is the same as before. - **Also moved into that file:** `computeAgentDefinitionNextRunAt`, `statusError` and `SCHEDULE_TIMEZONE`, which the row builder needs. Keeping them there means the new module only imports types from the store, so there is no runtime import loop. - **`agentDefinitionStore.ts`:** `createAgentDefinition` now calls `newAgentDefinitionRow(input, randomUUID(), timestamp)`. The guard, transaction and event-cursor logic are unchanged. The store still exports `computeAgentDefinitionNextRunAt`, so the public exports (including the `export *` in `packages/core/src/index.ts`) are the same. Neither rule was disabled or relaxed. **Verification** - `npm run lint` in `packages/core`, `packages/api` and the root: no warnings or errors. - `packages/core` `npm run build` (`tsc`): clean. - `test/agentDefinitionStore.test.ts` and `test/agentDefinitionsContract.test.ts`: 34/34 pass. - `packages/api/test/agentDefinitionRoutes.test.ts`, run against the rebuilt core: 38/38 pass. This is an internal refactor with no visible change, so I didn't create any previews. PR: #3500 Comment by: @integry (ID: 6871484310) Model: Claude Opus 5.5
|
CI failed: Full Test Suite Shard 2/4 Please investigate and fix this CI failure.
Failure evidence
|
|
CI failed: Run Full Test Suite Please investigate and fix this CI failure.
Failure evidence
|
Full Test Suite ResultsValidation failed during: Test shard (shard 2).
View shard 2/4 outputDetails truncated; see the uploaded artifacts for complete failure rows and logs. |
|
ℹ️ Analyzed the follow-up request by @propr-dev[bot] Analysis SummaryI made no code change: this failure was a stalled test process, not a bug in the branch. The CI job needs to be re-run. What failed: Shard 2/4 ran 268 test files and 267 passed. The one failure was Why I don't think this is a code problem:
A pure function stopping mid-output like this points to the runner process stalling, most likely from contention on the shared CI host. A second attempt of that run (attempt 2) exists, but it was cancelled from outside before it finished, so it doesn't tell us anything either way. Next step: re-run the failed jobs of run 43555843138, or push to trigger a new run. If There is nothing visible to preview, so I didn't create any preview files. No code changes were necessary based on the current state of the branch. 🤖 Analysis Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
|
ℹ️ Analyzed the follow-up request by @propr-dev[bot], @github-actions[bot] Analysis SummaryI made no code change: the Why it isn't this PR:
My best guess at the mechanism, which I can't prove: the test runner hands its own output pipe straight to each test process. Node writes to a pipe synchronously, so if GitHub Actions stopped reading the log, the test process would freeze mid-write while the runner's timeout kept counting. The run's later attempts 2 and 3 were cancelled, not failed, so the suite hasn't actually been re-run yet. I didn't start a rerun myself. I saved this diagnosis to memory so a similar timeout is quicker to recognise next time. Nothing visible changed, so there are no previews. No code changes were necessary based on the current state of the branch. 🤖 Analysis Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
✅ Epic merged: Scheduler primitives: dependency edges, graph-aware epic queue, blocked-item hookEpic PR #3500 has been merged into main. 6 out of 6 PRs merged into main through this epic PR. All planned epic work is now merged. Posted automatically by ProPR |
Scheduler primitives: dependency edges, graph-aware epic queue, blocked-item hook
This Epic PR aggregates all changes for the plan: Scheduler primitives: dependency edges, graph-aware epic queue, blocked-item hook
Issues in this Epic
Auto-close
When this PR is merged, the following issues will be automatically closed:
Fixes #3470
Fixes #3471
Fixes #3472
Fixes #3473
Fixes #3474
Fixes #3475
Created automatically by ProPR