fix(framework): send-message.sh fail-loud submission verdict + regression tests (Patch 6) #895

Merged
Mos merged 2 commits from feat/send-message-failloud-verdict into main 2026-07-25 22:57:11 +00:00
Owner

Patch 6 — send-message.sh fail-loud submission verdict

Problem (reproduced against BASELINE before porting)

Delivery success was declared by the ABSENCE of a draft snippet on a prompt
line. If the ❯|^>|│ > glyph matched nothing (busy-receiver draft on an
unmatched line, or wrong-pane drift), an UNSUBMITTED message read as
✓ delivered exit 0 — a silent worker→lead relay stall.

Live-fleet symptom that motivated this: UC-LEAD PR #3046 — three review
verdicts reported "✓ delivered" but never surfaced to the busy lead for ~50
minutes.

Fix

Invert the default: success now requires positive evidence — either the
queued banner, or the REPL input box located AND clear of the message tail.
If the input box can't be located → status unconfirmedexit 2 + stderr
(could not confirm submission … may be UNDELIVERED). The near-dead *)
indeterminate default also flips from silently returning 0 to exit 2.
Bracketed-paste + double-Enter delivery mechanics are unchanged;
queued/draft/delivered semantics are preserved — only the failure-mode
default direction changes.

Adds the regression lock:

  • test-send-message-verdict.sh — 3 real tmux-pane fixtures (delivered /
    unconfirmed-glyphless / draft) that lock the fail-loud verdict logic.
  • test-send-message-socket.sh — fixture upgrade from a glyphless bash
    prompt to -prompt REPLs (required so the patched binary can read
    delivery positively).

Reproduce-first evidence

Ran the identical glyphless-pane fixture against the pre-patch framework
baseline and the patched version:

baseline: rc=0, stdout "✓ delivered to =noglyph"          (silent false positive)
patched:  rc=2, stderr "could not confirm submission on =noglyph: REPL input
                 prompt not locatable after 3 attempts — message may be
                 UNDELIVERED (check target/pane, retry, or escalate)"

Test results after port

test-send-message-verdict.sh -> PASS=3 FAIL=0
test-send-message-socket.sh  -> ok

Gates

  • grep -niE 'jason|woltje|jarvis' on changed files: 0 hits
  • tools/quality/scripts/verify-sanitized.sh packages/mosaic/framework: passed
  • shellcheck: 1 pre-existing SC2034 finding (unused loop var attempt),
    identical in the pre-patch baseline — 0 new findings

Part of #891

## Patch 6 — send-message.sh fail-loud submission verdict ### Problem (reproduced against BASELINE before porting) Delivery success was declared by the **ABSENCE** of a draft snippet on a prompt line. If the `❯|^>|│ >` glyph matched nothing (busy-receiver draft on an unmatched line, or wrong-pane drift), an **UNSUBMITTED** message read as `✓ delivered` exit 0 — a silent worker→lead relay stall. Live-fleet symptom that motivated this: UC-LEAD PR #3046 — three review verdicts reported "✓ delivered" but never surfaced to the busy lead for ~50 minutes. ### Fix Invert the default: success now requires **positive evidence** — either the queued banner, or the REPL input box located AND clear of the message tail. If the input box can't be located → status `unconfirmed` → **exit 2 + stderr** (`could not confirm submission … may be UNDELIVERED`). The near-dead `*)` indeterminate default also flips from silently returning 0 to exit 2. Bracketed-paste + double-Enter delivery mechanics are unchanged; queued/draft/delivered semantics are preserved — only the failure-mode default direction changes. Adds the regression lock: - `test-send-message-verdict.sh` — 3 real tmux-pane fixtures (delivered / unconfirmed-glyphless / draft) that lock the fail-loud verdict logic. - `test-send-message-socket.sh` — fixture upgrade from a glyphless bash prompt to `❯`-prompt REPLs (required so the patched binary can read delivery positively). ### Reproduce-first evidence Ran the identical glyphless-pane fixture against the pre-patch framework baseline and the patched version: ``` baseline: rc=0, stdout "✓ delivered to =noglyph" (silent false positive) patched: rc=2, stderr "could not confirm submission on =noglyph: REPL input prompt not locatable after 3 attempts — message may be UNDELIVERED (check target/pane, retry, or escalate)" ``` ### Test results after port ``` test-send-message-verdict.sh -> PASS=3 FAIL=0 test-send-message-socket.sh -> ok ``` ### Gates - `grep -niE 'jason|woltje|jarvis'` on changed files: **0 hits** - `tools/quality/scripts/verify-sanitized.sh packages/mosaic/framework`: **passed** - `shellcheck`: 1 pre-existing `SC2034` finding (unused loop var `attempt`), identical in the pre-patch baseline — **0 new findings** Part of #891
jason.woltje added 1 commit 2026-07-25 21:09:10 +00:00
Invert the delivery verdict from negative to positive evidence. Previously,
success was declared by the ABSENCE of a draft snippet on a prompt line: if
the `❯|^>|│ >` glyph matched nothing (busy-receiver draft on an unmatched
line, or wrong-pane drift), an UNSUBMITTED message read as "✓ delivered"
exit 0 — a silent worker->lead relay stall (filed by UC-LEAD, PR #3046:
three review verdicts reported delivered but never surfaced for ~50 min).

Fix: success now requires POSITIVE evidence — either the queued banner, or
the REPL input box located AND clear of the message tail. If the input box
cannot be located, status is `unconfirmed` -> exit 2 + stderr ("could not
confirm submission ... may be UNDELIVERED"). The near-dead `*)` indeterminate
default also flips from silently returning 0 to exit 2. Bracketed-paste and
double-Enter delivery mechanics are unchanged; queued/draft/delivered
semantics are preserved, only the failure-mode default direction changes.

Adds `test-send-message-verdict.sh`: 3 real tmux-pane fixtures (delivered /
unconfirmed-glyphless / draft) locking the fail-loud verdict logic, and
upgrades `test-send-message-socket.sh` fixtures from a glyphless bash prompt
to `❯`-prompt REPLs so the patched binary can read delivery positively.

Reproduce-first evidence (baseline vs patched, glyphless-pane fixture):
  baseline: rc=0, stdout "✓ delivered to =noglyph" (silent false positive)
  patched:  rc=2, stderr "could not confirm submission ... may be UNDELIVERED"

Test results after port:
  test-send-message-verdict.sh -> PASS=3 FAIL=0
  test-send-message-socket.sh  -> ok

Firewall: grep -niE 'jason|woltje|jarvis' on changed files = 0 hits;
tools/quality/scripts/verify-sanitized.sh -> sanitization gate passed.
shellcheck: 1 pre-existing SC2034 finding (unused loop var `attempt`,
present identically in baseline) carried through; 0 new findings.

Part of #891
Author
Owner

Record of Review — PR #895 (Patch 6: send-message.sh fail-loud verdict; Part of #891)

VERDICT: APPROVE (code merits; GO conditional on CI terminal-green).
Reviewer: independent subagent a9d3749b (ms-lead-reviewer), fresh clone, first-principles — ≠ builder (a12cc027, commit-author mosaic-coder).
REVIEWED-HEAD: 0f0fa7f1ea6f50d938ce4496abea715cf9808bad (confirmed unmoved throughout).

Per-criterion (all PASS)

  1. Scope — 3 files: send-message.sh (+27/-9), test-send-message-verdict.sh (new +74), test-send-message-socket.sh (+3/-3, fixture PS1 upgrade — required consequence of stricter logic, not scope creep).
  2. Invert correctness + FALSE-NEGATIVE check — default sentunconfirmed; success only via queued-banner OR glyph-located-AND-clear; *) catch-all now exit 2. Bracketed-paste + double-Enter submission mechanics byte-for-byte UNCHANGED (only the verdict-classification branch changed). Tested directly with real tmux panes: genuine -prompt delivery → rc0 delivered on BOTH baseline and patched (NO false-negative regression); only an unlocatable-glyph pane → unconfirmed/exit2 (intended fail-loud).
  3. Reproduce-first — independently reproduced on a self-built glyphless fixture: baseline rc0 "✓ delivered" (the silent bug) → patched rc2 + stderr "could not confirm submission … may be UNDELIVERED".
  4. Teststest-send-message-verdict.sh PASS=3 (3 real-pane fixtures exercise delivered/unconfirmed/draft distinctly); test-send-message-socket.sh ok.
  5. Gates — shellcheck 0 new (pre-existing SC2034 attempt identical on baseline); firewall jason|woltje|jarvis=0; verify-sanitized passed. Bonus: all 3 files BYTE-IDENTICAL to the battle-tested kit/live source — clean faithful port, zero drift.
  6. Provenance — commit-author mosaic-coder ≠ reviewer; body Part of #891.

Gate

CI at 0f0fa7f1 PENDING at review time (Woodpecker 2011 — genuine backlog wait behind 2009/2010 on a busy agent, not stuck). GO for id-11 CONDITIONAL on terminal-green. I relay on green (full-40 head); Mos stamps id-11 + merges. Non-executor.

# Record of Review — PR #895 (Patch 6: send-message.sh fail-loud verdict; Part of #891) **VERDICT: APPROVE** (code merits; GO conditional on CI terminal-green). **Reviewer:** independent subagent `a9d3749b` (`ms-lead-reviewer`), fresh clone, first-principles — ≠ builder (`a12cc027`, commit-author `mosaic-coder`). **REVIEWED-HEAD:** `0f0fa7f1ea6f50d938ce4496abea715cf9808bad` (confirmed unmoved throughout). ## Per-criterion (all PASS) 1. **Scope** — 3 files: send-message.sh (+27/-9), test-send-message-verdict.sh (new +74), test-send-message-socket.sh (+3/-3, fixture PS1 upgrade — required consequence of stricter logic, not scope creep). 2. **Invert correctness + FALSE-NEGATIVE check** — default `sent`→`unconfirmed`; success only via queued-banner OR glyph-located-AND-clear; `*)` catch-all now exit 2. **Bracketed-paste + double-Enter submission mechanics byte-for-byte UNCHANGED** (only the verdict-classification branch changed). Tested directly with real tmux panes: genuine `❯`-prompt delivery → `rc0 delivered` on BOTH baseline and patched (NO false-negative regression); only an unlocatable-glyph pane → unconfirmed/exit2 (intended fail-loud). 3. **Reproduce-first** — independently reproduced on a self-built glyphless fixture: baseline `rc0 "✓ delivered"` (the silent bug) → patched `rc2` + stderr "could not confirm submission … may be UNDELIVERED". 4. **Tests** — `test-send-message-verdict.sh` PASS=3 (3 real-pane fixtures exercise delivered/unconfirmed/draft distinctly); `test-send-message-socket.sh` ok. 5. **Gates** — shellcheck 0 new (pre-existing SC2034 `attempt` identical on baseline); firewall `jason|woltje|jarvis`=0; verify-sanitized passed. Bonus: all 3 files BYTE-IDENTICAL to the battle-tested kit/live source — clean faithful port, zero drift. 6. **Provenance** — commit-author `mosaic-coder` ≠ reviewer; body `Part of #891`. ## Gate CI at `0f0fa7f1` PENDING at review time (Woodpecker 2011 — genuine backlog wait behind 2009/2010 on a busy agent, not stuck). **GO for id-11 CONDITIONAL on terminal-green.** I relay on green (full-40 head); Mos stamps id-11 + merges. Non-executor.
Author
Owner

CI flake note (documented-flake-recovery, per Mos 2026-07-25): This PR's test-step failure is the PRE-EXISTING lease-broker test-harness race (issue #897), NOT a defect in this PR. recovery_b1_adversarial_unittest.py::wait_ready() polls for the socket FILE existing rather than the daemon reaching listen() → TOCTOU race → ConnectionRefusedError [111] under concurrent-pipeline runner load. Evidence: origin/main pipeline 2005 test=SUCCESS (1508/1508) on the parent commit; vitest passed 1508/1508 here too. Root fix in progress (#897, scalpel scope). Per Mos, a SERIALIZED single re-run is permitted as documented flake-recovery (not laundering). OB e945bf77. Note: #895 also hit a separate ci-postgres 'pods not found' K8s flake — same documented-re-run treatment.

**CI flake note (documented-flake-recovery, per Mos 2026-07-25):** This PR's `test`-step failure is the PRE-EXISTING lease-broker test-harness race (issue #897), NOT a defect in this PR. `recovery_b1_adversarial_unittest.py::wait_ready()` polls for the socket FILE existing rather than the daemon reaching `listen()` → TOCTOU race → `ConnectionRefusedError [111]` under concurrent-pipeline runner load. Evidence: origin/main pipeline 2005 `test`=SUCCESS (1508/1508) on the parent commit; vitest passed 1508/1508 here too. Root fix in progress (#897, scalpel scope). Per Mos, a SERIALIZED single re-run is permitted as documented flake-recovery (not laundering). OB `e945bf77`. Note: #895 also hit a separate ci-postgres 'pods not found' K8s flake — same documented-re-run treatment.
jason.woltje added 1 commit 2026-07-25 22:38:09 +00:00
Merge branch 'main' into feat/send-message-failloud-verdict
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
d093680b5f
Author
Owner

Delta Re-Review — PR #895 (Patch 6 send-message) after UPDATE-BRANCH — SUPERSEDES RoR 18770

VERDICT: APPROVE at new head (GO on CI terminal-green). Per Mos ruling (update-branch).
REVIEWED-HEAD: d093680b5f22 (was 0f0fa7f1). Reviewer: MS-LEAD (independent; ≠ builder mosaic-coder).
Delta scope — PASS: git diff 0f0fa7f1 d093680b -- send-message.sh test-send-message-{verdict,socket}.sh = EMPTY. Update-branch brought ONLY main-side commits (#898/#900 fixes); PR own code BYTE-UNCHANGED from approved head. PR net delta vs main = send-message.sh + 2 tests, identical to approved. Prior APPROVE (RoR 18770, incl the verified no-false-negative + byte-identical-to-battle-tested findings) carries forward.
CI: now runs at d093680b on the FIXED harness → deterministic. GO for id-11 at FULL-40 d093680b5f22... on terminal-green. Non-executor.

# Delta Re-Review — PR #895 (Patch 6 send-message) after UPDATE-BRANCH — SUPERSEDES RoR 18770 **VERDICT: APPROVE** at new head (GO on CI terminal-green). Per Mos ruling (update-branch). **REVIEWED-HEAD:** `d093680b5f22` (was 0f0fa7f1). **Reviewer:** MS-LEAD (independent; ≠ builder mosaic-coder). **Delta scope — PASS:** `git diff 0f0fa7f1 d093680b -- send-message.sh test-send-message-{verdict,socket}.sh` = EMPTY. Update-branch brought ONLY main-side commits (#898/#900 fixes); PR own code BYTE-UNCHANGED from approved head. PR net delta vs main = send-message.sh + 2 tests, identical to approved. Prior APPROVE (RoR 18770, incl the verified no-false-negative + byte-identical-to-battle-tested findings) carries forward. **CI:** now runs at d093680b on the FIXED harness → deterministic. GO for id-11 at FULL-40 `d093680b5f22...` on terminal-green. Non-executor.
Author
Owner

RoR full-40 head correction (per exact-head full-SHA rule; supersedes the abbreviated head in delta-RoR 18835): REVIEWED-HEAD (full 40) = d093680b5f22a2abd242b85e44dd7c4c368bcc0c. Delta re-review verdict UNCHANGED = APPROVE (PR-own code byte-identical to prior-approved 0f0fa7f1; update-branch brought only main-side #898/#900 fixes). GO for id-11 stamp + merge at this FULL-40 head on CI terminal-green. Non-executor.

**RoR full-40 head correction (per exact-head full-SHA rule; supersedes the abbreviated head in delta-RoR 18835):** REVIEWED-HEAD (full 40) = `d093680b5f22a2abd242b85e44dd7c4c368bcc0c`. Delta re-review verdict UNCHANGED = **APPROVE** (PR-own code byte-identical to prior-approved 0f0fa7f1; update-branch brought only main-side #898/#900 fixes). GO for id-11 stamp + merge at this FULL-40 head on CI terminal-green. Non-executor.
Mos approved these changes 2026-07-25 22:56:48 +00:00
Mos left a comment
First-time contributor

GO — Gate-16 id-11 stamp, pinned to exact FULL head d093680b5f.
Basis: verbatim RoRs 18835+18837 (supersede 18770) — delta re-review APPROVE after update-branch (PR code proven byte-identical to the previously-approved head; the update brought only main-side commits incl the #898/#900 harness fixes); CI terminal-green DETERMINISTIC at this head on the fixed harness. Prior substantive APPROVE carries forward per the supersession chain. Patch 6: send-message positive-evidence fail-loud verdicts (upstream form of the live-proven web1 fix). Part of #891 (b). Named executor: Mos (id-11), squash pinned.

GO — Gate-16 id-11 stamp, pinned to exact FULL head d093680b5f22a2abd242b85e44dd7c4c368bcc0c. Basis: verbatim RoRs 18835+18837 (supersede 18770) — delta re-review APPROVE after update-branch (PR code proven byte-identical to the previously-approved head; the update brought only main-side commits incl the #898/#900 harness fixes); CI terminal-green DETERMINISTIC at this head on the fixed harness. Prior substantive APPROVE carries forward per the supersession chain. Patch 6: send-message positive-evidence fail-loud verdicts (upstream form of the live-proven web1 fix). Part of #891 (b). Named executor: Mos (id-11), squash pinned.
Mos merged commit ab6e8e80dc into main 2026-07-25 22:57:11 +00:00
Mos deleted branch feat/send-message-failloud-verdict 2026-07-25 22:57:12 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#895