Skip to content

DL-024.3: startRun in dld-core with rollback - #45

Merged
jimutt merged 1 commit into
feat/dld-core-lifecyclefrom
feat/dld-core-startrun
Aug 27, 2026
Merged

DL-024.3: startRun in dld-core with rollback#45
jimutt merged 1 commit into
feat/dld-core-lifecyclefrom
feat/dld-core-startrun

Conversation

@jimutt

@jimutt jimutt commented Aug 27, 2026

Copy link
Copy Markdown
Owner

What

DL-024 item 3: startRun(exec, root, args) in dld-core — the full start flow (reject-active → parse → guard → create → add items with rollback) extracted from both harnesses into core.

Why

The start flow was implemented twice with drift: OpenCode had the half-populated rollback, pi didn't. Both harnesses now call startRun and keep only the dispatch kick (pi: scheduleContinuation, OpenCode: ctx.session.prompt).

What changed

  • Core gains startRun returning StartOutcomeResult<{ slug, itemCount }>.
  • The rollback distinguishes failure modes: blocked-write success → "add the missing items manually"; blocked-write failure → "CRITICAL: the run is still ACTIVE and half-populated".
  • Pi's index.ts −25 lines, OpenCode's server.ts −65 lines. Six new core tests pin the flow.
  • Review-driven fixes: CRITICAL rollback branch restored, unused imports cleaned, tests added.

Stacks on #44 (async Exec) and the lifecycle PR.

Test coverage

124 bun tests (12 for run-api including startRun), 305 bats, tsc, tessl lint — all green.

@jimutt
jimutt force-pushed the feat/dld-core-startrun branch from 2069599 to 6a5fe0a Compare August 27, 2026 11:33
@jimutt
jimutt marked this pull request as ready for review August 27, 2026 11:54
DL-024 item 3. startRun(exec, root, args) in run-api.ts: reject when
a run is active, parse args, guard preconditions, create, add items —
with rollback to blocked on add-item failure so a half-populated run
never goes live. OpenCode's rollback behavior becomes canonical,
including the CRITICAL variant when the rollback itself fails.

Pi's index.ts start case drops ~35 lines. OpenCode's server.ts drops
~65 lines. Both keep only the dispatch kick.

Six new tests pin the start flow: reject-active, parse failure, guard
failure, happy path, rollback, and the double-failure CRITICAL path.

index.ts 367→342, server.ts 592→535. All suites green.

Co-Authored-By: Kimi K3 <noreply@pi.dev>
Generated-By: pi 0.84.2
Co-Authored-By: Kimi K3 <noreply@pi.dev>
Generated-By: pi 0.84.2
@jimutt
jimutt force-pushed the feat/dld-core-startrun branch from 6a5fe0a to 14348cb Compare August 27, 2026 13:21
@jimutt
jimutt merged commit 49d3007 into v1 Aug 27, 2026
2 checks passed
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