Repository navigation
Description
What
Evaluate — end to end — how afx send --interrupt (and --escape) interacts with the Spec 1313 gated mailbox-delivery path, then make whatever change the evaluation concludes is needed. The interaction is currently a patchwork of separately-reasoned decisions rather than one coherent, documented model:
- Immediate
--interrupttakes a per-terminal submission lock (session-submit.ts) and keeps its documented "claim-first" tradeoff. - Gated mailbox delivery takes a disjoint per-agent write serializer (
write-queue.ts, keyed byagentKey), so a gated delivery is not serialized against a concurrent interrupt/escape to the same terminal (the accepted boundary flagged insession-submit.ts). - Delayed
--interruptwas reshaped in the 1313 maintainer round so the timer fires only the Ctrl+C at due time and the body then delivers through the normal gated drainer after the turn ends.
The ask: confirm these three compose correctly (ordering, atomicity, no double-delivery, no silent drop, Invariant 2 holds), decide whether the disjoint-lock boundary should stay accepted or converge, and document the resulting model in one place.
Why
Interrupt vs mailbox delivery is exactly the seam where the "a body only ever lands on a verified-empty prompt, never force-injected" invariant is most likely to be violated, and it's currently reasoned about in three separate places with an explicitly-accepted race between two of them. A single deliberate evaluation (rather than incremental patching) is warranted before more send features (e.g. --interrupt-after) build on top of it.
Notes
- Serializer convergence: route mailbox write edge through submitToSession (serialize gated deliveries vs interrupt/escape) #1365 already proposes the concrete convergence fix (route the mailbox write edge through
submitToSessionso gated deliveries and interrupt/escape share the per-terminal lock, taken as a leaf inside the per-agent serializer → no lock-cycle hazard). This issue is the umbrella evaluation that should either ratify Serializer convergence: route mailbox write edge through submitToSession (serialize gated deliveries vs interrupt/escape) #1365 as the answer or supersede it — treat them as linked. - Cover the specific failure questions: can a gated delivery interleave between a Ctrl+C and the post-interrupt clean prompt? Does the delayed-interrupt reshape's "body delivers after the ^C" leave any window where the body lands mid-turn? Is escalation/held state consistent if the interrupt tears the session mid-write?
- Land the conclusion as an updated
session-submit.tsboundary comment + arch.md §mailbox note, whatever the decision. - Refs afx send: mailbox-first delivery — persist, gate on rendered-empty, never force-inject #1313 (PR [Spec 1313] afx send: mailbox-first delivery (never force-inject) #1330), Serializer convergence: route mailbox write edge through submitToSession (serialize gated deliveries vs interrupt/escape) #1365.
Activity
mohidmakhdoomi commentedon Aug 17, 2026
Consolidated into #1365 — the evaluation mandate here is now #1365's required first step ("Evaluate first" section): it either ratifies #1365's submitToSession convergence or supersedes it (in which case #1365 closes as wontfix with the analysis attached). #1365 survives as the anchor because it's referenced from
main(the Spec 1313 review doc and thread log). #1481 sequences after whatever model #1365 settles.