Repository navigation
fix(terminal): a window in use no longer sizes the pane again when its health answer comes late - #4444
Conversation
…s health answer comes late A page attaches from the server's cached roster before its first /api/health answer says whether herdr can attach. That answer changed `mirrored` from null to false, which ran the presentation hook again, and for a pane in use the hook asks for the window's grid: a phone that had just opened a pane took it back from the PC that had clicked its terminal meanwhile (#4378). Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
Merged through |
…mmit (#4447) ## What "Detect changes" reads what a pull request changed from the run's own merge commit (`HEAD^1..HEAD`) instead of from `github.event.pull_request.base.sha`. ## The defect `github.event.pull_request.base.sha` is the base branch as the pull request last saw it, not the commit the run's merge commit was made on. Once `main` has moved, `git diff "$BASE_SHA" HEAD` also lists the files of the pull requests merged in between, and the two skips that depend on the list stop applying: - `code=false` (a docs-only pull request skips the heavy jobs), and - `browser=false` (#4441: a pull request whose paths cannot reach the Browser regression jobs skips them). Seen on #4426, which changes `ovis-site/`, two `scripts/ovis-site*.test.ts` files and a changelog fragment: `scripts/ci-browser-reach.sh` says `browser=false` for those six paths, but run 44934012378 ran every browser job. The event's base was c4ee709 (#4444); the merge commit d36a19d was made on 5197b05 (#4445), so the difference also held #4445's `scripts/ci-browser-quarantine.ts` and `scripts/relay-panel-regression.ts`, which keep the browser jobs. With merges to `main` every few minutes this is the common case, not a rare one. The error was always on the safe side (more jobs, never fewer). ## The fix In the filter step: when `HEAD` is a merge commit, the base is its first parent. `actions/checkout` checks out `github.sha`, which for a `pull_request` event is the merge of the head into the base, and `fetch-depth: 0` is already set, so both parents are there. A `HEAD` that is no merge commit keeps the event's base as before. This narrows the list to exactly the pull request's own paths, which is what both skips were written for. It cannot skip a job for a path the pull request does change: those paths are in `HEAD^1..HEAD` by construction. ## Validation - `scripts/release-ci-reuse.test.ts` runs the filter step in a temp repository. New cases: the base moved after the pull request saw it and another pull request's client code was merged meanwhile; a unit-test-only pull request still gets `browser=false`, a docs-only one `code=false`, and one that changes client code itself `code=true`, `browser=true`. With the new line taken out the test fails. - `bun run check fast`: passed (22,319 unit tests, typecheck, build, workflow syntax). - Not shown yet: a real run. #4426, brought up to date after this merges, is the check (its browser jobs should be skipped and "Integration and browser" should still report success). ## Merge This changes when two of a required check's jobs are skipped: it waits for the maintainer's word. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.2 <[email protected]>
What
A window that is using a pane no longer asks for its own terminal size again when it learns, late, whether herdr can attach. Closes #4378.
The defect
scripts/ui-contexts-regression.tssometimes failed witha click in the desktop terminal: the pane is 35 47, not 42 121: a PC and a phone show the same pane, the phone has it at its size, a click in the PC's terminal takes it back, and a moment later the pane is at the phone's size again.It is a product defect, not a test's wait:
/api/healthanswer arrives. Until then the pane'smirroredprop isnull(src/App.tsx).mirroredbecomesfalse.usePaneAttachran the presentation hook on any change ofcached,watched,presentedormirrored, and for a presented pane in use the hook callsrefit(), which sends a forcedresize.A person can meet it: open Ovis on a phone, click the PC's terminal before the phone's health answer is in, and the PC's terminal is drawn at the phone's size. It needs a herdr ping slower than about half a second, which is why it was rare and load-dependent.
The fix
src/lib/usePaneAttach.ts: whenmirroredis the only one of the four that changed and the pane is neither cached nor released, the hook is not run. Whether herdr can attach decides how a pane that was put away comes back (watch, attach or mirror), so released and cached panes still run it. A pane in use has nothing to assert again. A render that changespresentedandmirroredtogether still runs the hook once, and the mount runs it as before.Reproduction and checks
scripts/chat-size-regression.ts(checkFocusedWindowReclaimsTerminalSize) now holds the phone's/api/healthuntil the PC has taken the pane back, then lets it through and asserts that the phone sends noresizeorattachand that the pane stays at the PC's size.{ type: "resize", cols: 47, rows: 35 }right after its health answer.CHAT_SIZE_CASE=reclaim bun scripts/chat-size-regression.ts).src/lib/usePaneAttach.hook.test.ts: three cases (a pane in use that only learns it; a released or cached pane that learns it; a change ofpresentedorcachedwith or without it). With the fix's onereturntaken out, the first case fails.bun run check fast: passed (22,319 unit tests, typecheck, build).bun scripts/ui-contexts-regression.ts: passed once, 63 PASS lines, in the isolated test session.Not covered
ui-contexts-regressionrows of CI flakes: browser scripts that failed or needed a second run #4026 for 2026-11-20/21 are other failures (aBun.serve()10 s request timeout insidenotification-startup-regression.ts, a branch's ownsecret-inputfailure, one lane time limit under load). This change does not touch them.mirroredtotrue(a host where herdr cannot attach) for a pane in use also no longer sends a secondresize. The attach already carried the window's grid; I read that path and did not run it on such a host.🤖 Generated with Claude Code