Skip to content

DL-024.4: CompletionTracker in dld-core - #46

Merged
jimutt merged 1 commit into
feat/dld-core-startrunfrom
feat/dld-core-completion
Aug 27, 2026
Merged

DL-024.4: CompletionTracker in dld-core#46
jimutt merged 1 commit into
feat/dld-core-startrunfrom
feat/dld-core-completion

Conversation

@jimutt

@jimutt jimutt commented Aug 27, 2026

Copy link
Copy Markdown
Owner

What

DL-024 item 4: CompletionTracker in dld-core — the four-part completion transaction (verify → review-nag or accept→repin→event → retry or block+pause) extracted from both harness loops into a single tested core class.

Why

The transaction was maintained twice by hand and had drifted: pi had no infrastructure branch, OpenCode had no pause-on-block, and the memoization (verifiedAtEvidence, reviewNagged) was per-harness. Now one implementation, one set of semantics, eight tests.

What changed

  • Core gains CompletionTracker with a step() method returning a discriminated-union CompletionOutcome.
  • Pi's loop.ts onTurnEnd drops ~90 lines → a switch over the outcome mapping to ui.notify + ui.card.
  • OpenCode's server.ts runCompletionTransaction drops ~100 lines → the same switch mapping to ctx.session.synthetic.
  • Empty verify output falls back to "verification failed" (block-item.sh rejects empty --reason).
  • Review-driven: fallback restored, both harnesses migrated.

server.ts 535→471, loop.ts 306→259. Stacks on #45.

Test coverage

124 bun tests (8 for CompletionTracker), 305 bats, tsc, tessl lint — all green.

@jimutt
jimutt force-pushed the feat/dld-core-completion branch from a59c90e to ed18d30 Compare August 27, 2026 11:41
@jimutt
jimutt marked this pull request as ready for review August 27, 2026 13:16
DL-024 item 4. The completion transaction (find verifying item with
new evidence → verify → review nag or accept→repin→event → retry or
block+pause) extracted from both harness loops into a single core
class. The tracker owns the memoization (verifiedAtEvidence,
reviewNagged) and returns a discriminated-union outcome the harness
renders.

Pi's loop.ts onTurnEnd drops from ~90 lines of inline transaction to
a switch over the outcome. OpenCode's server.ts runCompletionTransaction
drops from ~120 lines to the same. Both harnesses keep only delivery:
pi notifies + cards, OpenCode sends synthetic messages. The tracker's
blocked path pauses the run; the retry path clears OpenCode's dispatch
guard.

Empty verify output falls back to 'verification failed' — block-item.sh
rejects an empty --reason.

Eight new core tests pin the transaction. server.ts 535→471,
loop.ts 306→259. 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-completion branch from ed18d30 to c2a3605 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