Found in review of #68: the acp view passes control characters through, and six smaller findings #93
No reviewers
Labels
No labels
No milestone
No project
No assignees
3 participants
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/rexcity!93
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/rexcity-ndhl1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes the seven findings the reviews of #68 left (bead rexcity-ndhl1), and the four notes of the second review.
What changed
␛for ESC), where only inputs did. Agent text lines after the first are indented 2 spaces and a first line that begins like an entry gets a space, so no line an agent writes reads as a box entry, however the adapter cuts chunks.rexcity acp followdrops the indent when it lays a sentence out.hushInput: raw mode without echo, SIGINT/SIGTERM/SIGHUP end it with status 0, terminal and cursor put back), so this change keeps none of its own. Only SIGQUIT is added to main's signal context: Ctrl-\ on a hand-run pane otherwise reaches Go's default handler, which dumps the goroutines and leaves the terminal raw.OpenViewchecks the context before placing the pane, then lets the placing finish whatever the context says (the caller's deadline still applies), so the wrapper's cancel at exit cannot killrexbetween the split and its reply.<name>.log.1when a run starts; a start removes acp logs nothing has written to for 30 days (only files that begin with━━ acp, none whose name has a view). A run's own log is never cut while written: the pane follows it.rexcity acp --smoke-image.shruns the same turn throughrexcity acp -- rexcity acp claude …withREXCITY_BOX=processand checks the stream and the log.TestTheAdapterNeverOutlivesTheWrapperleaves a processt.Cleanupkills the recorded pid when the test failed; the fake sleeps a minute, not an hour.claude-proxy, not the box's name. Also notes that a second city tab starts the declared panes twice.ps lstarttext follows TZ/LANGproc.StartTimerunspswithTZ=UTC LC_ALL=Cand prefixesutc. A record an earlier version wrote (no prefix) is compared as that version read it (LegacyStartTime), so nothing running is taken for dead at the upgrade.views/belongs,null/{}views/replaced if it is not a directory; a record with no block is no view.<name>.jsonfails every start and stopHow it was checked
go vet ./...(linux and darwin),gofmt,go test ./...with a failingrexstub first onPATH,go test -raceonacpbox,rpp,state,cmd/rexcity; the changelog check (v2) exits 0 with the fragment.changelog/acp-box-review-findings.md.pgrep).rexcity-acp-clientand a fake adapter withREXCITY_BOX=process: stream, log header,▷/✓/■entries as the smoke step greps them.Not run here
imagejob of this pull request runs it for real (internal/is touched); it greps▷ .* #1,✓ .* #1 (and■ end_turnrather than the tool's name, since the adapter may name the call by its title.Notes for the reviewer
→,■,?,!and the like (● → …): the space that sets it apart.mainoutside #68; it is in because the bead lists it.Rebased onto main
2ff3907(rework)The head no longer merged after #86. Rebased, nothing else changed. Dropped because main already carries it: the follower's terminal handling (
quietTerminal, theterm_*.gofiles,isTerminal, theFollow/follower(ctx)split, ignoring Ctrl-C and Ctrl-Z, their test, their README sentence and changelog bullets). Main keeps the interrupt key's meaning, which this change had altered. Kept on main's code: SIGQUIT in the live pane's signal context, with its changelog bullet. Merged by hand with both sides kept:internal/rpp/view.go(cancel shield andopenPane(..., true)),internal/rpp/fake_test.go,internal/rpp/view_test.go,internal/acpbox/pane_test.go, two README bullets. Re-run on the rebased head:gofmt,go vet ./...,go test ./...,go test -raceon acpbox, rpp, state and proc, changelog checkvalid=true. The pty check above no longer applies, since that code is main's.Bead: rexcity-ndhl1
The reviews of rexcity#68 left seven non-blocking findings and four notes (rexcity-ndhl1). This closes all of them. The log. Control characters of everything the renderer writes (agent text and thinking, prompts, plan entries, tool names and titles, permission options, the fields of a few one-line entries) now show as pictures, as an input's already did. Agent text is set apart from the box's own entries: the lines of a run after its first are indented two spaces, and a first line that begins like an entry gets a space before it, so no line of what an agent says reads as "→ permission allow_once (Yes)", whatever it says and however the adapter cuts its chunks. The pane drops the indent when it lays a sentence out. The log is bounded: a log over 8 MiB is set aside as <name>.log.1 when a run starts, and a start removes the acp logs nothing has written to for 30 days (only a file that begins with the log's header, and no log whose name has a view). The follower. On a terminal it stops the echo of typed keys, ignores Ctrl-C and Ctrl-Z, which left a dead pane while the agent ran, and puts the terminal back as it ends; Ctrl-\ still ends one run by hand. It ends on SIGTERM: main took the signal into a context Follow never got. --raw leaves the terminal alone. The view's lifecycle. OpenView lets an opening that has begun to place the pane finish, whatever its context says, so that the wrapper's cancel at exit cannot kill a rex between the server's split and its reply and leave a pane no record names; the caller's deadline still bounds it. A view file that cannot be read, holds null or {}, or a file or link where views/ belongs no longer fails every later start. An empty <name>.json is no record. A start time is recorded in UTC and the C locale (proc.StartTime), so a TZ or LANG in an agent's env no longer makes its view's wrapper read as another process; a record an earlier version wrote is still compared as that version read it. Tests and CI. TestTheAdapterNeverOutlivesTheWrapper kills its fake adapter in a Cleanup when it fails. The image smoke runs rexcity acp -- around the same turn as rexcity acp claude, with REXCITY_BOX=process, and checks the stream and the log. The older README section no longer says gc answers nothing, and no longer shares a provider name with the box's. Validation: go vet (linux, darwin), gofmt, go test ./... with a failing rex stub first on PATH, -race on acpbox, rpp, state and cmd/rexcity; the changelog check v2; the follower on a real pty (no echo, ^C and ^Z ignored, SIGTERM exits 0); the box against rexcity-acp-client and a fake adapter. New tests were checked against mutations (the cancel shield, the legacy start-time fallback, the adapter cleanup). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>Review of
f14f00f1f2for rexcity-ndhl1. Checks of the head: success.Verdict
fail
Findings
[blocking] internal/rpp/view.go:118 and :131: the cancel shield of item 3 covers only
openPane. The work that follows it still gets the cancelledctx.proc.StartTimerunspsthroughexec.CommandContext, so on a cancelled context it returnsps lstart: context canceled(checked). The view is then saved withRootPID=0andRootStart="", andwrapperAlivekeeps such a record forever ("never taken for stale"). Reproduced with a scratch test,TestACancelDuringTheOpeningStillRecordsTheView's setup with a fakeStartTimethat returnsctx.Err()as the real one does: the record holdsRootPID=0 RootStart="". Two consequences:OpenTimeoutis 20 s andCloseTimeout10 s. An opening still running 10 s after the adapter exits is left behind bycloseView("pane still opening at exit"), and the comment at internal/acpbox/box.go:625 and the README say the next prune closes it. With no start time recorded, no prune ever does, so the pane stays until the same name starts again.closeStale(ctx, …)(line 131) also runs on the cancelled context, so itsrexcalls fail. The earlier start's pane of the same name stays open while its record has just been overwritten: a pane that no record names, which is the case item 3 is meant to end.Fix: use
openCtxfor everything after the shield (r.StartTime,closeStale). Make the harness'sStartTimein the cancel test (internal/rpp/view_test.go:391) honourctxasexec.CommandContextdoes, and assert that the record carries the wrapper'sRootPIDandRootStart.[minor] internal/acpbox/follow.go:187: when a hand-run pane is ended with Ctrl-\ (SIGQUIT), Go's default SIGQUIT handling dumps the goroutines and exits without running defers.
quietTerminal's restore never runs, so the terminal is left with echo off. The README and usage say it "puts the terminal's modes back when it ends". Taking SIGQUIT into the sameNotifyContextas SIGTERM would end the pane cleanly, with the restore.[minor] internal/state/state.go:335: any read error of a view file now counts as
ErrCorruptView, andreadViewthen forgets the view. That includes transient errors such as EMFILE or EIO, not only the mode-000 file and the link to a directory the bead names. A transient error forgets the record of a live pane, and nothing closes that pane afterwards. Limiting this toEACCES,EISDIRandELOOPwould cover the bead's cases.[minor] internal/state/state.go:176:
PruneLogskeeps a log only while a view is recorded for its name. An acp agent withREXCITY_BOX=process, or one whose pane failed to open, has no view, so a running agent that has written nothing for 30 days loses its log to another agent's start. The wrapper keeps writing to the unlinked file. This is unlikely, and the README could say so.Verified
REVIEW.mdof main, and the whole diff (28 files, +1065/−71). Every item the bead lists is addressed, nothing unrelated is in, and the README sections and the changelog fragment are there.369b5a8) in a clone: clean.go vet ./...(host,GOOS=darwin GOARCH=arm64,GOOS=linux GOARCH=amd64) exit 0;gofmt -lclean;go test -count=1 ./...exit 0;go test -raceon acpbox, rpp, state, proc and cmd/rexcity exit 0.cmd/changelogfrom mikluko/changelog v2.0.1 and ran-base main -warn missing-fragmenton the merged tree: exit 0.image / imagejob (run 451, job 4618) built the image and ran the new smoke step. The log shows the━━ acp smoke__worker-1 · rexcity · pid …header and the▷ Bash #1,✓ Bash #1 (<1s)and■ end_turnlines, and every grep the step makes matched.StartTimeruns with a fixed TZ and locale, behind theutcprefix, and falls back to the legacy text for older records. An empty<name>.jsonreads as no record.views/that is a file or a link is replaced.nulland{}view files count as corrupt. Log rotation hands the pane--from 0. SIGTERM endsfollowwith exit 0.f14f00f1f2131e0f3520Review of
131e0f3520for rexcity-ndhl1. Checks of the head: success.Verdict
fail
Findings
main: the forge reports itnot_mergeable, and in a clonegit merge 131e0f3intoorigin/main(7ac5fdc, #91, merged after this branch was rebased onto369b5a8) conflicts ininternal/rpp/fake_test.go, in the fields offakeRex(about line 73): #91 addsfailWindowsAfterSplitandwindowsFail, this branch addsonCreate. Rebase ontomainat7ac5fdcor later. The resolution is to keep both sides; nothing else conflicts. With that resolution, everything under "Verified" passes on the merged tree, so the rebase should be all this round needs.Findings of round 1, rechecked
internal/rpp/view.go:118and:131now runr.StartTimeandcloseStaleonopenCtx. The harness'sStartTime,WindowsandCloseBlock(internal/rpp/fake_test.go) honour a cancelled context as the real ones do.TestACancelDuringTheOpeningStillRecordsTheViewassertsRootPIDandRootStart, and the newTestACancelDuringTheOpeningStillClosesThePaneOfTheEarlierStartOfTheNameasserts that the earlier pane is closed.Followtakes it into the sameNotifyContextas SIGTERM (internal/acpbox/follow.go:76), so the defers that restore the terminal run.TestASIGQUITEndsAFollowerAsASIGTERMDoescovers both signals. No test inacpboxis parallel, so the self-signal does not reach another test.Store.View(internal/state/state.go:332) clears only onEACCES,EISDIRandELOOP. Any other read error is returned and the record is kept.PruneLogsand agents with no recorded pane: the README states the limit now, and the changelog fragment follows the changes.Verified
REVIEW.mdofmain(mainhas noAGENTS.mdorCLAUDE.md). Read the whole diff against the merge base369b5a8(28 files, +1146/−76), with the source and the round-1 commit read line by line. Every item the bead lists is addressed, nothing unrelated is in, and the README and the fragment.changelog/acp-box-review-findings.mdare there.startMatches: the only comparisons are inownsRoot,rootAliveandwrapperAlive.Views()intabs.go(frommain) goes throughreadView, as before.7ac5fdc+ this head,fake_test.goresolved by keeping both sides), with the city's variables removed:go vet ./...on the host, withGOOS=darwin GOARCH=arm64and withGOOS=linux GOARCH=amd64all exit 0.gofmt -lis clean.go test -count=1 ./...passes in every package.go test -raceon acpbox, rpp, state, proc and cmd/rexcity passes.cmd/changelogfrom mikluko/changelogv2(v2.1.0) and ran-base main -warn missing-fragmenton the merged tree:valid=true, exit 0.test / go,test / changelogandimage / image, are all success. The image job ran becauseinternal/is touched. They ran against369b5a8, before #91 merged.131e0f3520243592664aReview of
243592664afor rexcity-ndhl1. Checks of the head: success.Verdict
pass
Findings
None.
Findings of round 2, rechecked
mainat51dffc8(#92), so it is now onmain's tip and the merge is a fast-forward. The forge reports itmergeable. ThefakeRexfields ininternal/rpp/fake_test.gokeep both sides:failWindowsAfterSplitandwindowsFailfrom #91, andonCreatefrom this branch (lines 75–81).README.md, in theclaudeacpsection. Nothing there contradicts this branch's README edits: the[providers.claude-proxy]example of therexcity acp claudesection is the only provider named there.Verified
REVIEW.mdofmain(mainhas noAGENTS.mdorCLAUDE.md). Read the whole diff againstmain(28 files, +1146/−76). It is the change round 2 read, rebased. The round-1 fixes are still in:r.StartTimeandcloseStalerun onopenCtx(internal/rpp/view.go:118,:131); SIGQUIT is inFollow'sNotifyContext(internal/acpbox/follow.go:76);Store.Viewclears only onEACCES,EISDIRandELOOP(internal/state/state.go:332). The README states thePruneLogslimit.origin/main51dffc8+ this head), with the city's variables removed:go vet ./...on the host, withGOOS=darwin GOARCH=arm64and withGOOS=linux GOARCH=amd64all exit 0.gofmt -lis clean.go test -count=1 ./...passes in every package.go test -raceon acpbox, rpp, state, proc and cmd/rexcity passes.cmd/changelogfrom mikluko/changelogv2(087d7e8, v2.1.0) and ran-base main -warn missing-fragmenton the merged tree:valid=true, exit 0, no warning. The fragment.changelog/acp-box-review-findings.mdholds only### Changedand### Fixedwith their bullets.test / go(job 4745),test / changelog(job 4746) andimage / image(run 1885, job 4744). The image job built the image and ran the new smoke step throughrexcity acp -- rexcity acp claude …. Its log shows"stdout":"rexcity-smoke"through the box, the header━━ acp smoke__worker-1 · rexcity · pid 302065 · …, and▷ Bash #1,✓ Bash #1 (<1s)and■ end_turn, and every grep the step makes matched.243592664a424605a793New commits pushed, approval review dismissed automatically according to repository settings
Review of
424605a793for rexcity-ndhl1. Checks of the head: success.Verdict
pass
Findings
SIGINT,SIGTERMandSIGHUPtoo". This head addsSIGQUITto that signal context (internal/acpbox/follow.go:185), and its changelog bullet says so. AddingSIGQUITto the README's list would keep the two in step. It is not blocking.internal/acpbox/pane_test.go:1012(TestAWordOfMegabytesOnATerminalIsKeptForAReplayInLinearTime, from #86) holds a 5 s wall-clock bound. Undergo test -raceon a busy machine it failed twice here (5.6 s and 9.5 s), on this head. Without-raceit takes 0.12 s on this head and 0.2–0.5 s on main, so the change is not slower. Under-raceboth scatter between about 2 and 5 s, and main passed its three runs. CI runs no-race, so this is a flaky bound in main's test, not a regression of this change.Verified
2ff3907, dropping what main already carries.git range-diff 51dffc8..2435926 2ff3907..424605aagainst the head approved before shows exactly what the PR description lists. The follower's own terminal handling is dropped (quietTerminal, theterm_*.gofiles,isTerminal, theFollow/followersplit, ignoring Ctrl-C/Ctrl-Z, their tests, their README sentence and changelog bullets), because main'shushInput(#86) carries item 2. SIGQUIT is kept, as one signal added to main'ssignal.NotifyContext.hushTermioskeepsISIG, so Ctrl-\ still raises it. The cancel shield sits on main'sopenPane(..., true), and the fake'sonCreatesits on main'ssplit/recordhelpers. Nothing else differs.PruneLogswith its header, view and regular-file guards.proc.StartTimein UTC/C with theutcprefix, and the legacy fallback instartMatches.OpenView'sWithoutCancelwith the caller's deadline kept.ensureViewsDir, and the empty record.rexcity acp --..changelog/, with type headings only. No breaking change. Theinternal/change runs the image job.2ff3907is a fast-forward (main is the head's base), so the merge is clean.go vet ./...on the host,GOOS=darwin GOARCH=arm64andGOOS=linux GOARCH=amd64: exit 0.gofmt -l cmd internal packs: empty.go test ./...: all ok.go test -race -count=1on acpbox, rpp, state, proc and cmd/rexcity: ok except the timing test above. The new tests, repeated-count=3: ok.warn: missing-fragment, on the merged tree:valid=true, exit 0.test / go,test / changelogandimage / imageare success. The image job (run 1914, job 4807) ran the new smoke step in the image. The logbox/…/smoke__worker-1.logshows━━ acp smoke__worker-1 · rexcity · pid …,▷ Bash #1,✓ Bash #1 (<1s)and■ end_turn, and every grep of the step passed.