acp pane: terminal handling: replay on resize, no wrapping live rows, hidden cursor, no echo, no login banner (items 2-4 of the user's brief) #86

Merged
city-root merged 2 commits from worker/rexcity-49ot9 into main 2026-11-12 15:44:17 +00:00
Contributor

Items 2, 3 and 4 of the brief on the acp pane (rexcity acp follow): terminal handling. Items 1, 5, 6, 7 and 8, the log lines and their colours, are the other bead's and are not touched. Work is on main at fd06139.

What changed

  • Resize (item 2). A size change clears the screen and lays out the tail of the log again at the new width, instead of abandoning the live rows. The tail is the last 32 KiB of the log, cut at an entry, which is a few screens. The replay reports nothing new to Rex, and bytes that arrive in the same write as the resize are laid out after it.
  • No wrapping live rows (item 2). The running rows are written between DECAWM off (ESC[?7l) and on (ESC[?7h). A row still too long for the terminal is cut at its edge and never becomes two. The cursor is hidden while the pane follows and shown again when it ends.
  • No echo (item 3). On a terminal the follower turns echo and canonical mode off on stdin, drains it, and restores the modes when it ends. SIGINT, SIGTERM and SIGHUP now cancel the follow, so the restore also runs on a signal. ISIG stays on, so ^C still ends it. The termios ioctl numbers for darwin and linux are in stdin_darwin.go and stdin_linux.go.
  • No login banner (item 4). Rex starts a split's program through login(1). rex.WithoutLogin makes Split send "login": false in the terminal block's options, and openPane asks for it for a view's pane only. Tui agents' panes and the city's declared panes are started as before, so the PATH the login shell gives them is unchanged. A tab's first pane is created by rex session new or rex window new, which start the program directly, so it never had a banner.

Decision left to the executor. The replay covers the tail of the log, not only what follows the last ━━ header. A screen after a resize then looks as it did before it. Splitting into several PRs was not needed: the three items are one change in one package, plus the one-option change in internal/rex.

Before and after

Each run is a real pty running rexcity acp follow (main's build, then this branch's) on a copy of ~/.rexcity/39545500/roles__worker-gcg-session-81c764ce….log. I copied the log elsewhere and appended a call that has been running for 12 s; nothing under ~/.rexcity was changed. The screens come from a small terminal emulator that honours autowrap and ESC[A, ESC[J, ESC[H and ESC[2J; the last rows are shown.

Item 2, resize 100 to 60 columns with a call running. Before, the live rows are duplicated and the rows above them keep the 100-column layout. After, the screen is cleared and drawn once at 60 columns.

before                                                   after
  ✓ Bash  cd /Users/mikluko/Forge/mikluko/gascity-…  1s    ✓ Bash  cd /Users/mikluko/Forge/mikluko/gas…  1s
  ✓ Bash  cd /Users/mikluko/Forge/mikluko/gascity-…  1s    ✓ Bash  cd /Users/mikluko/Forge/mikluko/gas…  1s
  ▷ Bash  running 1h09m                                    ▷ Bash  running 1h09m
  ▷ Bash  go test ./internal/... ./cmd/... -run Te…  14s   ▷ Bash  go test ./internal/... ./cmd/...…  15s
  ▷ Bash  running 1h09m          <- ghost
  ▷ Bash  go test ./internal/... ./cmd/...…  15s  <- ghost

The ▷ Bash running 1h09m row is a Skill call that has no end in this log. That is item 1 and is untouched.

Item 2, the pty says 100 columns and the terminal draws 41 (the winsize mismatch from the brief, not worked around beyond the cut). Before, the live rows wrap and ghost rows are left. After, each live row is one row, cut at the edge.

before                                    after
  ▷ Bash  running 1h10m                     ▷ Bash  running 1h10m
  ▷ Bash     go test ./internal/... ./cmd   ▷ Bash     go test ./internal/... ./cms
  ▷ Bash  running 1h10m          <- ghost
  ▷ Bash     go test ./internal/... ./cmd
/... -run TestSomething -count=1 -v 2>&1
| t…  running 14s                <- wrapped

Item 3, typing hello, the down arrow and ESC 4 into the pane.

before: b'hello^[[B^[4'     (echoed into the pane)
after:  b''

At rest the terminal's ECHO and ICANON are off while the follower runs and back on after SIGINT: (False, False) then (True, True).

Item 4, a split of the follower's pane in a scratch Rex session.

before (default split)                   after (login=false)
Last login: Thu Nov 12 13:35:25 …        ━━ acp roles__worker-gcg-session-81c764ce… · claudeacp ·…
━━ acp roles__worker-gcg-session-…       12:25:45 · gc started a session in /Users/mikluko/Forge/…
12:25:45 · gc started a session in …     12:25:45 ! time=2026-11-12T12:25:45.994+01:00 level=INFO …

Checks

  • go vet ./..., GOOS=linux go vet ./... and go test ./... pass.
  • REXCITY_LIVE_TESTS=1 go test ./internal/rex passes. It asserts that a default split shows the banner and a login=false one does not.
  • The changelog check (v1.6.0, offline) is valid. The note is under [Unreleased] in CHANGELOG.md. The README describes the replay, autowrap, cursor, input and login behaviour.
  • New tests:
    • resize replay on a screen emulator: one clear, no ghost, wrapped at the new width, a resize inside a write, no second status report;
    • the replay kept to the log's tail, cut at an entry, and an entry longer than the tail kept whole;
    • autowrap off then on, and the cursor hidden then shown;
    • terminalBlock with and without login;
    • the runtime asks for no login shell for a view's split only.
  • testdata/pane/demo_bytes.golden is regenerated: it now holds the cursor hide and show and the ?7l/?7h pairs.

Not done here

  • Rex: TIOCSWINSZ on split and resize, which is what item 2 says to file there. The terminal blocks I created by API report 80×24 with no client laid out. I have no tracker for Rex, so the Operator needs to forward this to Rex's authors.
  • claudeacp: send in_progress when execution starts (outside this repository).

Bead: rexcity-49ot9

Items 2, 3 and 4 of the brief on the acp pane (`rexcity acp follow`): terminal handling. Items 1, 5, 6, 7 and 8, the log lines and their colours, are the other bead's and are not touched. Work is on main at fd06139. ## What changed - **Resize (item 2).** A size change clears the screen and lays out the tail of the log again at the new width, instead of abandoning the live rows. The tail is the last 32 KiB of the log, cut at an entry, which is a few screens. The replay reports nothing new to Rex, and bytes that arrive in the same write as the resize are laid out after it. - **No wrapping live rows (item 2).** The running rows are written between DECAWM off (`ESC[?7l`) and on (`ESC[?7h`). A row still too long for the terminal is cut at its edge and never becomes two. The cursor is hidden while the pane follows and shown again when it ends. - **No echo (item 3).** On a terminal the follower turns echo and canonical mode off on stdin, drains it, and restores the modes when it ends. `SIGINT`, `SIGTERM` and `SIGHUP` now cancel the follow, so the restore also runs on a signal. `ISIG` stays on, so `^C` still ends it. The termios ioctl numbers for darwin and linux are in `stdin_darwin.go` and `stdin_linux.go`. - **No login banner (item 4).** Rex starts a split's program through `login(1)`. `rex.WithoutLogin` makes `Split` send `"login": false` in the terminal block's options, and `openPane` asks for it for a view's pane only. Tui agents' panes and the city's declared panes are started as before, so the PATH the login shell gives them is unchanged. A tab's first pane is created by `rex session new` or `rex window new`, which start the program directly, so it never had a banner. **Decision left to the executor.** The replay covers the tail of the log, not only what follows the last `━━` header. A screen after a resize then looks as it did before it. Splitting into several PRs was not needed: the three items are one change in one package, plus the one-option change in `internal/rex`. ## Before and after Each run is a real pty running `rexcity acp follow` (main's build, then this branch's) on a copy of `~/.rexcity/39545500/roles__worker-gcg-session-81c764ce….log`. I copied the log elsewhere and appended a call that has been running for 12 s; nothing under `~/.rexcity` was changed. The screens come from a small terminal emulator that honours autowrap and `ESC[A`, `ESC[J`, `ESC[H` and `ESC[2J`; the last rows are shown. **Item 2, resize 100 to 60 columns with a call running.** Before, the live rows are duplicated and the rows above them keep the 100-column layout. After, the screen is cleared and drawn once at 60 columns. ``` before after ✓ Bash cd /Users/mikluko/Forge/mikluko/gascity-… 1s ✓ Bash cd /Users/mikluko/Forge/mikluko/gas… 1s ✓ Bash cd /Users/mikluko/Forge/mikluko/gascity-… 1s ✓ Bash cd /Users/mikluko/Forge/mikluko/gas… 1s ▷ Bash running 1h09m ▷ Bash running 1h09m ▷ Bash go test ./internal/... ./cmd/... -run Te… 14s ▷ Bash go test ./internal/... ./cmd/...… 15s ▷ Bash running 1h09m <- ghost ▷ Bash go test ./internal/... ./cmd/...… 15s <- ghost ``` The `▷ Bash running 1h09m` row is a `Skill` call that has no end in this log. That is item 1 and is untouched. **Item 2, the pty says 100 columns and the terminal draws 41** (the winsize mismatch from the brief, not worked around beyond the cut). Before, the live rows wrap and ghost rows are left. After, each live row is one row, cut at the edge. ``` before after ▷ Bash running 1h10m ▷ Bash running 1h10m ▷ Bash go test ./internal/... ./cmd ▷ Bash go test ./internal/... ./cms ▷ Bash running 1h10m <- ghost ▷ Bash go test ./internal/... ./cmd /... -run TestSomething -count=1 -v 2>&1 | t… running 14s <- wrapped ``` **Item 3, typing `hello`, the down arrow and `ESC 4` into the pane.** ``` before: b'hello^[[B^[4' (echoed into the pane) after: b'' ``` At rest the terminal's `ECHO` and `ICANON` are off while the follower runs and back on after `SIGINT`: `(False, False)` then `(True, True)`. **Item 4, a split of the follower's pane in a scratch Rex session.** ``` before (default split) after (login=false) Last login: Thu Nov 12 13:35:25 … ━━ acp roles__worker-gcg-session-81c764ce… · claudeacp ·… ━━ acp roles__worker-gcg-session-… 12:25:45 · gc started a session in /Users/mikluko/Forge/… 12:25:45 · gc started a session in … 12:25:45 ! time=2026-11-12T12:25:45.994+01:00 level=INFO … ``` ## Checks - `go vet ./...`, `GOOS=linux go vet ./...` and `go test ./...` pass. - `REXCITY_LIVE_TESTS=1 go test ./internal/rex` passes. It asserts that a default split shows the banner and a `login=false` one does not. - The changelog check (v1.6.0, offline) is valid. The note is under `[Unreleased]` in `CHANGELOG.md`. The README describes the replay, autowrap, cursor, input and login behaviour. - New tests: - resize replay on a screen emulator: one clear, no ghost, wrapped at the new width, a resize inside a write, no second status report; - the replay kept to the log's tail, cut at an entry, and an entry longer than the tail kept whole; - autowrap off then on, and the cursor hidden then shown; - `terminalBlock` with and without login; - the runtime asks for no login shell for a view's split only. - `testdata/pane/demo_bytes.golden` is regenerated: it now holds the cursor hide and show and the `?7l`/`?7h` pairs. ## Not done here - **Rex:** `TIOCSWINSZ` on split and resize, which is what item 2 says to file there. The terminal blocks I created by API report 80×24 with no client laid out. I have no tracker for Rex, so the Operator needs to forward this to Rex's authors. - **claudeacp:** send `in_progress` when execution starts (outside this repository). Bead: rexcity-49ot9
fix: the acp pane redraws on a resize, ignores keys typed into it, and opens with no login banner (rexcity-49ot9)
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 10s
test / go (pull_request) Successful in 1m45s
981d321397
Items 2, 3 and 4 of the user's brief on the acp pane (rexcity acp follow), the
terminal handling; the log lines and their colours are the other bead's.

Resize (item 2). A width change used to abandon the running lines where the
terminal put them, so each resize left a "▷ ... running Ns" row above its own
"✓" line, and a row that wrapped broke the count of rows the cursor moves over.
The pane is a function of the log and the width, so a size change now clears the
screen and lays the tail of the log out again (the last 32 KiB, from an entry,
a few screens; the whole run is not kept) at the new width. The replay tells Rex
nothing new of the agent's status, and what a write brings with a resize is laid
out after it. The running lines are written between DECAWM off and on, so a row
still too long for the terminal is cut at its edge and never two rows; the
cursor is hidden while the pane follows and shown again by Flush. Decision left
to the executor: the replay covers the tail of the log, not only what follows the
last ━━ header, so a screen after a resize looks as it did before it.

Keys (item 3). On a terminal the follower puts stdin in non-canonical mode with
echo off (ISIG stays, so ^C still ends it), drains it, and restores the modes
when it ends, SIGINT, SIGTERM and SIGHUP included (they cancel the follow
instead of killing the process). termios goes through syscall, with the ioctl
numbers of darwin and linux in two small files.

Login banner (item 4). Rex starts a split's program through login(1), which
prints "Last login: ..." above the pane. rex.WithoutLogin makes Split send
login=false in the terminal block's options, and openPane asks for it for a
view's pane only: tui agents' panes and the city's declared panes are started as
before (their PATH comes from the login shell). A tab's first pane, which rex
new/window creates, is started directly and has no banner.

Validation: go vet and go test ./... ; REXCITY_LIVE_TESTS=1 go test ./internal/rex
(a default split shows the banner, a login=false one does not); the follower on a
copy of a log under ~/.rexcity/39545500/ in a pty resized from 100 to 60
columns, with keys typed into it, before and after (see the pull request).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
city-root-review requested changes 2026-11-12 13:03:20 +00:00
Dismissed
city-root-review left a comment

Review of 981d321397 for rexcity-49ot9. Checks of the head: success.

Verdict

fail

Findings

  • [blocking] CHANGELOG.md:10-14: the note is written into CHANGELOG.md under [Unreleased]. Since this branch was cut, main has #83 (83bb714), and main's REVIEW.md ("Changelog and releases") now says a pull request's note "goes in a fragment of its own, a new file in .changelog/, and never in CHANGELOG.md, which only a release writes". The work bead asks for a fragment once that change has merged, and it has. The head merges into main with no conflict, but the result breaks that rule. Fix: rebase onto main (83bb714), drop the CHANGELOG.md hunk, and put the three ### Fixed bullets in a new fragment, say .changelog/acp-pane-terminal.md, with nothing but the level-3 heading and its bullets.
  • [blocking] internal/acpbox/pane.go:268-276 (remember) and :282 (entryAtOrBefore): this regresses the linear-time property that 0.33.0's note promises ("a long word in the agent's text ... is wrapped in linear time and no longer freezes the pane") on exactly the pane that matters, a live terminal one. When one entry is longer than 2*replayTail, each 32 KiB write over that size runs entryAtOrBefore. It finds no entry start after from and scans back to the entry's start (O(n)), then append([]byte(nil), p.hist[0:]...) copies the whole buffer (O(n)). For an entry of n bytes that is O(n²/32 KiB). I measured it with a throwaway test (not committed) on a Live: true pane, writing one sentence holding a single word in 32 KiB pieces, as follow reads them. 2 MiB took 0.27 s on this head and 0.40 s on main. 8 MiB took 6.5 s here and 0.77 s on main. 16 MiB took 19.9 s here and 1.6 s on main. The pane freezes for that long, and hist keeps the whole entry. The existing TestAWordOfMegabytesIsCutAtTheWidthInLinearTime uses plainRig (not Live), so it cannot catch this. Possible fixes: track the offset of the last entry start as bytes arrive, so a trim never rescans. Or, when no entry begins at or after from, stop keeping more than a bound and mark the replay as starting mid-entry, or drop the oversized entry from hist. Either way, add the Live case to that test.
  • [minor] internal/acpbox/pane.go:307 (replay): the replay resets p.calls and re-reads only the last 32 KiB. A call whose ▷ start entry is older than that, such as a long go test while parallel calls or a long turn fill the log, loses its running row at a resize, though it is still running. Its end then has no registered call. It may be worth saying so in the README paragraph on the replay, or carrying the still-running calls across the replay.
  • [minor] internal/acpbox/pane_test.go:578: the second half of TestRunningLinesAreWrittenWithAutowrapOffAndItIsOnAgainAfterThem sets sc.nowrap = true by hand and feeds the emulator 45 x. That tests the test's screen emulator, not the pane. The first half (the ?7l…?7h pair around the live rows) is the real assertion.

Verified

  • Read the work bead (items 2-4 and the first decision), the PR description, main's REVIEW.md and README.md, and the whole diff (18 files, +580/-73): follow.go, pane.go, status.go, stdin*.go, rex.go, rpp tabs/view/runtime and their tests.
  • Item 2: on a size change Write and Idle replay the kept tail onto a cleared screen (ESC[H ESC[2J). Call start times come from the log's stamps, so running times survive the replay. track is muted while replaying, so no second OSC 7501 is sent. Live rows sit between ?7l and ?7h. The cursor is hidden at the first redraw and shown in Flush. All correct apart from the findings above.
  • Item 3: hushInput clears ECHO/ICANON/IEXTEN and keeps ISIG, drains stdin in a goroutine, and its deferred restore also runs on SIGINT/SIGTERM/SIGHUP through signal.NotifyContext. follow returns ctx.Err() at its poll and Follow maps context.Canceled to exit 0. The termios ioctls are right for darwin (TIOCGETA/TIOCSETA) and linux (TCGETS/TCSETS).
  • Item 4: rex.WithoutLogin puts "login": false only on the view's own Split, not on declared panes or a tui agent's pane. The fake Rex and TestAViewsPaneIsNoLoginShellAndNoOtherPaneIs cover this.
  • Merged the head into origin/main (83bb714): clean, no conflict. Forge says mergeable.
  • On the merged tree, with the city's variables removed (proved: 0): go vet ./..., GOOS=darwin GOARCH=arm64 go vet ./... and GOOS=linux go vet ./... pass, and go test ./... passes (all packages).
  • go test -race passes for internal/rex and internal/rpp and reports no data race in internal/acpbox. Its only failure there, the 1 s wall-clock bound of TestAWordOfMegabytesIsCutAtTheWidthInLinearTime under the race detector, fails the same way on main, so it is not this PR's.
  • The changelog check, built from changelog v2.0.1's source (-base main -warn missing-fragment) on the merged tree, gives valid=true and exit 0. The tool accepts a note in CHANGELOG.md; the first finding is REVIEW.md's rule, not the tool's.
  • The head's checks: success.
Review of 981d32139730333d004f42ec0a16511e8e8715b9 for rexcity-49ot9. Checks of the head: success. ### Verdict fail ### Findings - [blocking] CHANGELOG.md:10-14: the note is written into `CHANGELOG.md` under `[Unreleased]`. Since this branch was cut, main has #83 (83bb714), and main's `REVIEW.md` ("Changelog and releases") now says a pull request's note "goes in a fragment of its own, a new file in `.changelog/`, and never in `CHANGELOG.md`, which only a release writes". The work bead asks for a fragment once that change has merged, and it has. The head merges into main with no conflict, but the result breaks that rule. Fix: rebase onto main (83bb714), drop the `CHANGELOG.md` hunk, and put the three `### Fixed` bullets in a new fragment, say `.changelog/acp-pane-terminal.md`, with nothing but the level-3 heading and its bullets. - [blocking] internal/acpbox/pane.go:268-276 (`remember`) and :282 (`entryAtOrBefore`): this regresses the linear-time property that 0.33.0's note promises ("a long word in the agent's text ... is wrapped in linear time and no longer freezes the pane") on exactly the pane that matters, a live terminal one. When one entry is longer than `2*replayTail`, each 32 KiB write over that size runs `entryAtOrBefore`. It finds no entry start after `from` and scans back to the entry's start (O(n)), then `append([]byte(nil), p.hist[0:]...)` copies the whole buffer (O(n)). For an entry of n bytes that is O(n²/32 KiB). I measured it with a throwaway test (not committed) on a `Live: true` pane, writing one sentence holding a single word in 32 KiB pieces, as `follow` reads them. 2 MiB took 0.27 s on this head and 0.40 s on main. 8 MiB took **6.5 s** here and 0.77 s on main. 16 MiB took **19.9 s** here and 1.6 s on main. The pane freezes for that long, and `hist` keeps the whole entry. The existing `TestAWordOfMegabytesIsCutAtTheWidthInLinearTime` uses `plainRig` (not Live), so it cannot catch this. Possible fixes: track the offset of the last entry start as bytes arrive, so a trim never rescans. Or, when no entry begins at or after `from`, stop keeping more than a bound and mark the replay as starting mid-entry, or drop the oversized entry from `hist`. Either way, add the Live case to that test. - [minor] internal/acpbox/pane.go:307 (`replay`): the replay resets `p.calls` and re-reads only the last 32 KiB. A call whose `▷` start entry is older than that, such as a long `go test` while parallel calls or a long turn fill the log, loses its running row at a resize, though it is still running. Its end then has no registered call. It may be worth saying so in the README paragraph on the replay, or carrying the still-running calls across the replay. - [minor] internal/acpbox/pane_test.go:578: the second half of `TestRunningLinesAreWrittenWithAutowrapOffAndItIsOnAgainAfterThem` sets `sc.nowrap = true` by hand and feeds the emulator 45 `x`. That tests the test's screen emulator, not the pane. The first half (the `?7l`…`?7h` pair around the live rows) is the real assertion. ### Verified - Read the work bead (items 2-4 and the first decision), the PR description, main's `REVIEW.md` and `README.md`, and the whole diff (18 files, +580/-73): follow.go, pane.go, status.go, stdin*.go, rex.go, rpp tabs/view/runtime and their tests. - Item 2: on a size change `Write` and `Idle` replay the kept tail onto a cleared screen (`ESC[H ESC[2J`). Call start times come from the log's stamps, so running times survive the replay. `track` is muted while replaying, so no second OSC 7501 is sent. Live rows sit between `?7l` and `?7h`. The cursor is hidden at the first redraw and shown in `Flush`. All correct apart from the findings above. - Item 3: `hushInput` clears ECHO/ICANON/IEXTEN and keeps ISIG, drains stdin in a goroutine, and its deferred restore also runs on SIGINT/SIGTERM/SIGHUP through `signal.NotifyContext`. `follow` returns `ctx.Err()` at its poll and `Follow` maps `context.Canceled` to exit 0. The termios ioctls are right for darwin (TIOCGETA/TIOCSETA) and linux (TCGETS/TCSETS). - Item 4: `rex.WithoutLogin` puts `"login": false` only on the view's own `Split`, not on declared panes or a tui agent's pane. The fake Rex and `TestAViewsPaneIsNoLoginShellAndNoOtherPaneIs` cover this. - Merged the head into `origin/main` (83bb714): clean, no conflict. Forge says `mergeable`. - On the merged tree, with the city's variables removed (proved: 0): `go vet ./...`, `GOOS=darwin GOARCH=arm64 go vet ./...` and `GOOS=linux go vet ./...` pass, and `go test ./...` passes (all packages). - `go test -race` passes for `internal/rex` and `internal/rpp` and reports no data race in `internal/acpbox`. Its only failure there, the 1 s wall-clock bound of `TestAWordOfMegabytesIsCutAtTheWidthInLinearTime` under the race detector, fails the same way on main, so it is not this PR's. - The changelog check, built from changelog v2.0.1's source (`-base main -warn missing-fragment`) on the merged tree, gives `valid=true` and exit 0. The tool accepts a note in `CHANGELOG.md`; the first finding is `REVIEW.md`'s rule, not the tool's. - The head's checks: success.
mikluko force-pushed worker/rexcity-49ot9 from 981d321397
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 10s
test / go (pull_request) Successful in 1m45s
to a31b291a62
All checks were successful
test / changelog (pull_request) Successful in 4s
image / image (pull_request) Successful in 8s
test / go (pull_request) Successful in 1m43s
2026-11-12 14:34:43 +00:00
Compare
city-root-review left a comment

Review of a31b291a62 for rexcity-49ot9 (round 2, after review 221 on 981d321). Checks of the head: success.

Verdict

pass

Findings

  • [minor] PR description: it is stale after the rework. It still says "Work is on main at fd06139", "The changelog check (v1.6.0, offline) is valid" and "The note is under [Unreleased] in CHANGELOG.md". The note is now .changelog/acp-pane-terminal.md, the branch is on 51dffc8, and the description does not mention the new rule that an entry too long to fit twice the tail is dropped. Main's squash commits carry the title only, so history is unaffected. Fix: edit the description. That needs no new head.
  • [minor] internal/acpbox/pane.go:349-363 (trim): when an entry outgrows twice the tail, keep is almost always 0 in practice. While that entry was between 32 and 64 KiB, an earlier trim already cut hist down to the entry alone, so there is nothing before it left to keep. A resize in the middle of such an entry then clears the screen and draws only the rest of it, unstyled and cut with …. Earlier sentences are gone, and so is the line of a call still running. I checked this with a throwaway test: Before. and a running ▷ Bash #1, then a 150 KB sentence in 32 KiB pieces, then a resize. The README paragraph states the limitation for calls, and the case needs an entry over 64 KiB, so it is not blocking. The commit message's "A replay in the middle of such an entry lays out what was kept before it" overstates it. If it ever matters, keep the entries before a long entry when the trim first cuts at it.

Verified

  • Round 1's findings are all addressed:

    • The note is a fragment, .changelog/acp-pane-terminal.md: only ### Fixed and three bullets. CHANGELOG.md is untouched against main, and the branch is rebased onto main's tip, 51dffc8.
    • remember is linear now. Entry starts are recorded as bytes arrive (scan), so trim uses sort.SearchInts and never rescans. An entry over 2×32 KiB is dropped as it arrives (discard), and the capacity is bounded.
    • The README states what a replay does not carry.
    • The emulator-only half of the autowrap test is gone.
    • The Live case of the linear-time test exists as TestAWordOfMegabytesOnATerminalIsKeptForAReplayInLinearTime (16 MiB, 0.12 s here), plus TestKeepingTheTailOfAnEntryLongerThanItIsInLinearTime for the bookkeeping alone.
  • A throwaway randomized test (not committed) drove remember with 300 random logs. Entries were stamps, ▶ gc and ━━ heads, continuation lines and some entries up to 200 KB, written in chunks of 1 B to 40 KiB, 3,753 of the writes while dropping. After every write it checked four things:

    • every segment between two recorded starts is a whole entry of the log;
    • the bytes after the last start are the log's own;
    • no entry start in the scanned range is missed, including a stamp split across two writes;
    • replayed() begins at a recorded start, is no longer than the tail when an entry begins in it, and holds only whole entries while dropping.

    No violation.

  • I read the work bead (items 2-4 and the first decision), its round-1 note, the PR description, main's REVIEW.md and README.md, and the whole diff (18 files, +733/-73).

  • Item 2 is as reviewed in round 1. A resize replays the kept tail onto a cleared screen, and track is muted while replaying, so no second OSC 7501 is sent. Live rows sit between ?7l and ?7h. The cursor is hidden while following and shown in Flush.

  • Item 3: hushInput and the signal-cancelled context are unchanged. Item 4: rex.WithoutLogin applies to a view's own split only, as before.

  • Merged the head into origin/main (51dffc8): a fast-forward, clean. The forge says mergeable.

  • On the merged tree, with the city's variables removed (proved: 0), these pass:

    • go vet ./..., GOOS=darwin GOARCH=arm64 go vet ./... and GOOS=linux go vet ./...;
    • go test ./..., all packages;
    • go test -race -count=1 for internal/acpbox, internal/rex and internal/rpp;
    • the new acpbox tests, repeated with -count=3.
  • The changelog check, built from changelog v2.1.0's source with -base main -warn missing-fragment on the merged tree, gives valid=true, no warning, exit 0.

  • The head's checks: success.

Review of a31b291a625f92aab51282e773de9ea0915280dd for rexcity-49ot9 (round 2, after review 221 on 981d321). Checks of the head: success. ### Verdict pass ### Findings - [minor] PR description: it is stale after the rework. It still says "Work is on main at fd06139", "The changelog check (v1.6.0, offline) is valid" and "The note is under `[Unreleased]` in `CHANGELOG.md`". The note is now `.changelog/acp-pane-terminal.md`, the branch is on 51dffc8, and the description does not mention the new rule that an entry too long to fit twice the tail is dropped. Main's squash commits carry the title only, so history is unaffected. Fix: edit the description. That needs no new head. - [minor] internal/acpbox/pane.go:349-363 (`trim`): when an entry outgrows twice the tail, `keep` is almost always 0 in practice. While that entry was between 32 and 64 KiB, an earlier trim already cut `hist` down to the entry alone, so there is nothing before it left to keep. A resize in the middle of such an entry then clears the screen and draws only the rest of it, unstyled and cut with `…`. Earlier sentences are gone, and so is the line of a call still running. I checked this with a throwaway test: `Before.` and a running `▷ Bash #1`, then a 150 KB sentence in 32 KiB pieces, then a resize. The README paragraph states the limitation for calls, and the case needs an entry over 64 KiB, so it is not blocking. The commit message's "A replay in the middle of such an entry lays out what was kept before it" overstates it. If it ever matters, keep the entries before a long entry when the trim first cuts at it. ### Verified - Round 1's findings are all addressed: - The note is a fragment, `.changelog/acp-pane-terminal.md`: only `### Fixed` and three bullets. `CHANGELOG.md` is untouched against main, and the branch is rebased onto main's tip, 51dffc8. - `remember` is linear now. Entry starts are recorded as bytes arrive (`scan`), so `trim` uses `sort.SearchInts` and never rescans. An entry over 2×32 KiB is dropped as it arrives (`discard`), and the capacity is bounded. - The README states what a replay does not carry. - The emulator-only half of the autowrap test is gone. - The Live case of the linear-time test exists as `TestAWordOfMegabytesOnATerminalIsKeptForAReplayInLinearTime` (16 MiB, 0.12 s here), plus `TestKeepingTheTailOfAnEntryLongerThanItIsInLinearTime` for the bookkeeping alone. - A throwaway randomized test (not committed) drove `remember` with 300 random logs. Entries were stamps, `▶ gc` and `━━` heads, continuation lines and some entries up to 200 KB, written in chunks of 1 B to 40 KiB, 3,753 of the writes while dropping. After every write it checked four things: - every segment between two recorded starts is a whole entry of the log; - the bytes after the last start are the log's own; - no entry start in the scanned range is missed, including a stamp split across two writes; - `replayed()` begins at a recorded start, is no longer than the tail when an entry begins in it, and holds only whole entries while dropping. No violation. - I read the work bead (items 2-4 and the first decision), its round-1 note, the PR description, main's `REVIEW.md` and `README.md`, and the whole diff (18 files, +733/-73). - Item 2 is as reviewed in round 1. A resize replays the kept tail onto a cleared screen, and `track` is muted while replaying, so no second OSC 7501 is sent. Live rows sit between `?7l` and `?7h`. The cursor is hidden while following and shown in `Flush`. - Item 3: `hushInput` and the signal-cancelled context are unchanged. Item 4: `rex.WithoutLogin` applies to a view's own split only, as before. - Merged the head into `origin/main` (51dffc8): a fast-forward, clean. The forge says `mergeable`. - On the merged tree, with the city's variables removed (proved: 0), these pass: - `go vet ./...`, `GOOS=darwin GOARCH=arm64 go vet ./...` and `GOOS=linux go vet ./...`; - `go test ./...`, all packages; - `go test -race -count=1` for `internal/acpbox`, `internal/rex` and `internal/rpp`; - the new acpbox tests, repeated with `-count=3`. - The changelog check, built from changelog v2.1.0's source with `-base main -warn missing-fragment` on the merged tree, gives `valid=true`, no warning, exit 0. - The head's checks: success.
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
3 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/rexcity!86
No description provided.