[codex] fix terminal dimension validation#2411
Conversation
Co-authored-by: codex <codex@users.noreply.github.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)
Comment |
- Allow smaller terminal dimensions on startup and resize - Keep session/env schema limits aligned with runtime defaults
- Reflow terminal schema definitions - Keep contract types and defaults unchanged
ApprovabilityVerdict: Approved Simple validation relaxation to support ultrawide terminal dimensions. The change is permissive and self-contained with no security implications. The low-severity test coverage comment does not indicate a functional issue. You can customize Macroscope's approvability policy. Learn more. |
- Tighten terminal open validation in tests - Cover startup bug where rows=0 should be invalid
- Simplify the sync decode helper signature - Keep terminal contract tests aligned with current formatting
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Test no longer validates column bounds rejection
- Changed cols from 10 (valid under relaxed schema min 1) to 0 (invalid) so the test now validates rejection of both column and row bounds.
Preview
diff --git a/packages/contracts/src/terminal.test.ts b/packages/contracts/src/terminal.test.ts
--- a/packages/contracts/src/terminal.test.ts
+++ b/packages/contracts/src/terminal.test.ts
@@ -54,7 +54,7 @@ describe("TerminalOpenInput", () => {
decodes(TerminalOpenInput, {
threadId: "thread-1",
cwd: "/tmp/project",
- cols: 10,
+ cols: 0,
rows: 0,
}),
).toBe(false);
@@ -54,7 +54,7 @@ describe("TerminalOpenInput", () => {
decodes(TerminalOpenInput, {
threadId: "thread-1",
cwd: "/tmp/project",
- cols: 10,
+ cols: 0,
rows: 0,
}),
).toBe(false);You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 680951e. Configure here.


Summary
cols: 423startup size from issue [Bug]: #2395.Root Cause
The desktop terminal opens by fitting xterm to the available drawer size and sending the resulting
cols/rowstoterminal.open. On wide Windows layouts, xterm can validly report more than 400 columns. The shared contract rejectedcols: 423, so the server never created the terminal session. Follow-up input/resize calls then targeted a terminal thread that did not exist, producing the repeatedUnknown terminal threaderrors.Fixes #2395.
Validation
bun run test src/terminal.test.tsfrompackages/contractsbun fmtbun lintbun typecheckbun run testNote
Widen terminal dimension validation bounds in
TerminalColsSchemaandTerminalRowsSchemaRelaxes the accepted range for terminal dimensions to support ultrawide and non-standard terminal sizes.
TerminalColsSchemanow accepts 1–1000 (previously 20–400) andTerminalRowsSchemaaccepts 1–500 (previously 5–200).Macroscope summarized 680951e.
Note
Low Risk
Small contract/test change that only broadens accepted numeric input ranges; low risk aside from potentially allowing unexpectedly large terminal allocations.
Overview
Relaxes terminal dimension validation in the shared contracts so
terminal.openandterminal.resizeaccept much larger xterm fit results (cols 1–1000 vs 20–400, rows 1–500 vs 5–200).Adds a regression test ensuring an ultrawide
423x40open payload decodes successfully, and updates the invalid-bounds test to reflect the new minimum row constraint.Reviewed by Cursor Bugbot for commit 680951e. Bugbot is set up for automated code reviews on this repo. Configure here.