Skip to content

fix(app): reserve review pane minimum instead of capping chat width at 45%#35078

Merged
Hona merged 2 commits into
anomalyco:devfrom
Hona:review-pane-min
Jul 8, 2026
Merged

fix(app): reserve review pane minimum instead of capping chat width at 45%#35078
Hona merged 2 commits into
anomalyco:devfrom
Hona:review-pane-min

Conversation

@Hona

@Hona Hona commented Jul 3, 2026

Copy link
Copy Markdown
Member

Problem

When the review pane is open, the chat panel's resize handle is capped at window.innerWidth * 0.45. Since the review pane is just the flex remainder, this forces it to always occupy at least ~55% of the window — on wide monitors the review pane cannot be made smaller than ~1900px on a 3440px ultrawide, regardless of content.

When the review pane is closed, the chat content already has a sensible max-width container, so an absolute cap on the chat panel serves no purpose.

Additionally, the cap was only enforced while dragging: shrinking the window (or opening the sidebar) never re-applied it.

Change

  • Remove the 45%-of-window cap on the chat panel.
  • Reserve a fixed minimum for the review pane instead: 480px for unified diffs, 800px for split diffs. The chat panel can take everything beyond that.
  • Measure the panel row with a ResizeObserver and clamp the rendered chat width at render time, so window resizes, screen changes, and sidebar toggles squeeze the chat panel instead of the review pane. The persisted width is not overwritten, so growing the window back restores the previous chat width.
  • Extracted the width math into session-panel-width.ts with unit tests.

Before / After

Before: on a ~1718px window the review pane bottomed out at ~921px (55% − chrome); chat panel could not grow past 45%.

After: chat panel grows until the review pane hits 480px (unified) / 800px (split); shrinking the window clamps the chat panel live.

Tests

  • bun test src/pages/session/session-panel-width.test.ts (8 pass; written first, failing, then implementation)
  • bun test src/pages/session — only pre-existing failure in session-composer-state.test.ts ("Client-only API called on the server side"), reproducible on clean upstream/dev
  • bun typecheck in packages/app passes

@Hona Hona added the beta label Jul 7, 2026
@Hona Hona marked this pull request as ready for review July 7, 2026 05:35
@Hona Hona requested a review from Brendonovich as a code owner July 7, 2026 05:35
Copilot AI review requested due to automatic review settings July 7, 2026 05:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the desktop session layout behavior when the review pane is open by removing the old “chat width capped at 45% of window” behavior and instead reserving a fixed minimum width for the review pane. It also makes the clamping responsive to live layout changes (window resize, sidebar toggles) without overwriting the persisted chat width.

Changes:

  • Introduces shared width math helpers to compute the maximum chat panel width based on available row width and diff style (unified vs split).
  • Adds unit tests covering width max and clamping behavior, including regressions for ultrawide screens.
  • Updates the session page to measure the panel row with a ResizeObserver and apply clamping at render time, while updating the resize handle constraints accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/app/src/pages/session/session-panel-width.ts Adds reusable helpers/constants for computing max chat width and clamping behavior based on reserved review-pane minimums.
packages/app/src/pages/session/session-panel-width.test.ts Adds unit tests validating the new width math and clamping behavior (including regression coverage for the removed 45% cap).
packages/app/src/pages/session.tsx Switches resizing constraints from window.innerWidth * 0.45 to measured row width with ResizeObserver, and clamps the rendered width without overwriting persisted state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Conflicts:
#	packages/app/src/pages/session.tsx
opencode-agent Bot added a commit that referenced this pull request Jul 7, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 7, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 7, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 7, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 7, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
opencode-agent Bot added a commit that referenced this pull request Jul 8, 2026
@Hona Hona merged commit dd25d14 into anomalyco:dev Jul 8, 2026
9 checks passed
avion23 pushed a commit to avion23/opencode that referenced this pull request Jul 9, 2026
anduimagui pushed a commit to anduimagui/opencode that referenced this pull request Jul 9, 2026
avion23 pushed a commit to avion23/opencode that referenced this pull request Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants