Skip to content

Conversation

@sjmiller609
Copy link
Collaborator

@sjmiller609 sjmiller609 commented Jan 29, 2026

Fixes some terminal behavior:

  • resizing
  • handles normal terminal behaviors like control A or up arrow
terminal-behavior.mov

Note

Medium Risk
Touches the exec streaming path across API, gRPC client, and guest-agent, including concurrency around shared gRPC streams and protocol changes; regressions could break interactive shells or exec I/O.

Overview
Adds end-to-end terminal resize support for interactive exec sessions: the API now accepts initial rows/cols in the first WebSocket message and parses subsequent {"resize":{...}} control messages, forwarding them to the guest over gRPC.

Updates the guest protocol (guest.proto + regenerated guest.pb.go) and client/agent implementations to carry window dimensions (ExecStart.rows/cols and ExecRequest.resize), apply them via pty.StartWithSize/pty.Setsize, and guard concurrent gRPC stream sends.

Build tooling is adjusted to pin/install protoc-gen-go/protoc-gen-go-grpc via tools.go/go.mod and a new make install-proto-tools step; adds a unit test covering TTY env defaults/overrides in the guest agent.

Written by Cursor Bugbot for commit 6283407. This will update automatically on new commits. Configure here.

@sjmiller609 sjmiller609 marked this pull request as ready for review January 29, 2026 21:43
@sjmiller609 sjmiller609 merged commit e61d19f into main Jan 29, 2026
4 of 5 checks passed
@sjmiller609 sjmiller609 deleted the terminal-sizing branch January 29, 2026 22:06
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

case w.resizeChan <- &guest.WindowSize{Rows: resizeMsg.Resize.Rows, Cols: resizeMsg.Resize.Cols}:
default:
// Channel full, skip
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Panic risk when sending to closed resize channel

Medium Severity

The resizeChan is closed via defer (line 129) before the WebSocket is closed (line 75), due to LIFO defer ordering. The wsReadWriter.Read method's select statement at lines 228-232 sends to w.resizeChan, but sending to a closed channel in Go causes a panic—even within a select with a default case. If a resize message arrives after ExecIntoInstance returns but before ExecHandler completes, the orphaned stdin goroutine could panic when processing that message.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

3 participants