Window mechanics: wedge-resistant window actions + CLI positioning flags#113
Window mechanics: wedge-resistant window actions + CLI positioning flags#113cristbc wants to merge 2 commits into
Conversation
chrome.windows.* calls can hang indefinitely in a long-lived MV3 service worker
(observed: window_focus/window_resize stopped responding while window_list and
tab ops kept working). A hung await never throws, so the message dispatcher's
try/catch cannot recover it — the CLI just times out at 15s with no structured
error, looking like a dead tool.
Wrap every chrome.windows.* call in an 8s timeout and the whole handler in
try/catch so it ALWAYS returns a structured ActionResult: a hang or throw
becomes an honest { success:false, error } the daemon/CLI can surface.
The extension's window_resize handler already forwards left/top/state to chrome.windows.update, but the CLI only read positional width/height — so windows could be resized, never positioned or tiled. Add --left/--top/--width/ --height/--state flags (positional `width height` kept for back-compat). Unlocks absolute positioning and side-by-side tiling from the CLI.
|
Caution Review failedAn error occurred during the review process. Please try again later. 📝 WalkthroughWalkthroughThe CLI ChangesWindow Resize CLI Flags and MV3 Timeout Safety
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Summary
Two related fixes to Chrome window control, found while building reliable side-by-side window tiling on top of the CLI.
1. fix(extension): guard window actions against a wedged service worker
window_focus/window_resizestop responding (CLI reports "no response" after 15s) whilewindow_listand tab operations keep working.chrome.windows.*calls can hang; the handlerawaited them with no timeout, and a hungawaitnever throws — so the message dispatcher'stry/catchcan't recover it and no response is ever sent. It looks like a dead tool.chrome.windows.*call in an 8sPromise.racetimeout, and wrap the whole handler intry/catch, so it always returns a structured{ success, error }. A wedge now surfaces as a fast, honest error instead of a silent 15s hang.2. feat(cli): expose
--left/--top/--stateonwindow resizewindow_resizehandler already forwardsleft/top/statetochrome.windows.update, but the CLI only read positionalwidth height— so windows could be resized, never positioned or tiled.--left/--top/--width/--height/--stateflags. Positionalwindow resize <id> <width> <height>is kept for back-compat.chrome.windows.updaterejectsstatecombined with explicit bounds ("Invalid value for state") — setstateand bounds in separate calls.Testing
tsc -p tsconfig.host.jsonandtsc -p tsconfig.extension.jsonclean.--left/--topmoves windows to exact coordinates; two windows tiled to exact non-overlapping halves; the wedge guard is confirmed present in the built bundle.Summary by CodeRabbit
New Features
--left,--top,--width,--height,--state) in addition to positional arguments.Bug Fixes