Skip to content

fix(chat): picking a chat-lens pane from a terminal-lens pane leaves the terminal's size alone - #390

Merged
devswha merged 4 commits into
mainfrom
fix/chat-lens-pane-switch-size
Oct 3, 2026
Merged

devswha merged 4 commits into
mainfrom
fix/chat-lens-pane-switch-size

Conversation

@devswha

@devswha devswha commented Oct 3, 2026

Copy link
Copy Markdown
Owner

What was wrong

#363 made the chat lens leave the shared terminal's size alone, but only when the page opens on the pane. Picking a chat-lens pane from the sidebar while a terminal-lens pane is open still resized it.

  • A desktop shows an agent pane in its terminal lens at 38×145.
  • A second, smaller window has a shell pane open in the terminal lens and picks that agent pane, whose lens there is chat.
  • The attach goes out without keep_size, and the desktop's pane is fitted to the smaller window.

Cause: src/App.tsx set the selected pane's lens in a useEffect after the selection. PaneTerminal attaches in the layout effect of the render that selects the pane, so it still saw the previous pane's lens.

Change

The lens is settled in the render that selects the pane (state adjusted during render, keyed by what the effect depended on). What decides the lens is unchanged: the pane's remembered choice, else Settings, else the device.

Checks

  • New browser regression checkPaneSwitchKeepsTerminalSize in scripts/chat-size-regression.ts, run by scripts/ui-regression.ts. On main it fails: the picked pane's attach has no keep_size. With the fix it passes and the pane's own stty size stays 38 145.
  • bun run typecheck: pass.
  • bun run test:unit: 1083 pass, 3 skip, 0 fail.
  • scripts/ui-regression.ts and scripts/file-viewer-regression.ts: all pass on an isolated herdr session.

Not covered

The smaller findings from the same review of #363 are left as they are: a resize that arrives while a keep_size attachment is still being created is dropped, and the replay/geometry order for a client that adopts the grid.

…the terminal's size alone

The lens of the selected pane was set in an effect after the selection, but the pane's terminal attaches in the layout effect of the render that selects it. So a pane whose lens is chat attached in the previous pane's lens, without keep_size, and the shared terminal was fitted to this device once.

The lens is now settled in the render that selects the pane.
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
CONTRIBUTING.md — configured

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: efe2747e-67c5-4700-92ba-23cb2d5b83ee
📥 Commits

Reviewing files that changed from the base of the PR and between 972081b and 9039519.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • scripts/chat-size-regression.ts
  • scripts/ui-regression.ts
  • src/App.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Switching from a terminal pane to a chat pane no longer resizes the shared terminal. The terminal keeps its existing size when you select the chat pane from the sidebar.

Walkthrough

The app now resolves its view from the current pane selection context. A new UI regression check verifies that switching from a chat-default browser to an agent pane does not resize the shared terminal.

Changes

Pane view and terminal size

Layer / File(s) Summary
Key pane view state to selection context
src/App.tsx
The app stores the view with a key based on the current selection and relevant pane, terminal, and setting values. It resolves the view during render and preserves the key when the view changes.
Check terminal size when switching panes
scripts/chat-size-regression.ts, scripts/ui-regression.ts, CHANGELOG.md
Shared helpers query shell size and record WebSocket frames. The new regression check verifies that selecting an agent pane sends an attach with keep_size: true and leaves the desktop terminal size unchanged. The UI runner invokes the check, and the changelog records the fix.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: haeminway1, wouldu-pres

Merge Risk: ⚪ Minimal · up to 90395

Selecting a chat-lens pane from a terminal-lens pane should no longer resize the shared terminal. A regression check now covers this, and no merge-blocking issue was found.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 90395

The change corrects shared-terminal sizing without adding an access path or privilege. Its scope is narrow, but concurrent attachment and recovery behavior remain only partly verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed behavior affects geometry of the selected shared pane and therefore other windows attached to that pane. The compared production change does not expand pane-selection authority or grant additional terminal-input privileges.

Security Findings and Attack Paths

  • inferred — The exported regression helpers do not establish a new production attack path. Their concrete caller uses a loopback server and test-created workspaces, with pane identifiers obtained from workspace creation rather than external input.

Trust Boundaries and Controls

  • observed — Terminal messages are checked against the current pane, and cleanup detaches the captured old pane identifier. These existing identity controls counter stale-callback cross-pane mutation; daemon-side authorization was not independently assessed.

Resilience and Maintainability Implications

  • observed — The existing reconnect path retains per-attachment keep_size state, and disconnect invalidates pending output generations. These recovery controls are unchanged; server ordering of attachment, replay, and resize remains unverified.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, cause, change, and validation results. It does not include the screenshot or recording required for a UI change, and it uses “Checks” instead of the template’s “V… Add a screenshot or recording from an owned demo or test session. Rename “Checks” to “Validation” to match the repository template.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the pane-switch scenario and the terminal-size fix.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (1 skipped: 1 u…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, cause, change, and validation results. It does not include the screenshot or recording required for a UI change, and it uses “Checks” instead of the template’s “Validation” heading.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@devswha
devswha merged commit 25368dd into main Oct 3, 2026
6 of 7 checks passed
@devswha
devswha deleted the fix/chat-lens-pane-switch-size branch October 3, 2026 13:19
devswha added a commit that referenced this pull request Oct 3, 2026
Bumps package.json and herdr-plugin.toml to 0.3.47, moves the Unreleased
notes under [0.3.47] - 2026-10-03 (the two Fixed lists folded into one),
and adds the compare link. Raises the remote PC bundle to 14 (new
routes: `/api/tab/rename`, `/api/tab/close`): push the `remote-v14` tag
and let the bundle workflow publish before running release.yml.

Carries #374, #388, #389, #390, #391, #392, #394, #395.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant