Conversation
f15be06 to
7e59f6c
Compare
7e59f6c to
efe1b41
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the terminal implementation to improve WebSocket connection handling, fix focus management bugs, and optimize rendering performance. The changes upgrade ghostty-web from 0.3.0 to 0.4.0 (removing the need for a patch), redesign PTY socket tracking using WeakMaps instead of Bun-specific ws.data objects, and implement a DOM mounting optimization that keeps the terminal mounted after first open.
Changes:
- Upgraded ghostty-web to 0.4.0 and removed associated patch for Unicode codepoint validation
- Redesigned PTY WebSocket tracking to use WeakMaps with unique socket IDs instead of relying on
ws.data - Optimized terminal panel rendering to keep DOM mounted after first open (hidden with display:none when closed)
- Fixed focus management bug in terminal-panel.tsx (line 95:
opened()→open()) - Improved WebSocket lifecycle management with
closingflag to prevent race conditions during cleanup
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| patches/ghostty-web@0.3.0.patch | Removed patch file as Unicode validation is now handled in upstream v0.4.0 |
| packages/opencode/test/pty/pty-output-isolation.test.ts | Removed ws.data references and obsolete test for Bun-specific recycling scenario |
| packages/opencode/src/server/routes/pty.ts | Simplified Socket type and validation by removing ws.data dependency |
| packages/opencode/src/pty/index.ts | Implemented WeakMap-based socket tracking with unique IDs for robust connection isolation |
| packages/app/src/pages/session/terminal-panel.tsx | Added rendering optimization with everOpened state and fixed focus management logic |
| packages/app/src/components/terminal.tsx | Improved write operations with promises and added closing flag for safer cleanup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.