Repository navigation
Return client errors and restore failed display changes - #445
hiroTamada wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3e5f29b. Configure here.
| defer cancel() | ||
| if _, _, restoreErr := s.setResolutionAndConverge(restoreCtx, previousW, previousH, previousRate, useNeko); restoreErr != nil { | ||
| logger.FromContext(ctx).Error("failed to restore display after resize failure", "error", restoreErr) | ||
| err = fmt.Errorf("%w; failed to restore display: %s", err, restoreErr) |
There was a problem hiding this comment.
Restore failure still returns 400
Medium Severity
A failed rollback still wraps the original ScreenConfigurationError with %w, so isNekoScreenRejection maps PATCH /display and configure apply to 400 even when restore did not bring the X root back. Callers treat that as a rejected request with an unchanged display, while the screen can remain at the dummy driver's maximum.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 3e5f29b. Configure here.


Summary
A rejected non-preset viewport change currently becomes a 500 and can leave the X root at the dummy driver's maximum resolution after mode creation.
Testing
cd server && go test -race $(go list ./... | grep -v '/e2e$')— passed on the final full run. An initial run failed the existing Chromium restart test during temporary-directory cleanup; its isolated rerun and subsequent full runs passed.cd server && go vet ./...— passed.DISPLAY=:1 xrandr --current:Follow-up
The companion rate-selection fix in kernel/neko#24 needs a release and a base-image bump to take effect in released browser images. This PR deliberately leaves
ghcr.io/kernel/neko/base:3.0.8-v1.6.0unchanged; error mapping and rollback work with that existing base. Control-plane default refresh-rate logic is unchanged. Nothing is merged or deployed.Note
Medium Risk
Touches headful display resize, Neko integration, and rollback on failure—user-visible resolution and API status codes—but behavior is narrowed (4xx mapping, restore on error) with new regression tests.
Overview
Rejected viewport changes no longer surface as 500s when Neko returns a client error, and a failed resize no longer leaves the X root stuck at the dummy driver’s max resolution.
Neko screen-configuration failures now carry their HTTP status (
ScreenConfigurationError). PATCH /display and Chromium configure (live and stop/start display steps) treat Neko 4xx as 400; other failures stay 500.Before applying a new mode, the API records the current Xorg size and refresh rate from xrandr. If the change fails (including after mode creation moved the root), it restores the prior configuration with the same converge/retry path used for resizes, on a bounded context that survives request cancellation.
Refresh-rate handling now parses the active starred rate from
xrandr --current(not the mode-name suffix) and returns the realized integer rate after a successful headful resize. Regression tests cover xrandr parsing, 400 vs 500 mapping, rollback (including a dropped restoration request on the live configure path).Reviewed by Cursor Bugbot for commit 3e5f29b. Bugbot is set up for automated code reviews on this repo. Configure here.