[codex] fix remote terminal live event updates#2805
Draft
SunkenInTime wants to merge 1 commit into
Draft
Conversation
|
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 |
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.
Summary
Fixes a remote terminal rendering issue where terminal input/output can remain invisible until the user switches terminal tabs. The active terminal viewport now owns a live terminal event subscription in addition to the existing environment-level terminal event store path.
Root Cause
Terminal
open/snapshot calls and terminal live events travel through different client paths:terminal.openreturns the server-side terminal history snapshot.subscribeTerminalEventspushes incrementalTerminalEventupdates into the client store.TerminalViewportpreviously depended on the environment-level subscription populatinguseTerminalStateStore, then rendered from that store.When the environment-level terminal event path is stale, gated, or otherwise fails to deliver remote events to the store, the server can still receive PTY output and persist history, but the visible xterm does not receive incremental updates. Switching terminal tabs remounts/reopens the terminal and repaints from the snapshot, making the buffered input/output appear all at once.
Changes
api.terminal.onEventsubscription insideTerminalViewport.threadIdandterminalIdbefore applying them to xterm.terminal.writeerror handling.User Impact
This keeps active remote terminal panes live even when the broader environment terminal event/store path does not update promptly. In the reported Mac-to-Windows remote case, this fixes commands and results not appearing until switching terminal tabs.
Validation
bun run fmt apps/web/src/components/ThreadTerminalDrawer.tsx apps/web/src/components/ThreadTerminalDrawer.browser.tsxbun run test -- src/components/ThreadTerminalDrawer.test.tsbun run test -- src/environments/runtime/service.test.tsbun run test:browser -- src/components/ThreadTerminalDrawer.browser.tsxbun run typecheckgit diff --checkAlso manually tested against a Mac client connected to a Windows remote server matching
0.0.25-nightly.20260515.295; the reporter confirmed terminal updates now appear live instead of only after tab switching.Note
Fix live terminal event updates in
TerminalViewportfor remote terminalsTerminalViewportnow subscribes toapi.terminal.onEventand applies liveoutputevents to the terminal for the active thread/terminal, with cleanup on unmount.terminalEventDedupeKey, tracking up to 500 applied event keys to prevent duplicate writes.terminalWriteSpyand mock event emitter.Macroscope summarized 649c243.