Skip to content

Schedule epic issues by dependency graph with a max_parallel limit enforced in code #3473

Closed

Description

@integry

Problem

An epic runs either strictly one issue at a time or everything at once. Independent issues wait behind unrelated ones in a sequential epic, and a parallel epic has no bound other than the request size. The parallel limit of an orchestrating goal is only a sentence in its prompt (#3385).

Goal

The epic queue computes which issues are ready from the dependency edges, starts up to max_parallel of them, and starts more as issues finish. Sequential and parallel become the two edge cases: a chain, and a graph with no edges.

Acceptance criteria

  • An execution can be started in graph mode: an issue is ready when every prerequisite recorded for it (from the plan's dependsOn) is merged into the epic branch. A prerequisite that is not part of the execution counts as satisfied only if it is already merged.
  • At most max_parallel issues of an execution are in flight at once. The limit is stored on the execution and enforced where issues are dispatched, with the same guarded writes as today, so concurrent advances, the reconcile sweep and a restart can never exceed it or dispatch an issue twice.
  • When an issue finishes, the queue starts every newly ready issue up to the limit. Ready issues start in publication order.
  • Existing modes are unchanged and expressed on the same engine: sequential is a chain with a limit of one, parallel is a graph without edges. A plan without dependsOn started without a limit behaves exactly as before, including which policy (merged or terminal) advances it.
  • MCP implement_plan and the REST implement route accept the graph mode and an optional maxParallel; the default is unchanged. Invalid combinations are rejected with a clear error.
  • An issue whose prerequisite is blocked or closed without merge stays pending, and the queue reports it as waiting on that prerequisite instead of starting it. Other branches of the graph keep running.
  • Downstream issues branch from the epic branch, so they contain their prerequisites' merged work. Stacked PRs are not introduced.
  • The execution completes when every issue is done or skipped, and finalization (epic PR handling) runs once.
  • get_plan, get_operation and the REST execution-queue response show, per issue, whether it is waiting on prerequisites (and which), ready, in flight, done or blocked, and the execution's mode and limit.
  • The Planner Studio issue list keeps working for graph executions: it must not present "first unmerged issue" ordering warnings for an execution that is not a chain.
  • Tests cover: a diamond graph (A, then B and C in parallel, then D), a limit lower than the number of ready issues, replenishment as issues merge, a blocked branch that does not stop an independent branch, restart in the middle (reconcile restores the right in-flight set without duplicates), concurrent advances at the limit, and unchanged behaviour for sequential and parallel executions.

Out of scope

  • Enforcing an orchestrating goal's maxParallelTasks through this queue (goals and plans are not linked today; note it in the docs as the follow-up).
  • Multiple models per issue in graph mode: keep the single-model rule of sequential epics.
  • Changing the repository-level limits.max_parallel_tasks admission, which stays an independent cap.

Implementation

Key files: packages/core/src/services/taskPlanning/epicExecutionQueue.ts (after the per-issue state refactor), packages/api/mcp/tools.ts (implement_plan: schema with epicExecution, epicAdvanceOn; the fan-out loop that starts every dispatchNow issue; permanent per-issue mcp_records issue_execution claims), packages/api/mcp/toolsPlanning.ts (planEpicDispatch: sequential requires one model and publication order), packages/api/routes/planIssueEpicQueue.ts (enqueueEpicImplementation, enqueueRemainingBehindRunning), packages/api/routes/planIssueHandlers.ts, packages/core/src/webhook/planIssueTrigger.ts (labelPlanIssueForProcessing applies base-<epicBranch>), packages/core/src/config/planIssueManager.ts (notifyEpicQueue on status changes), packages/core/src/webhook/planIssueTracking.ts (merge evidence is the persisted plan issue status), src/workerTaskStateRecovery.ts (sweep every 60 s, 100 queues per pass), propr-ui/src/components/TaskPlanner/usePlanIssuesManager.ts, SequentialWarningDialog.tsx, ExecuteAllBar.tsx, useExecuteAll.ts, propr-ui/src/api/planIssuesApi.ts.

Readiness and "what to start next" should be one pure function (issues, edges, per-issue states, limit) returning the issues to start, unit-tested on its own; the queue calls it inside the guarded dispatch. Move the parallel fan-out out of the tool loop into the queue so the limit applies to it.

Update docs/mcp.md (the epic execution section), docs/docs/features/mcp.md and the planning docs. Tests: the core epic queue tests and packages/api/test/mcpEpicDispatch.test.ts; UI tests next to the changed components. Verify with the standard commands.

Activity

  1. propr-dev commented on Nov 12, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-5-5
    • Branch: 3473/claude-opus-5-5-schedule-epic-issues-by-d-20261112-2304-xrj
    • Base Branch: 3470-epic-scheduler-primitives-nrj
    • Worktree: issue-3473-20261112-2304-claude-opus-5-5-xrj

    🔍 Track Task Execution

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions