Skip to content

DL-024.7: DispatchGuard in dld-core - #49

Merged
jimutt merged 2 commits into
feat/dld-core-bounds-pathsfrom
feat/dld-core-dispatch-guard
Aug 27, 2026
Merged

DL-024.7: DispatchGuard in dld-core#49
jimutt merged 2 commits into
feat/dld-core-bounds-pathsfrom
feat/dld-core-dispatch-guard

Conversation

@jimutt

@jimutt jimutt commented Aug 27, 2026

Copy link
Copy Markdown
Owner

What

DL-024 item 7: DispatchGuard in dld-core — the dispatch guard with bounded re-delivery extracted as a pure state machine.

Why

The guard was ~30 lines of inline bookkeeping in OpenCode's server.ts, untested. Extracted into a class with classify/record/clearSession/clear, with 8 tests pinning the DL-023 policy.

What changed

  • Core gains DispatchGuard — pure, in-memory, no exec.
  • OpenCode's server.ts adopts it: guard.classify() returns new/redeliver/wedged/suppress, guard.record() tracks dispatches, guard.clearSession() on resume/pause/retry.
  • The unused sessionKey variable removed (the guard computes it internally).

server.ts 471→456. Stacks on #48.

Test coverage

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

jimutt and others added 2 commits August 27, 2026 15:21
DL-024 item 7. The lastDispatch/redispatched/wedged trio from
OpenCode's server.ts extracted into a DispatchGuard class with a
classify/record/clearSession/clear API. The policy is unchanged:
first suppression re-delivers, second surfaces a wedge, never two
re-deliveries in a row.

OpenCode's server.ts adopts the guard — the inline bookkeeping
(~30 lines) is replaced by classify/record calls. Eight new core
tests pin the policy: new, redeliver, wedged, suppress, session
isolation, clearSession, clear.

server.ts 471→456. All suites green.

Co-Authored-By: Kimi K3 <noreply@pi.dev>
Generated-By: pi 0.84.2
…y/catch

- clearSession budget-restoration test extended (record → classify →
  expect redeliver)
- clearSession-after-wedge test added
- Prefix-matching session test added (s1 vs s12)
- Redeliver prompt wrapped in try/catch with clearSession on failure,
  matching the new-dispatch branch's error handling

Co-Authored-By: Kimi K3 <noreply@pi.dev>
Generated-By: pi 0.84.2
@jimutt
jimutt force-pushed the feat/dld-core-dispatch-guard branch from 3e7145a to fbeb95e Compare August 27, 2026 13:22
@jimutt
jimutt marked this pull request as ready for review August 27, 2026 13:50
@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