Repository navigation
Description
Reported by the shannon workspace's main architect (Amr-directed forward, 2026-08-31, three-part relay received complete); reviewed and filed by codev:main.
Defect
afx send can silently truncate long message bodies at delivery (the mailbox row stores the full body; what lands on the recipient's prompt is incomplete). The sender receives delivered with no error; the recipient has no marker that anything is missing. Both variants observed:
- Head-truncation: only the tail arrives; the recipient loses all framing. Worst confirmed case: a ruling arrived INVERTED in meaning (the part that negated the instruction was in the lost head), caught only because the sender re-read their own sent text.
- Probable tail-clip: body ends early.
Occurrence ledger (shannon workspace, six confirmed, three senders)
- ~2026-08-26T22:24Z, shapps architect → builder-pir-4596: two consecutive long rulings head-truncated.
- 2026-08-27 ~09:08Z, main architect → builder-air-3816: a 5-part instruction arrived as "item 5 + a fragment"; the builder's hold-and-ask discipline caught it.
- 2026-08-27, brand architect: three occurrences (receipts at shannon
codev/state/.brand.bak.mdlines 240/244/246): two clipped relays to builder-pir-4623 plus the inverted ruling to builder-pir-4625.
Every catch was behavioral (hold-and-ask, sender re-read). No mechanical detection exists. Raw receipts available from shannon:main on request.
Relation to known defects (same channel, distinct integrity failures)
- Mailbox: delivered-message wrappers carry no recipient field — deliveries are not self-attesting (rescoped from refuted misrouting report) #1543 tracks sender/recipient labeling in the wrapper (now 8+ occurrences per shannon, including two architect-to-architect label misroutes on 08-30). That defect corrupts attribution; this one corrupts CONTENT. Together they mean neither who-said-it nor what-was-said is currently trustworthy for long inter-agent messages.
- Sender-side clipping via shell substitution (inline backticks) is a separate, known operator-error class with the
--filediscipline as its mitigation; the ledger cases above are delivery-side (mailbox row complete, delivered text incomplete), which--filedoes not protect against.
Investigation leads (from a source skim, not conclusions)
- The delivery path has a documented race window after the render-gate sample:
mailbox-delivery.ts:392("if the screen advanced since we sampledtokenBefore, a draft may have started"). Longer bodies take longer to write, widening any post-verification race — consistent with the length correlation. - Head-loss specifically suggests early-written bytes being consumed by a recipient TUI state that had not settled, or input-buffer overflow dropping early chunks under a large single write. The write path (Spec 1365 routed the mailbox write edge through
submitToSession) should be audited for chunking/backpressure behavior on large bodies.
Ask
- Root-cause the delivery-side loss (write path chunking/backpressure + the post-gate race) rather than capping message size as a workaround.
- Mechanical integrity check regardless of root cause: after writing the body and BEFORE pressing Enter, verify the composed prompt content (length or hash) matches the intended body; on mismatch, do not submit — clear, re-hold the row with a reason, and return
held+integrityto the sender instead ofdelivered. This converts silent corruption into a visible hold, which is the mailbox-first contract's spirit. - If any legitimate hard limit exists (PTY, harness input), enforce it at SEND time with an explicit error/
heldreason, never by silent clipping — plus an explicit truncation marker in any degraded delivery mode that must exist. - Consider surfacing delivered-vs-stored length in the mailbox row (
delivered_bytes) for post-hoc auditability.
Interim practice (circulating in shannon, endorsed until fixed)
Short bodies; numbered multi-part sends; playback confirmation on load-bearing rulings. Codev-side senders should prefer --file for composition (existing discipline) plus part-numbering for anything long.
Activity
amrmelsayed commentedon Aug 31, 2026
Overlap note: open community PR #1492 (fixes #1365, serializer convergence at the terminal write edge) targets what is likely the primary mechanism behind this issue. Its documented failure mode is an interrupt/escape interleaving inside the delivery text-to-Enter window producing a FALSE delivered for text the agent never saw; a partial clear in the same window is exactly the head-truncation variant in the ledger above, and longer bodies widen the window (the observed length correlation). It also ships a degraded flag on the send response + sender-side warning, part of this issue's visibility ask. Residue this issue retains even if #1492 merges: the verify-composed-text-before-Enter integrity check (belt against ANY residual loss cause, not just interleaving) and delivered-vs-stored byte auditability. Any lane picking this up should start from #1492's plan Part 1 evaluation rather than re-deriving the write-edge model.
amrmelsayed commentedon Sep 2, 2026
Disposition from the tower contract seat (2026-09-03), verified by tag containment rather than recollection: the failure mode this issue describes is plausibly resolved in v3.3.2, and the issue now sits in verify-before-close.
What v3.3.2 ships against this defect
v3.3.2(merged 2026-09-01T11:19Z,c586a09). Removes the likely primary mechanism identified in the overlap note above: an interrupt/escape interleaving inside the text-to-Enter delivery window clearing part of the composer, which produces exactly the head-truncation variant; longer bodies widen the window, matching the observed length correlation.v3.3.2(35f2e63+4ed5904). Adds settle-before-write, a fail-loud local error for over-limit bodies, and echo-verification that the message header actually appeared on the recipient terminal. This is the mechanical detection this issue's ledger said did not exist: head-loss now results in a held row and redelivery instead of a silentdelivered. (tower: HOTFIX — echo-verify re-write loop re-injects a delivered message unboundedly (3.3.2 regression from #1573; zero re-writes after a completed write) #1584 subsequently capped the redelivery so a verify that fails systematically cannot loop.)Evidence alignment
Every confirmed occurrence predates v3.3.2: the six ledger instances here (2026-08-26/27) and the two 08-31 instances carried in #1583 item 3. The only post-3.3.2 datapoint is a 2026-09-02 "near-miss re-confirmed by resend" during the #1583/#1584 replay incident, which is not a confirmed truncation.
What close requires
A single confirmed truncation on >=3.3.3 reopens this as a live defect and warrants a fix lane; until then, no fix work is planned here because the shipped mechanisms already cover both the trigger and the detection.
amrmelsayed commentedon Sep 5, 2026
Out of verify-before-close: confirmed live on v3.3.3 (version receipts)
Report from the originating workspace's main architect (2026-09-05 03:19Z relay; reproducible, recipient-confirmed):
afx --version+codev --version), Tower daemon restarted 02:38Z from that install — 38 minutes before the case; sender and recipient on the same host/daemon.Two implications for the fix:
Counter-evidence context: same-day field verification on the same 3.3.3 stack (#1564, 2,344-byte architect→builder send) delivered intact and first-write verified — so the loss is state- or harness-dependent, not universal. Exact message bodies from both cases have been requested from the reporting workspace and will be attached when relayed.
Reported originally against this issue's own defect description; treating this as the live reproduction that verify-before-close was waiting to rule out. It rules it in.
amrmelsayed commentedon Sep 5, 2026
Specimens (verbatim, relayed from the reporting workspace's app architect)
codev#1567 truncation specimens — app architect, shannon workspace
Two confirmed truncated
afx senddeliveries. Bodies below are VERBATIM (copied from my session transcript at send time). Byte counts are as reported by the afx result line.Case 1 — 2026-09-03 ~04:34 UTC, to builder-bugfix-4711 (1101 bytes)
[ok] Message delivered to builder-bugfix-4711 (1101 bytes) (unverified — header not seen on the terminal)Body (verbatim):
Rulings on your three items: (1) persistence-race fix + regression test = accepted, good catch handling. (2) PRIVACY: scope the storage key by user id — REQUIRED. Persisted user content (titles + filePaths) is different in kind from the existing ephemeral global-keyed active-view idiom; cross-account surfacing on a shared device crosses the privacy-and-security meta-spec isolation intent, so match-the-idiom loses to the meta-spec here (meta-spec wins). Keep the widening minimal: user-id scoping ONLY, no sign-out clearing (leftover per-user data in storage is equivalent to other per-user cached state; if the security architect wants purge-on-signout that is a follow-up). Add the account-switch test. Do NOT touch the existing global-keyed active-view key — out of scope; note it in the PR body as an observed adjacent idiom for the security lane. (3) Switch to Refs #4711 — the issue stays open for deferred gap 2; I will annotate the issue with gap status after merge, no new tracking issue. Then do your ONE batched receipt-refresh + push and report; holding at gate per standing flow.
Case 2 — 2026-09-05 ~03:16 UTC, to builder-bugfix-2482 (1148 bytes)
[ok] Message delivered to builder-bugfix-2482 (1148 bytes) (unverified — header not seen on the terminal)Body (verbatim):
Decisions on all three: (1) FIX DIRECTION APPROVED — the content-size re-pin backstop mirrors two proven mechanisms (your own useKeyboardRepin from #3817 + web StickToBottomAutoFollow), and we do NOT defer live user-felt bugs to #2591 (still an eval, not a plan). Keep the pinned-guard pure function unit-testable as proposed; ensure the re-pin respects the freeze/drag guards so genuine scroll-up is never hijacked. (2) VERIFY = option (b), per the #3811 precedent: deterministic guard tests (pure shouldRepin cases + a coalescing-key-flip simulation at the data layer if feasible) + reasoning receipt in the PR — AND I am adding the on-device behavioral check to the owner device-session batch (Android item, Angela case) as the post-merge eyeball; state that split explicitly in your Verification section with which of the three verification-judgment factors drove it. (3) NO FENCE CONFLICT — bugfix-4790 is web-side (input/streaming path) and your fix is apps/native/components/chat-message-list.tsx + a hook; the shared agent-client types.ts is NOT in your touch set (the coalescing behavior itself is correct and stays). Proceed to fix.
Cross-case observations (sender side)
Analysis on top of the specimens (codev:main)
Interim guidance until fixed (adopted lane-wide by the reporting workspace, sensible everywhere): keep
afx sendbodies under ~1KB; treat any "unverified — header not seen" result as a probable tail-only delivery and resend in smaller parts. Note--filedoes not change delivery mechanics (the body still types into the terminal); the size bound is the operative protection.amrmelsayed commentedon Sep 7, 2026
Third independent specimen set (peer workspace's security architect, owner-directed report, 2026-09-07)
Three confirmed top-truncations on 2026-09-05, all deliveries to one builder, both sides 3.3.3 (single local install: Tower + sender CLI + receiver shellper). Receiver explicitly reported "arrived truncated at the top" each time.
New signal this set adds:
Their interim mitigation matches the standing guidance (short bodies) plus a mandatory readback loop — the readback discipline is worth stealing into the interim guidance here: sender asks the recipient to echo the first line.
(The same report carried a separate spawn-guard defect, filed as #1637.)
amrmelsayed commentedon Sep 8, 2026
New CONFIRMED truncation on 3.3.3, both sides — with a datum that lowers the assumed size bound.
Version receipts (per the standing rule): sender = shannon voice architect,
afx --version+codev --versionboth 3.3.3. Recipient = builder-pir-4884 (shannon workspace), self-reported codev 3.3.3 in its truncation report.Case: 2026-09-08 ~02:38Z.
afx send builder-pir-4884 '<review finding>'— body 969 bytes, single-quoted, no backticks/$(). Sender-side tell present:[ok] Message delivered to builder-pir-4884 (969 bytes) (unverified — header not seen on the terminal). Recipient (builder, in its own words): received ONLY the tail fragment"n. Re-request dev-approval after."preceded by the instruction footer — head loss, meaning-inverting class (the fragment reads like a decision tail; builder correctly refused to act on it).Datum of note: 969B is below the ~1.1KB working bound recorded from the 09-05 cases (and far below codev#1564's intact 2,344B counter-datum) — consistent with 'loss is state/harness-dependent', and it argues the safe bound for workspace practice is lower than 1KB, or that size isn't the controlling variable at all. Recipient's pane was mid-turn busy at send time (my immediate follow-up got
held (busy)), so 'send landing on a busy prompt' remains the live suspect for the controlling state.Recovery used (worked): short (<300B) pointer message to an on-disk file with the full content; builder read the file. The sender-side
unverified — header not seentell correlated with truncation again (now 6/6 in this workspace's ledger).amrmelsayed commentedon Sep 8, 2026
Forensic confirmation — the mechanism, caught in the recipient's PTY log (02:38Z case, voice dossier)
Executed the dossier's ask 1 against the recipient terminal's byte log (
1d00cc53…). Three findings, in log order around the injection:✻ Crunched for 22m 31s · done 12:38 pm(= 02:38Z) immediately precedes the injection. This is the busy-or-just-freed window every specimen set correlated with.❯ n. Re-request dev-approval after.+ the frame footer. The wrapper header and body head appear NOWHERE in the log at the injection (the first frame header in the log for this event is the 02:39:56 follow-up pointer message). Socket writes all succeeded, so the bytes reached the PTY and the TUI consumed them without rendering — the loss is inside TUI input capture, not the transport.message-write.ts: >3 lines → per-line writes at 10ms gaps, a af send: multi-line messages (>3 lines) treated as paste, final Enter swallowed #584-era design intended to AVOID paste classification) is being classified as a paste burst by the current claude TUI; the early lines are swallowed into the paste handling, the tail line + footer arrive after the burst window and type normally, and the trailing\rsubmits the visible fragment.Why now: the truncation ledger begins 2026-09-03 — the week Claude Code 2.1.25x rolled out. No codev delivery code changed then. The pacing constants were tuned against an older TUI's paste heuristic; the target moved.
Fix implications (upgrades the earlier direction):
header not seen⇒ treat as delivery FAILURE — auto-hold with the existing held-row machinery and retry on next clean gate — never[ok]+ tail-only. The Fix #1584: never re-write a mailbox row whose write completed #1585 point-of-no-return needs a carve-out: a write whose header verification failed is precisely NOT a completed delivery.\routside the bracket. Both testable against the repro: long body at a composer within ~seconds of turn end.waleedkadous commentedon Sep 8, 2026
Architect prescription (spawning a BUGFIX lane on this; design fixed here so no plan gate)
Amr's forensic comment above is the ground truth: the current Claude Code TUI (2.1.25x) classifies our per-line paced write as a paste burst, swallows the head into paste-collapse, and the tail line plus footer submit. The pacing constants were tuned against an older heuristic. Build in this order:
claudeTUI in a shellper, waits for a turn to end, and within ~1s sends a >3-line ~1 KB body through the production write edge (submitMessagePaced), 20 trials, recording head-intact vs head-lost from the PTY byte log. Evidence intocodev/evidence/1567-head-loss/. Do not touch the write edge until this reproduces the loss.ESC[200~+ body +ESC[201~in one write, a measured settle, then\ras a separate write outside the bracket. This replaces the >3-line per-line pacing (the af send: multi-line messages (>3 lines) treated as paste, final Enter swallowed #584-era design) for harnesses that support bracketed paste; keep the per-harnessMessagePacingseam so a harness can opt out. Measure the settle rather than guess it.[Pasted text #N +M lines], so the current header needle will not appear. The needle for a bracketed write is the placard (or whatever the harness actually renders; measure it), so a correct delivery no longer readsdelivered-unverified.codev/resources/commands/agent-farm.mdand itscodev-skeleton/mirror.Refs: #1564, #1521, #1583 (same class), #1573/#1584 (detection that shipped in 3.3.3), #584 (the original pacing).
waleedkadous commentedon Sep 8, 2026
On it! Working on a fix now.
[Bugfix #1567] Investigate: repro harness + evidence — 14/20 head-los…
Fix #1567: write long frames as one bracketed paste in ≤512-byte chun…
Fix #1567: CMAP round 1 — interrupt path honours the write strategy, …
[Bugfix #1567] Evidence: re-acceptance run after CMAP round-1 fixes —…
Fix #1567: CMAP round 2 — untrack raw PTY logs, trim evidence, handle…
[Bugfix #1567] Thread: CMAP round 3 codex APPROVE
Merge pull request #1644 from cluesmith/builder/bugfix-1567
[PIR cluesmith#1620] Re-derive the Kimi pacing seam onto the post-clu…
Merge origin/main into builder/pir-1201 (PIR cluesmith#1620)
[PIR cluesmith#1620] Fix the five suites the merge broke, and one it …
[PIR cluesmith#1620] arch.md: record the security gate, both Enter si…
[PIR cluesmith#1620] Test that pacing is WIRED, not merely resolvable
Merge origin/main into builder/pir-1473
[PIR #1473] Complete the hold vocabulary, and say what "input" actual…
[PIR #1473] CMAP on the landing commits: two overclaims of my own, an…
amrmelsayed commentedon Sep 9, 2026
New confirmed truncation specimen (standing version-receipt rule):
busy, mailbox idfbc5bed8-1b16-48e9-a111-ed8305e16bf9), then auto-delivered from the mailbox when the prompt cleared. Recipient (builder, explicit report) received head-loss to a footer fragment only ("ply: afx send architect ..."), no body. So the mailbox re-delivery path is affected, not just direct sends — consistent with the TUI paste-burst root cause (comment 5578373877): the delivery types into the terminal the same way regardless of whether it came from hold.Sender-side note: on the held path there is no "unverified — header not seen" tell available to the sender at all — the hold notice is the last thing the sender sees, so the failure is only detectable by recipient report. Strengthens the endorsed fix direction (header-not-seen ⇒ delivery FAILURE + auto-hold + retry) needing to cover mailbox re-delivery.
amrmelsayed commentedon Sep 9, 2026
Post-fix field verification (owner-directed, 2026-09-09 23:00–23:03Z)
PR #1644's write edge deployed to the production Tower via local-install (restart 23:00:15Z; dist verified to carry the chunked bracketed-paste code). Live confirmation pass across five architect terminals, using the exact failing class — single-paragraph direct bodies ≥1.4KB, no
--file:[ok], no unverified flag[ok], no flag[ok], no flag[ok], no flag[ok], no flag5/5 intact, 0 truncation tells — against a pre-fix ledger where the
(unverified — header not seen)flag accompanied 100% of losses and ~1.4KB bodies failed reliably (including two hits on this workspace's own traffic hours before the deploy, on the pre-fix Tower). Closure stands verified in the field, matching the PR's 0/20 harness result.