Repository navigation
fix(terminal): watch instead of attaching from an out-of-use tab - #1130
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Closes #902.
Problem. A fresh
keep_sizeattach still spawns the PTY sidecar at the layout rectangle, or 80x24 when no rectangle is available. That spawn resizes the pane before the client can leave it alone. The layout is not the pane's current geometry, and herdr exposes no authoritative current-size API.Behavior. A tab that is not visible or lacks document focus watches the pane read-only before acquiring a new attachment, independently of
releasePaneAway. This covers loads/reloads, background reconnects, and replacement panes.PaneTerminalreuses the released/watch lifecycle; the socket lets it decide before attach replay. Focus, pointerdown, or eligible terminal key input resumes attachment. No server or wire-protocol change.Exceptions and ownership:
queueWaitspreserves the attachment for retained, in-flight, queued, or sending messages; one pane's queue does not confer ownership on its replacement.watchfeature retains the existingkeep_sizeattach behavior after capability discovery.The setting remains necessary.
releasePaneAwaystill releases a previously active, existing desktop attachment one second after blur/hidden and watches instead. This fix only avoids acquiring a new attachment while away. #699 made release opt-in because unfocused windows, including visible second-monitor terminals, stopped updating and appeared frozen. #700 added read-only watching, but older bridges still pause and reattachment still changes the stream and geometry. Keep the setting and its default off in this fix; evaluating default-on is a separate usability decision, not grounds to remove it here.The obsolete canvas-wide inherited-release flag is removed because each fresh pane now makes its own decision. A changelog fragment is included.
scripts/fixed-sleeps.jsondecreases from 6 to 5 forchat-size-regression.ts: the background-reload assertion now waits for observable watch state rather than a fixed delay. No new fixed sleep was added.Validation
bun run typecheck: exit 0.HERDR_TEST_MODE=unit bun test ./src/lib/ws.test.ts ./src/lib/machineSession.test.ts ./src/lib/settings.test.ts: 132 pass, 0 fail.bun run test:unit: 3,718 pass, 0 fail, 8 skip, across 291 files. Rerun after correcting the required fixed-sleep ratchet.HERDR_TEST_MODE=unit bun test ./scripts/conventions.test.ts ./scripts/changelog-fold.test.ts: 21 pass, 0 fail on the final fixture; includes the no-new-fixed-sleep and shrinking-baseline checks.bun run check run --build bun scripts/chat-size-regression.ts: 34 pass, 0 fail, exit 0. Its report records unchanged source and an unchanged build produced by the run.bun x tsc --ignoreConfig --noEmit --strict --noUncheckedIndexedAccess --noUnusedLocals --target esnext --module esnext --moduleResolution bundler --allowImportingTsExtensions --skipLibCheck --jsx react-jsx --types bun scripts/chat-size-regression.ts: exit 0.git diff --check: exit 0.The new mount assertion failed before the fix by observing
attachwithkeep_size: true. Browser coverage verifies preservation of a real 140x40 pane across background loads/reloads and a 132x38 replacement pane, plus reconnects, focus/pointer/key resume, queue ownership, delayed mirror identity, legacy capability fallback, cache transitions, existing-attachment joins, and an embedded iframe. Hidden-load and iframe-policy fixture failures were corrected; the iframe's framing override and loopback permission are test-context-only, with production security headers unchanged.Verified locally on Linux/Chromium with Bun 1.4.3, Node 24.18.0, and herdr 0.9.3. Not verified on native Windows, macOS, or Safari. Mirror behavior uses controlled identity/geometry fixtures; the deployed demo was not exercised. The build still emits its existing large-chunk warning.