fix: terminal drawer fails to load on ultrawide displays#2342
fix: terminal drawer fails to load on ultrawide displays#2342BlueManCZ wants to merge 3 commits into
Conversation
The previous ceiling (400 cols / 200 rows) was hit by xterm's FitAddon on a 3440x1440 ultrawide (~411 cols at default density), causing the schema decode to reject the open/resize call before it reached the server. Raise to 1000 / 500 to comfortably cover ultrawide / 4K / 8K at small font sizes while still bounded enough to defend the PTY from malicious client input. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The Bun PTY adapter used Effect.sync, so any synchronous throw from Bun.spawn became an unhandled defect that bypassed the typed error union and reached the RPC client as a non-Error rejection (Effect's runPromise rejects with raw Cause.die payloads). Mirror NodePTY's Effect.try pattern so spawn failures surface as typed PtySpawnError. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The instanceof Error ? err.message : fallback pattern silently drops non-Error rejections (e.g. RPC defects, plain objects with _tag), so the user sees a generic fallback instead of the underlying detail. Extract a shared extractErrorMessage helper that handles Error, objects with a message string, _tag-discriminated payloads, and string rejections, falling back only when nothing else is meaningful. Use the helper in the terminal drawer's open/write catch handlers. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
ApprovabilityVerdict: Approved Straightforward bug fix that raises terminal dimension limits to support ultrawide displays, with defensive error handling improvements and a well-tested utility extraction. Low-risk, backwards-compatible changes. You can customize Macroscope's approvability policy. Learn more. |
|
Fixed in #2411 |
Summary
cols/rowswere capped at 400/200, but xterm'sFitAddonproduces ~411 cols on a 3440x1440 ultrawide. The decode rejected theterminal.open/terminal.resizecall client-side and the drawer showedExpected a value less than or equal to 400, got 411 at ["cols"]. Raised to 1000/500 — covers ultrawide / 4K / 8K at small font sizes while staying bounded.Failed to open terminalfallback becauseBunPTYusedEffect.sync, turning any synchronousBun.spawnthrow into an untyped defect. Effect'srunPromiserejects with rawCause.diepayloads (verified in isolation), so on the clienterr instanceof Errorreturnsfalseand the underlying message is lost. Switched toEffect.tryto mirrorNodePTY, mapping spawn failures to typedPtySpawnError.extractErrorMessage(error, fallback)that handlesError, objects with amessagestring,_tag-discriminated RPC payloads, and string rejections, falling back only when nothing meaningful is present. Used in the terminal drawer's open/write catch handlers; the previouserr instanceof Error ? err.message : fallbackpattern silently swallowed non-Errorrejections.Test plan
Expected a value less than or equal to 400error).Failed to open terminal.bun run testpasses (added 2 schema-bound tests interminal.test.ts, 11 helper tests inerrorMessage.test.ts).bun fmt,bun lint,bun typecheckclean.🤖 Generated with Claude Code
Note
Medium Risk
Changes terminal size validation limits and alters Bun PTY spawn error handling, which can affect terminal session creation and resizing across clients. Risk is moderate because failures will now propagate as typed errors and larger dimensions may impact performance/memory in extreme cases.
Overview
Fixes terminal drawer failures on large/ultrawide displays by increasing contract validation bounds for terminal
cols/rows(to1000/500) and adding tests for the new maxima.Improves terminal error surfacing: Bun’s PTY adapter now wraps
Bun.spawninEffect.tryand maps failures toPtySpawnError(instead of dying viaEffect.sync), and the web terminal drawer uses a newextractErrorMessagehelper to display meaningful messages for non-Errorrejections (including_tag-shaped RPC errors) whenopen/writefail.Reviewed by Cursor Bugbot for commit ab83fa0. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix terminal drawer failing to load on ultrawide displays by raising max terminal dimensions
terminal.ts:colsfrom 400→1000 androwsfrom 200→500, fixing validation rejection on ultrawide displays.extractErrorMessageutility that normalizes unknown errors to a human-readable string, with fallback support and safe handling of circular references.extractErrorMessageinThreadTerminalDrawerfor both the write and open failure paths.Bun.spawninEffect.tryinBunPTY.tsso spawn failures surface as typedPtySpawnErrorinstead of a generic thrown error.Macroscope summarized ab83fa0.