Repository navigation
Description
Problem
#1573 (PR #1577) made mailbox delivery hold a row when the message's header never appears on the receiving terminal, so a lost message is retried instead of being falsely reported delivered. That is the right direction of error — but nothing bounds the retrying.
If a harness is systematically unverifiable, every clean-gate pass writes the same message again, forever. The agent sees the instruction re-typed once per turn, and the row never resolves.
The known way to get there: a harness rendering on the alternate screen buffer (agy boots into it) has no scrollback, so a message longer than one viewport scrolls its own header out of reach and can never be confirmed. A second, narrower path compounds it: a very long write can evict the pre-write copy from the 1000-line mirror, so the occurrence count comes back equal rather than greater and a genuine delivery reads as unconfirmed.
#1573 assumed this would be loud rather than looping, because held rows escalate. Escalation is visibility only — markEscalated sets a flag and fires an SSE event; it does not stop the drainer from re-delivering. Two CMAP reviewers flagged the gap on PR #1577 and it is recorded there as a known residual.
Suggested fix
Bound the attempts. The obvious shapes, cheapest first:
- An in-process attempt counter in the delivery module (a
Mapkeyed by row id, pruned with the held set). After N unconfirmed writes, stop rewriting and leave the row held + escalated, or mark it delivered with a loud log. No schema change; lost across a Tower restart, which is acceptable for a bound. - An
attemptscolumn on themailboxtable — durable, but a migration.
Either way the choice to make explicitly is what happens at the bound: stop retrying and stay held (the agent may never get the message, but nothing is spammed) versus accept and mark delivered (at most N duplicates, then today's pre-#1573 behaviour, loudly logged). The sender is not misled either way — the afx send response already reports held on the first unconfirmed attempt.
Worth measuring agy's actual behaviour first: it was not measurable during #1573 (unauthenticated in that environment), so the headline trigger is inferred from its alternate-screen boot, not observed.
Activity
Fix #1573: fail locally on an over-limit body in afx refresh too
waleedkadous commentedon Sep 2, 2026
Superseded in urgency by #1583 (field loop at multiplicity 'dozens', trigger = any immediately-responding recipient, not just agy). The bound is being fixed as a hotfix in #1584 with the zero-re-write shape (option 'accept and mark delivered, loudly' at N=1 write). This issue stays open for the smarter-verification follow-up (scrolled-header tolerance, mirror eviction on long writes, agy alternate-screen measurement).
[Bugfix #1584] Docs: correct two comments that still described the pr…
waleedkadous commentedon Sep 2, 2026
Residuals recorded from PR #1585 (the #1584 hotfix — zero re-writes after a completed write), from its CMAP round-2 Claude review. All three are follow-up territory for this issue, not the hotfix:
Unverified-delivery notices are un-deduplicated. The hotfix adds a per-message
onUnverifiedDeliverynotification (a delivered row is invisible to every held-scoped surface, so theescalatedflag alone reaches nobody). On a harness that never echoes — the alternate-screen-buffer case this issue already tracks — that is one notification per message. Worth a per-agent/per-episode coalescer like the owner-starvation notice's.The double
verify()window would be more honest as a timeout parameter. For the livewatchEchoOnScreenbinding, two sequential 600 ms windows against the same pre-write sample are equivalent to one 1.2 s window; "a second look" describes the intent but not the mechanism. Averify(timeoutMs)would say what it does.droppedandpreemptedstill hold after bytes may have reached the wire. Neither is a completed write (droppedlost bytes mid-pace to a dead socket;preemptedmay have been cleared or truncated by an unserialized operator write), so re-holding them stays correct under the new contract — and unlike the echo residuals they are not self-sustaining, since both require an external event to recur. Recorded as a known residual rather than a bug.Smarter verification (scrolled-header tolerance, agy measurement) remains this issue's core scope.
[Bugfix #1664] Integration review: per-app capability, attribute dige…
[Bugfix #1664] Owner ruling: agy gets the mid-turn licence, unmeasured
amrmelsayed commentedon Sep 9, 2026
Verified: the defect this issue describes is structurally impossible in current code — closing with receipts
Verification run 2026-09-10 against main (post-#1585/#1644/#1604), per the owner's word.
The unbounded-rewrite loop is gone by architecture, not by tuning. The loop this issue asked to bound was: write completes → echo verification can't confirm → row re-held → every clean-gate pass writes the same message again, forever. Post-#1585, a completed write is the point of no return; and the current delivery path (
mailbox-delivery.ts:1236) demotes echo verification to "pure REPORTING, downstream of a delivery that is already committed" — its own comment statesfalsemeans "could not confirm", never a trigger. An unverified delivery is committed, flagged (markEscalatedDelivered), surfaced once viaonUnverifiedDelivery, and "NOT re-written (Issue #1584)" — verbatim from the code. There is no code path from verification failure back to a write.The parked #1585-CMAP residuals are addressed. Un-deduplicated unverified notices: the escalation is computed once per delivery (raced-and-unechoed escalates exactly once, per the #1473 comment block) and fires one notification per row; rows never redeliver, so there is no repeat source.
The systematically-unverifiable-harness premise also shrank. The verification needle now matches the header or a paste placard, and #1644 writes long frames as chunked bracketed pastes (≤512B pieces) — the alt-screen taller-than-viewport case at worst yields one flagged unverified delivery, never a loop.
bugfix-1567-bracketed-paste-write.test.ts: 17/17 passing locally.Reopen trigger, should it ever fire: any observed second write of the same mailbox row id.