Skip to content

Milestone 4: parallel execution - scheduler, worktrees, integrator (Tasks 19-21)#7

Merged
inhaq merged 1 commit into
m3-persistencefrom
m4-parallel
Jun 13, 2026
Merged

Milestone 4: parallel execution - scheduler, worktrees, integrator (Tasks 19-21)#7
inhaq merged 1 commit into
m3-persistencefrom
m4-parallel

Conversation

@inhaq

@inhaq inhaq commented Jun 13, 2026

Copy link
Copy Markdown
Owner

This pull request was created by @kiro-agent on behalf of @inhaq 👻

Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro Web


Summary

Completes Milestone 4 (Parallel execution) — Tasks 19, 20, 21.

Stacked PR. Based on m3-persistence (PR #6) → m2-runners (#5) → task-13-role-binding (#4). Merge in order #4#5#6 → this. Targets m3-persistence so the diff shows only Milestone 4.

Task 19 — Dependency-graph scheduler (engine/scheduler.ts)

  • Runs tasks as a DAG with bounded concurrency (config.maxParallel); a task starts only once every dependency reaches an unblocking state, and dependents of an unsatisfied prerequisite are skipped transitively (nothing builds on a broken base).
  • Validates the graph up front (duplicate / missing / self refs, cycles) → fails fast instead of deadlocking.
  • session.runGoal now delegates ordering + parallelism to the scheduler (replacing the sequential pass), with seams for per-task workspaces and resume reuse.

Task 20 — Isolated worktrees (workspace/worktrees.ts)

  • GitWorktreeManager gives each concurrent task its own git worktree on a dedicated branch cut from a base ref, commits its changes for integration, and tears the worktree down. git is injected (workspace/git.ts) so it's unit-testable and verified for real.

Task 21 — Integrator (engine/integrator.ts)

  • Merges the per-task branches in a dedicated integration worktree (the repo checkout is never disturbed), in dependency order.
  • A conflicting merge is aborted and surfaced with its conflicting file paths rather than force-resolved (Req 9.4); clean merges proceed.
  • Runs full verification on the integrated tree. ok is true only when all merges were clean AND verification passed. Wired into runGoal behind opts.repoDir (+ config.useWorktrees).

Testing

  • npm run typecheck clean.
  • npm test: 119 passing (+13). Scheduler: ordering, parallelism-cap (peak ≤ max), transitive skip, resume reuse, graph validation. Worktrees + integrator run against real temp git repos: isolation, per-branch commit, clean multi-file merge + verification, and a real merge conflict surfaced with the offending file.

Note on end-to-end wiring

The worktree+integration path in runGoal is exercised at the module level with real git. A full runGoal end-to-end with worktrees needs a runner that actually writes files to the worktree (a real CLI/HTTP backend); the mock actors used in session tests don't touch the filesystem, so that combination isn't asserted here.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added parallel task execution with dependency-graph scheduling and configurable concurrency limits
    • Introduced isolated per-task git worktrees for independent task work with automatic branch management
    • Implemented automatic conflict detection during branch integration with detailed conflict reporting
    • Added full verification workflow for integrated changes
    • Enabled resume/checkpoint support to reuse prior task outcomes

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • '.*'

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ec746b79-2786-4b5b-b7fa-cb69045219fe

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch m4-parallel

Comment @coderabbitai help to get the list of available commands and usage tips.

…asks 19-21)

Task 19 - engine/scheduler.ts: dependency-graph scheduler. Runs tasks as a DAG
with bounded concurrency (config.maxParallel), starts a task only once deps are
unblocking, and skips dependents (transitively) of unsatisfied prerequisites.
Validates the graph up front (duplicate/missing/self refs, cycles). Seams for
per-task workspaces and resume reuse. session.runGoal now delegates ordering +
parallelism to it (replacing the sequential pass).

Task 20 - workspace/worktrees.ts: GitWorktreeManager gives each concurrent task
an isolated git worktree on its own branch (cut from a base ref), commits its
changes for integration, and tears the worktree down. git is injected
(workspace/git.ts) for testing.

Task 21 - engine/integrator.ts: merges the per-task branches in a dedicated
integration worktree, aborts + surfaces conflicts (with file paths) instead of
force-resolving, and runs full verification on the integrated tree. Wired into
runGoal behind opts.repoDir (+ config.useWorktrees).

Adds 13 tests (119 total), incl. real-git worktree + integrator suites;
typecheck clean.
@inhaq inhaq merged commit 725697d into m3-persistence Jun 13, 2026
2 checks passed
@inhaq inhaq deleted the m4-parallel branch June 13, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant