Skip to content

Docs: --wait-for-regex can match a prior-turn redraw - #71

Merged
0xLeif merged 2 commits into
mainfrom
docs/wait-for-regex-stale-redraw
Aug 19, 2026
Merged

Docs: --wait-for-regex can match a prior-turn redraw#71
0xLeif merged 2 commits into
mainfrom
docs/wait-for-regex-stale-redraw

Conversation

@0xLeif

@0xLeif 0xLeif commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

--wait-for-regex can return matched: true on a reprint of an earlier answer. Echo#repaint? only covers a copy of this send's input. A child that reprints scrollback, then works, then prints a new answer, puts the previous sentinel on the wire as ordinary new bytes.

Measured on current main (ruby -Ilib bin/rune), child reprints then sleeps 3s then prints DONE N:

send1  --wait-for-regex 'DONE \d+'   3.56s  matched=true   DONE 1
send2  --wait-for-regex 'DONE \d+'   0.56s  matched=true   DONE 1 only

DONE 2 was not in the captured output.

Two candidate rules were considered and not shipped:

  • reject if the match text existed before the send — loses a second echo DONE to a simple child
  • reject if CSI-home precedes the match — loses a TUI that paints a reused sentinel with cursor motion

Unique-per-turn sentinels wait through the reprint. That is the documented answer. A PendingSend example locks the workaround in so a later "fix" cannot lose it.

English docs/sessions.md no longer calls the flag deterministic. The nine translations are not updated here — English is authoritative; the in-language follow-up is a separate job.

ROADMAP.md is brought up to date: renderer row closed, half-painted --screen moved off the 1.0 blocker list.

CHG-0073 accepted. 611 examples, 0 failures. Lint clean.

Test plan

  • specsync change verify (611 / 0, lint, smoke)
  • hosted CI on this SHA
  • Claude review of the contract wording before merge

0xLeif added 2 commits August 18, 2026 18:10
CHG-0073's advice was overstated in two places, found on internal
review before merge:

- "the pattern cannot already be sitting in the child's visible
  history" was the wrong framing. `send` scans bytes emitted after
  the send-time cursor, not the rendered screen, so the correct
  condition is that the child will not emit the pattern again as a
  reprint of earlier output before this turn's answer.

- Pairing `child_busy` with a unique sentinel as an alternative
  safeguard was wrong. `child_busy` is `idle_ms < DEFAULT_SETTLE_MS`
  (800ms) on `read` — it goes false during a silent think that
  follows a reprint, before the real answer prints. A destination
  file the child writes is the other real check; `child_busy` is not.

Also corrects a duplicate CHG-0073 changelog row and a version number
that skipped 36 -> 38 instead of 36 -> 37.

CHG-0074, accepted, evidence: exact.
@0xLeif
0xLeif merged commit ebaec04 into main Aug 19, 2026
10 checks passed
@0xLeif
0xLeif deleted the docs/wait-for-regex-stale-redraw branch August 19, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant