Skip to content

Skip resize + chromium restart when display already matches#255

Open
masnwilliams wants to merge 2 commits into
mainfrom
hypeship/skip-noop-display-resize
Open

Skip resize + chromium restart when display already matches#255
masnwilliams wants to merge 2 commits into
mainfrom
hypeship/skip-noop-display-resize

Conversation

@masnwilliams
Copy link
Copy Markdown
Contributor

@masnwilliams masnwilliams commented May 28, 2026

Summary

VM-side companion to the API-side short-circuit. Both PatchDisplay and the multipart ChromiumConfigure (when display is the only thing in the request) currently proceed through the full xrandr/xvfb resize plus a chromium restart even when the requested width/height/refresh-rate already match the current display state. This change detects the no-op and returns success immediately — skipping the idle check, recording stop, resize, and restart.

Sister PR on the API side: kernel/kernel#2233 (skips the configure call entirely when the request matches the pool image default). This PR catches the same case from the VM side, plus any caller that passes a non-default-but-already-current viewport.

Changes

  • Extract resolveDisplayParams so PatchDisplay and chromiumPrepareDisplay share one definition of "the request changes nothing."
  • PatchDisplay returns 200 immediately when changed == false.
  • chromiumPrepareDisplay returns a nil plan, which the caller already handles as skip-apply.

Test plan

  • go test ./cmd/api/api/ — new TestResolveDisplayParams covers matching dims with and without refresh-rate, mismatched width, refresh-rate-only mismatch, partial body, and nil body
  • Manual: deploy to a metro, send PatchDisplay {width:1920,height:1080} to an instance launched at 1920x1080, confirm no chromium restart in supervisor logs and no xrandr/xvfb activity

Note

Low Risk
Targeted early-return on display APIs with unit tests; avoids disruptive side effects on no-op requests rather than changing resize semantics when values differ.

Overview
Adds a VM-side no-op path when display resize requests already match the current width, height, and refresh rate, so callers avoid idle checks, recording stops, xrandr/Xvfb work, and Chromium restarts.

resolveDisplayParams centralizes merging the request with current display state and sets a changed flag when any of those fields would differ. PatchDisplay returns 200 immediately when nothing would change; chromiumPrepareDisplay returns a nil plan so configure skips display apply (existing behavior for nil plans).

TestResolveDisplayParams covers matching/mismatch cases, partial body fields, and nil body.

Reviewed by Cursor Bugbot for commit 1ae4afa. Bugbot is set up for automated code reviews on this repo. Configure here.

PatchDisplay and the multipart Configure both unconditionally proceeded
through xrandr/xvfb resize plus a chromium restart even when the
requested width/height/refresh-rate already matched the current display
state. Detect the no-op case and return success immediately — skipping
the idle check, recording stop, resize, and restart.

Extract the merge logic into resolveDisplayParams so both handlers share
one definition of "the request changes nothing."

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@masnwilliams masnwilliams marked this pull request as ready for review May 28, 2026 02:15
@firetiger-agent
Copy link
Copy Markdown

Firetiger deploy monitoring skipped

This PR didn't match the auto-monitor filter configured on your GitHub connection:

Any PR that changes the kernel API. Monitor changes to API endpoints (packages/api/cmd/api/) and Temporal workflows (packages/api/lib/temporal) in the kernel repo

Reason: PR modifies VM-side display handling logic, not kernel API endpoints (packages/api/cmd/api/) or Temporal workflows (packages/api/lib/temporal); the companion API-side changes mentioned are in a separate PR.

To monitor this PR anyway, reply with @firetiger monitor this.

@masnwilliams masnwilliams requested a review from hiroTamada May 28, 2026 02:55
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.

2 participants