Skip to content

Pi adopts the DispatchGuard - #51

Draft
jimutt wants to merge 1 commit into
v1from
feat/pi-dispatch-guard
Draft

Pi adopts the DispatchGuard#51
jimutt wants to merge 1 commit into
v1from
feat/pi-dispatch-guard

Conversation

@jimutt

@jimutt jimutt commented Aug 27, 2026

Copy link
Copy Markdown
Owner

What

Pi adopts the DispatchGuard: bounded re-delivery and wedge detection in the continuation loop.

Why

DL-024 item 7's pi side. The loop's anti-spam was token + claim — effective against stale dispatches, but with no bound on re-delivery. An agent_end that doesn't advance the item re-dispatches identically forever, masked by the hidden followUp. The DispatchGuard (extracted in #49) now bounds it.

What changed

  • guard.classify("pi", dispatchKey) between the token check and the claim. First suppression re-delivers, second surfaces a wedge notification, further suppressions stay quiet.
  • invalidate() clears the guard — a resumed run dispatches fresh.
  • Two new tests: wedge path and invalidation-clears-guard.

Stacks on v1 (the merged DL-024 stack).

Test coverage

142 bun tests (2 new), 305 bats, tsc, tessl — all green.

DL-024 item 7, pi side. The pi loop's anti-spam was token + claim:
the token voids stale dispatches, and claiming the item before
dispatching means the next agent_end sees it as in-flight. But there
was no bound on re-delivery — an agent_end that doesn't advance the
item re-dispatches identically forever, masked by the hidden followUp.

Now the guard sits between the token check and the claim. First
suppression re-delivers once, second surfaces a wedge notification.
Invalidation clears the guard so a resumed run dispatches fresh.

Two new tests: the wedge path and the invalidation-clears-guard path.

All suites green: 142 bun, 305 bats, tsc, tessl.

Co-Authored-By: Kimi K3 <noreply@pi.dev>
Generated-By: pi 0.84.2
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