Found in review of #16: pane views never read the terminal size, and smaller findings #67

Merged
city-root merged 2 commits from worker/gascitypacks-60o into main 2026-11-12 18:13:08 +00:00
Contributor

Fixes the findings of the review of #16 (bead gascitypacks-60o).

1. Terminal size (view.sh). view_size ran stty size <&1 inside $( ), where stdout is the substitution's pipe, so a terminal was never asked and the size came from COLUMNS/LINES alone: under bash 3.2 a view cut and capped nothing, under bash 5 a resize was picked up late. view_term now keeps the terminal as fd 3 when stdout is one, and view_size reads stty size <&3, which is the terminal inside $( ) too. Outside a terminal COLUMNS/LINES still answer.

2. gc mail peek --json -- "$id": an id starting with - is no option.
3. The fallback of view_note keeps its newline.
4. meta.jq's comment example names Alex Example, as the fixtures do; short in view.jq no longer uses rindex (bytes before jq 1.8) and works in characters.
5. The closed beads are read again every VIEW_CLOSED_INTERVAL seconds (default 300, was 30), and at once when a bead leaves the list. I took this as the fix for the 2.4 MB / 30 s read; say if you want it done another way (an incremental read would be new logic, see docs/shell.md).

No new shell logic: the changes are inside existing scripts (view.sh +4 lines, beads/run.sh +1).

Tests. tests/view/pty.sh runs a command on a pseudo-terminal with script(1) (util-linux's form for the CI, BSD's for the Mac), and both view tests use it: the beads screen at 51 columns with COLUMNS=200 set, a resize between two reads, the size inside $( ), the width of mail lines, plus the newline of the fallback, the -- of mail peek, short on non-ASCII names and the closed-interval re-read.

Verified on the Mac: tests/view-beads.sh and tests/view-mail.sh pass under bash 5.3 and /bin/bash 3.2, and under jq 1.6, 1.7.1 and 1.8.2; the new pty tests fail on the old view.sh under bash 3.2. shellcheck and gc lint . are clean. Not verified: the util-linux branch of ptyrun (no Linux container could start here: the init image is not local); the CI's scripts job is its first run.

A fragment is in .changelog/view-review-findings.md.

Bead: gascitypacks-60o

Fixes the findings of the review of #16 (bead gascitypacks-60o). **1. Terminal size (`view.sh`).** `view_size` ran `stty size <&1` inside `$( )`, where stdout is the substitution's pipe, so a terminal was never asked and the size came from `COLUMNS`/`LINES` alone: under bash 3.2 a view cut and capped nothing, under bash 5 a resize was picked up late. `view_term` now keeps the terminal as fd 3 when stdout is one, and `view_size` reads `stty size <&3`, which is the terminal inside `$( )` too. Outside a terminal `COLUMNS`/`LINES` still answer. **2.** `gc mail peek --json -- "$id"`: an id starting with `-` is no option. **3.** The fallback of `view_note` keeps its newline. **4.** `meta.jq`'s comment example names `Alex Example`, as the fixtures do; `short` in `view.jq` no longer uses `rindex` (bytes before jq 1.8) and works in characters. **5.** The closed beads are read again every `VIEW_CLOSED_INTERVAL` seconds (default 300, was 30), and at once when a bead leaves the list. I took this as the fix for the 2.4 MB / 30 s read; say if you want it done another way (an incremental read would be new logic, see `docs/shell.md`). No new shell logic: the changes are inside existing scripts (`view.sh` +4 lines, `beads/run.sh` +1). **Tests.** `tests/view/pty.sh` runs a command on a pseudo-terminal with `script(1)` (util-linux's form for the CI, BSD's for the Mac), and both view tests use it: the beads screen at 51 columns with `COLUMNS=200` set, a resize between two reads, the size inside `$( )`, the width of mail lines, plus the newline of the fallback, the `--` of `mail peek`, `short` on non-ASCII names and the closed-interval re-read. **Verified on the Mac:** `tests/view-beads.sh` and `tests/view-mail.sh` pass under bash 5.3 and `/bin/bash` 3.2, and under jq 1.6, 1.7.1 and 1.8.2; the new pty tests fail on the old `view.sh` under bash 3.2. `shellcheck` and `gc lint .` are clean. **Not verified:** the util-linux branch of `ptyrun` (no Linux container could start here: the init image is not local); the CI's `scripts` job is its first run. A fragment is in `.changelog/view-review-findings.md`. Bead: gascitypacks-60o
fix: the pane views read the terminal's size, and four smaller findings of the review of #16 (gascitypacks-60o)
Some checks failed
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 18s
test / scripts (pull_request) Failing after 24s
198797675a
view_size read the size with stty size <&1 inside \$( ), where stdout is the
substitution's pipe, so a terminal was never asked: the size came from COLUMNS
and LINES alone, which bash 3.2 does not set in a script (a view cut and capped
nothing) and bash 5 sets at its start and does not update (view mail took a
resize a line late). view_term now keeps the terminal as descriptor 3 when
stdout is one, and view_size reads it there, which is the terminal inside \$( )
as well. COLUMNS and LINES stay the answer where stdout is no terminal.

Smaller findings of the same review: gc mail peek takes the id after "--", so
an id that starts with "-" is no option; the fallback of view_note printed its
text with the newline tr had deleted; short in view.jq counted rindex in bytes,
which jq before 1.8 does, and is now a regex that works in characters; the
comment example of meta.jq names Alex Example, as the fixtures do. The closed
beads are read again every VIEW_CLOSED_INTERVAL seconds, 300, where it was 30,
and at once when a bead leaves the list: the day's closes were 2.4 MB of events
every 30 seconds on the city.

Tests: tests/view/pty.sh runs a view on a pseudo-terminal with script(1), the
CI's and the Mac's alike, and both view tests use it: the screen at 51 columns
whatever COLUMNS says, a resize between two reads, the size inside \$( ), the
width of mail lines. They fail on the old view.sh under /bin/bash 3.2. The
tests run under jq 1.6, 1.7.1 and 1.8.2 and under bash 3.2 and 5.3.

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

Review of 198797675a for gascitypacks-60o. Checks of the head: failure (test / scripts, run 176, job 4554).

Verdict

fail

Findings

  • [blocking] tests/view/pty.sh:292: the util-linux branch of ptyrun fails in CI, and test / scripts stops at tests/view-beads.sh (so tests/view-mail.sh never ran there). The job log reads FAIL: the size of a terminal is not read as it is now, in too: _: line 1: $.: command not found … _: line 1: 3n: ambiguous redirect … view_term: command not found. Cause: printf '%q ' quotes the multi-line script of the test at tests/view-beads.sh:183-186 with bash's $'…\n…' form, and util-linux script -c runs its command through $SHELL, or /bin/sh when that is unset. That is dash on the Ubuntu runner, and dash does not know $'…': the $ stays literal and \n becomes n, which is exactly the $. and <&3n of the log. I reproduced the mangling locally with dash -c on the same %q output. The one-line pty test just before it (tests/view-beads.sh:179) passed in CI, so the rest of the branch works. A fix: run SHELL="$BASH" script -qefc … in that branch, so the quoting is read by the bash that made it, or keep the arguments out of the -c string. Then let the CI's scripts job prove the util-linux branch, which the PR says was not verified.
  • [minor] README.md:556-561 (Pane views): VIEW_CLOSED_INTERVAL, which this PR adds, and the new 300-second re-read of the closed beads are in the changelog fragment and the script's header, but not in the README section that describes view beads.

Verified

  • I read the work bead (all five items, and the Operator's note: a fragment in .changelog/, no new shell logic, a PR description) and the PR description. Each item is addressed: fd 3 kept by view_term and stty size <&3 (item 1, with pty tests); gc mail peek --json -- "$id" (2); the fallback's newline (3); Alex Example, and short without rindex (4); VIEW_CLOSED_INTERVAL, default 300 (5). The changes stay inside existing scripts. main has no REVIEW.md, AGENTS.md or CLAUDE.md, and I read README.md.
  • The head merges cleanly into the current main (8a95663). Forge: mergeable.
  • On the merged tree, with the city's variables removed, on the Mac: tests/view-beads.sh and tests/view-mail.sh pass under bash 5.3.20 and /bin/bash 3.2, with jq 1.8.2. jq 1.6 and 1.7 were not available to me. Also passing: every other test of the CI's scripts and lint jobs (worktree-setup, worktree, gnu-tools, merge, handover, apply, upgrade, permission-deny, permission-request, formula, reviewer, operator-overlay), go vet ./..., go test ./..., gc lint . (2 packs ok), and shellcheck on the six changed shell files. The changelog check was not rebuilt locally; CI's test / changelog passed on this head.
  • The new short gives the same output as the one on main for a set of names: rig/agent, a dotted agent, a trailing dot, a leading dot, an empty name, a session suffix, nested /. Its non-ASCII case is covered by tests/view-mail.sh:233.
  • gc mail peek --json -- -abc parses the -- as cobra should: the error is "not in a city directory", not an unknown flag.
  • The run scripts use no other fd 3. view_term is called once, at the top level of both run.sh files (beads:53, mail:59).
Review of 198797675a217678de06c752b5310903e0530eec for gascitypacks-60o. Checks of the head: failure (`test / scripts`, run 176, job 4554). ### Verdict fail ### Findings - [blocking] tests/view/pty.sh:292: the util-linux branch of `ptyrun` fails in CI, and `test / scripts` stops at `tests/view-beads.sh` (so `tests/view-mail.sh` never ran there). The job log reads `FAIL: the size of a terminal is not read as it is now, in too: _: line 1: $.: command not found … _: line 1: 3n: ambiguous redirect … view_term: command not found`. Cause: `printf '%q '` quotes the multi-line script of the test at tests/view-beads.sh:183-186 with bash's `$'…\n…'` form, and util-linux `script -c` runs its command through `$SHELL`, or `/bin/sh` when that is unset. That is dash on the Ubuntu runner, and dash does not know `$'…'`: the `$` stays literal and `\n` becomes `n`, which is exactly the `$.` and `<&3n` of the log. I reproduced the mangling locally with `dash -c` on the same `%q` output. The one-line pty test just before it (tests/view-beads.sh:179) passed in CI, so the rest of the branch works. A fix: run `SHELL="$BASH" script -qefc …` in that branch, so the quoting is read by the bash that made it, or keep the arguments out of the `-c` string. Then let the CI's `scripts` job prove the util-linux branch, which the PR says was not verified. - [minor] README.md:556-561 (Pane views): `VIEW_CLOSED_INTERVAL`, which this PR adds, and the new 300-second re-read of the closed beads are in the changelog fragment and the script's header, but not in the README section that describes `view beads`. ### Verified - I read the work bead (all five items, and the Operator's note: a fragment in .changelog/, no new shell logic, a PR description) and the PR description. Each item is addressed: fd 3 kept by `view_term` and `stty size <&3` (item 1, with pty tests); `gc mail peek --json -- "$id"` (2); the fallback's newline (3); `Alex Example`, and `short` without `rindex` (4); `VIEW_CLOSED_INTERVAL`, default 300 (5). The changes stay inside existing scripts. main has no REVIEW.md, AGENTS.md or CLAUDE.md, and I read README.md. - The head merges cleanly into the current main (8a95663). Forge: `mergeable`. - On the merged tree, with the city's variables removed, on the Mac: `tests/view-beads.sh` and `tests/view-mail.sh` pass under bash 5.3.20 and `/bin/bash` 3.2, with jq 1.8.2. jq 1.6 and 1.7 were not available to me. Also passing: every other test of the CI's `scripts` and `lint` jobs (worktree-setup, worktree, gnu-tools, merge, handover, apply, upgrade, permission-deny, permission-request, formula, reviewer, operator-overlay), `go vet ./...`, `go test ./...`, `gc lint .` (2 packs ok), and `shellcheck` on the six changed shell files. The changelog check was not rebuilt locally; CI's `test / changelog` passed on this head. - The new `short` gives the same output as the one on main for a set of names: rig/agent, a dotted agent, a trailing dot, a leading dot, an empty name, a session suffix, nested `/`. Its non-ASCII case is covered by tests/view-mail.sh:233. - `gc mail peek --json -- -abc` parses the `--` as cobra should: the error is "not in a city directory", not an unknown flag. - The run scripts use no other fd 3. `view_term` is called once, at the top level of both run.sh files (beads:53, mail:59).
mikluko force-pushed worker/gascitypacks-60o from 198797675a
Some checks failed
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 18s
test / scripts (pull_request) Failing after 24s
to e73176708c
All checks were successful
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 21s
test / scripts (pull_request) Successful in 41s
2026-11-12 16:32:29 +00:00
Compare
city-root-review requested changes 2026-11-12 17:49:54 +00:00
Dismissed
city-root-review left a comment

Review of e73176708c for gascitypacks-60o. Checks of the head: success.

Verdict

fail

Findings

  • [blocking] The pull request does not merge into the current main (62ca905); the forge says not_mergeable. The branch is cut from 8a95663, and #73 (3316228, view beads shows a rig's work in flight) has since rewritten the same lines. Merging the head into origin/main conflicts in three files:
    • README.md:641 (Pane views): main inserts two paragraphs (--rig, the four signs of a bead in flight) before the paragraph this PR extends. Keep main's two paragraphs, and add this PR's VIEW_CLOSED_INTERVAL sentence to the paragraph after them.
    • roles/assets/jq/meta.jq:8: main's comment example now reads rigs: [{name, prefix, path}]. Keep main's path and this PR's Alex Example.
    • roles/commands/view/beads/run.sh:11: main's header adds "The same events give the verdicts of the review beads closed in the last day (assets/jq/reviews.jq)." Keep that sentence with this PR's new interval text. Note that since #73, read_closed (main's run.sh:86-91) also writes reviews.json, so VIEW_CLOSED_INTERVAL now paces the review verdicts too. A closed review bead leaves the list, so the "at once when a bead leaves the list" re-read still picks its verdict up straight away. Say so in the comment (or the README sentence) if you agree.
      A fix: rebase worker/gascitypacks-60o onto origin/main (62ca905 or later), resolve the three files as above, and run tests/view-beads.sh and tests/view-mail.sh again on the rebased tree. #73 changed both test files and their fixtures (tests/view/beads.want, beads.want.50, closed.jsonl). Only the three files above conflict textually, but the new pty test at tests/view-beads.sh:192 compares against beads.want.50, and #73 changed that file.

Verified

  • I read the work bead: its five items, the Operator's note, and the round 1 note that requires every finding of review 283 to be addressed and the branch rebased if main has moved. I also read the PR description and review 283. main has no REVIEW.md, AGENTS.md or CLAUDE.md. I read README.md.
  • Both findings of review 283 are addressed by e731767. The blocking one: tests/view/pty.sh:307 runs util-linux's script with SHELL="$BASH", so bash reads the %q quoting it made. The head's test / scripts job (run 227) passed, which runs tests/view-beads.sh and tests/view-mail.sh on the Ubuntu runner, so the util-linux branch is now proven. The minor one: README.md:561 names VIEW_CLOSED_INTERVAL and the 300-second re-read.
  • I read the whole diff against the merge base 8a95663: all five items of the bead are there, inside existing scripts, with a changelog fragment in .changelog/.
  • On the head, with the city's variables removed, on the Mac: tests/view-beads.sh and tests/view-mail.sh pass under bash 5 and /bin/bash 3.2. shellcheck is clean on the six changed shell files.
  • The head's checks: test / changelog, test / lint and test / scripts all passed.
  • The merge into origin/main (62ca905) stops on the three conflicts above, so I could not test the merged tree.
Review of e73176708c29049d3a0c5a35d7aa5372d705c1ce for gascitypacks-60o. Checks of the head: success. ### Verdict fail ### Findings - [blocking] The pull request does not merge into the current main (62ca905); the forge says `not_mergeable`. The branch is cut from 8a95663, and #73 (3316228, `view beads` shows a rig's work in flight) has since rewritten the same lines. Merging the head into origin/main conflicts in three files: - `README.md:641` (Pane views): main inserts two paragraphs (`--rig`, the four signs of a bead in flight) before the paragraph this PR extends. Keep main's two paragraphs, and add this PR's `VIEW_CLOSED_INTERVAL` sentence to the paragraph after them. - `roles/assets/jq/meta.jq:8`: main's comment example now reads `rigs: [{name, prefix, path}]`. Keep main's `path` and this PR's `Alex Example`. - `roles/commands/view/beads/run.sh:11`: main's header adds "The same events give the verdicts of the review beads closed in the last day (assets/jq/reviews.jq)." Keep that sentence with this PR's new interval text. Note that since #73, `read_closed` (main's run.sh:86-91) also writes `reviews.json`, so `VIEW_CLOSED_INTERVAL` now paces the review verdicts too. A closed review bead leaves the list, so the "at once when a bead leaves the list" re-read still picks its verdict up straight away. Say so in the comment (or the README sentence) if you agree. A fix: rebase `worker/gascitypacks-60o` onto origin/main (62ca905 or later), resolve the three files as above, and run `tests/view-beads.sh` and `tests/view-mail.sh` again on the rebased tree. #73 changed both test files and their fixtures (`tests/view/beads.want`, `beads.want.50`, `closed.jsonl`). Only the three files above conflict textually, but the new pty test at `tests/view-beads.sh:192` compares against `beads.want.50`, and #73 changed that file. ### Verified - I read the work bead: its five items, the Operator's note, and the round 1 note that requires every finding of review 283 to be addressed and the branch rebased if main has moved. I also read the PR description and review 283. main has no REVIEW.md, AGENTS.md or CLAUDE.md. I read README.md. - Both findings of review 283 are addressed by e731767. The blocking one: `tests/view/pty.sh:307` runs util-linux's `script` with `SHELL="$BASH"`, so bash reads the `%q` quoting it made. The head's `test / scripts` job (run 227) passed, which runs `tests/view-beads.sh` and `tests/view-mail.sh` on the Ubuntu runner, so the util-linux branch is now proven. The minor one: README.md:561 names `VIEW_CLOSED_INTERVAL` and the 300-second re-read. - I read the whole diff against the merge base 8a95663: all five items of the bead are there, inside existing scripts, with a changelog fragment in `.changelog/`. - On the head, with the city's variables removed, on the Mac: `tests/view-beads.sh` and `tests/view-mail.sh` pass under bash 5 and `/bin/bash` 3.2. `shellcheck` is clean on the six changed shell files. - The head's checks: `test / changelog`, `test / lint` and `test / scripts` all passed. - The merge into origin/main (62ca905) stops on the three conflicts above, so I could not test the merged tree.
mikluko force-pushed worker/gascitypacks-60o from e73176708c
All checks were successful
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 21s
test / scripts (pull_request) Successful in 41s
to 87100c0909
All checks were successful
test / changelog (pull_request) Successful in 4s
test / lint (pull_request) Successful in 24s
test / scripts (pull_request) Successful in 46s
2026-11-12 17:56:49 +00:00
Compare
city-root-review left a comment

Review of 87100c0909 for gascitypacks-60o. Checks of the head: success.

Verdict

pass

Findings

  • [minor] tests/view-beads.sh:387: the failure message "... in $( ) too: $size" is in double quotes, so bash runs $( ) as an empty command substitution and the message reads "in too". It only shows when the test fails. Fix: '$( )' in single quotes, or write "inside a command substitution".

Verified

  • I read the work bead (its five items, the Operator's note, and the notes of rounds 1 and 2), the PR description, and review 314 (round 2). main has no REVIEW.md, AGENTS.md or CLAUDE.md. I read the README's Pane views section.
  • The blocking finding of review 314 is fixed. The branch is rebased onto origin/main 0deb291, and the head fast-forwards it with no conflict. Every resolution is the one review 314 asked for. README.md:660 keeps main's two paragraphs (--rig, the four signs) and adds the VIEW_CLOSED_INTERVAL sentence after them, saying that the interval also paces the verdicts of the review beads. meta.jq:8 keeps path and has Alex Example. beads/run.sh:11-16 keeps main's reviews.jq sentence and says that a closed review bead leaves the list and is re-read at once.
  • I read the whole diff (10 files, +112/-22). It covers all five items of the bead and nothing unrelated. Every change is inside an existing script, apart from the test helper tests/view/pty.sh. The changelog fragment is in .changelog/.
  • I ran these on the merged tree (identical to the head), with the city's variables removed, on the Mac. tests/view-beads.sh and tests/view-mail.sh pass under bash 5.3.20 and /bin/bash 3.2.57. shellcheck is clean on the six changed shell files.
  • The new tests test the fix. With main's view.sh put back, view-beads.sh fails under both shells: the pty check at 51 columns (3.2), the size check inside $( ), and the newline of the fallback. view-mail.sh fails under 3.2: it draws a line of 142 columns on a 40-column pty.
  • short in view.jq gives the same output as main's rindex version under jq 1.8.2 on 16 names. These include the empty name, ., /, a.b., x/, a.b/c, nested rigs, a session suffix and non-ASCII names. A null input is still the empty name.
  • The head's checks test / changelog, test / lint and test / scripts all passed. The scripts job runs both view tests on the Ubuntu runner, so the util-linux branch of ptyrun is covered there.
Review of 87100c090904880cc90fbce2b6ffa576bd121776 for gascitypacks-60o. Checks of the head: success. ### Verdict pass ### Findings - [minor] tests/view-beads.sh:387: the failure message `"... in $( ) too: $size"` is in double quotes, so bash runs `$( )` as an empty command substitution and the message reads "in too". It only shows when the test fails. Fix: `'$( )'` in single quotes, or write "inside a command substitution". ### Verified - I read the work bead (its five items, the Operator's note, and the notes of rounds 1 and 2), the PR description, and review 314 (round 2). main has no REVIEW.md, AGENTS.md or CLAUDE.md. I read the README's Pane views section. - The blocking finding of review 314 is fixed. The branch is rebased onto origin/main 0deb291, and the head fast-forwards it with no conflict. Every resolution is the one review 314 asked for. README.md:660 keeps main's two paragraphs (`--rig`, the four signs) and adds the `VIEW_CLOSED_INTERVAL` sentence after them, saying that the interval also paces the verdicts of the review beads. `meta.jq:8` keeps `path` and has `Alex Example`. `beads/run.sh:11-16` keeps main's reviews.jq sentence and says that a closed review bead leaves the list and is re-read at once. - I read the whole diff (10 files, +112/-22). It covers all five items of the bead and nothing unrelated. Every change is inside an existing script, apart from the test helper `tests/view/pty.sh`. The changelog fragment is in `.changelog/`. - I ran these on the merged tree (identical to the head), with the city's variables removed, on the Mac. `tests/view-beads.sh` and `tests/view-mail.sh` pass under bash 5.3.20 and `/bin/bash` 3.2.57. `shellcheck` is clean on the six changed shell files. - The new tests test the fix. With main's `view.sh` put back, `view-beads.sh` fails under both shells: the pty check at 51 columns (3.2), the size check inside `$( )`, and the newline of the fallback. `view-mail.sh` fails under 3.2: it draws a line of 142 columns on a 40-column pty. - `short` in view.jq gives the same output as main's `rindex` version under jq 1.8.2 on 16 names. These include the empty name, `.`, `/`, `a.b.`, `x/`, `a.b/c`, nested rigs, a session suffix and non-ASCII names. A null input is still the empty name. - The head's checks `test / changelog`, `test / lint` and `test / scripts` all passed. The scripts job runs both view tests on the Ubuntu runner, so the util-linux branch of `ptyrun` is covered there.
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/gascitypacks!67
No description provided.