Files
magpie/internal/claudetui
yetone 4c6c3a453e claudetui: a reply is held from its message's row on, not from when send sees it (#6887)
TestShimCutMessageIsUnpastable (new in efb62fe90) was red on ubuntu and
macOS CI at a24a5f6af, 6cc7402bd and ac4a4cf84: a cut message's reply
got out, and its Unpastable error came after it.

The transcript's reader counts a message's row (sawRow) and goes
straight on to the reply's row and emits it. send only began holding
output (checkWhole's hold) once it woke and saw the count, so a reader
that got there first let the reply out before the message was checked
whole. On a busy Windows 10 machine the model got the cut tail and the
user got its answer, which is what the check is for.

sawRow now begins the hold itself while a message is being checked
(said isn't nil), on the reader's own goroutine, before any later row
is read. hold keeps a buffer sawRow began, and send lets out what is
held if it fails after a row was counted but before its check.

Run (mica; mote's load was 37 of 18 cores):
- the old code with time.Sleep(50ms) between send seeing the count and
  checkWhole: TestShimCutMessageIsUnpastable -count=3, red 3 of 3, the
  same output as CI's ("a cut message ended [init, assistant echo: er
  words … K-TAIL]").
- this change, the same 50ms injected: -count=5 ok; 500ms: -count=3 ok.
- injection removed: go test -race ./internal/claudetui -count=2 ok
  (380s).
- Windows (xiaomi-gpu, win-run): go test ./internal/claudetui: only
  TestShimFirstMessageWaitsForTools red, 3 of 3 the same at origin/main
  1c59acd36 (#4810, open).
Not run: the full suite, and a real Windows 10 console.
2026-11-17 01:33:13 +08:00
..