DL-024.7: DispatchGuard in dld-core - #49
Merged
Merged
Conversation
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
force-pushed
the
feat/dld-core-dispatch-guard
branch
from
August 27, 2026 13:22
3e7145a to
fbeb95e
Compare
jimutt
marked this pull request as ready for review
August 27, 2026 13:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
DL-024 item 7:
DispatchGuardin 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
DispatchGuard— pure, in-memory, no exec.guard.classify()returnsnew/redeliver/wedged/suppress,guard.record()tracks dispatches,guard.clearSession()on resume/pause/retry.sessionKeyvariable 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.