fix(vscode): speed up embedded terminal startup and fix cold-connection race - #12630
Merged
Merged
Conversation
…on race Replay retained PTY startup bytes from cursor 0 on initial xterm attachment so shells receive capability queries emitted before the WebSocket connected. Fish previously waited ~2s for a terminal capability response that xterm never saw, then displayed the prompt. Local terminal creation no longer waits for unrelated Agent Manager worktree recovery, and now joins the shared backend connection via getClientAsync instead of racing the synchronous getClient accessor, which could fail with 'Not connected' during cold kilo serve startup. Worktree terminals still gate on state recovery since they need the recovered worktree path.
marius-kilocode
enabled auto-merge (squash)
July 29, 2026 08:20
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (5 files)
Reviewed by claude-sonnet-5 · Input: 34 · Output: 7.7K · Cached: 918.3K Review guidance: REVIEW.md from base branch |
chrarnoldus
approved these changes
Jul 29, 2026
This was referenced Jul 29, 2026
This was referenced Jul 31, 2026
t7tran
pushed a commit
to t7tran/kilocode
that referenced
this pull request
Aug 14, 2026
…on race (Kilo-Org#12630) Replay retained PTY startup bytes from cursor 0 on initial xterm attachment so shells receive capability queries emitted before the WebSocket connected. Fish previously waited ~2s for a terminal capability response that xterm never saw, then displayed the prompt. Local terminal creation no longer waits for unrelated Agent Manager worktree recovery, and now joins the shared backend connection via getClientAsync instead of racing the synchronous getClient accessor, which could fail with 'Not connected' during cold kilo serve startup. Worktree terminals still gate on state recovery since they need the recovered worktree path.
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.
Problem
Embedded Agent Manager terminals displayed a visible delay on startup. Fish shells waited roughly two seconds before showing the prompt, and terminal creation could fail with
Not connectedwhen the user opened a terminal whilekilo servewas still starting. Local terminals also waited for unrelated Agent Manager worktree/session state recovery before opening.What changed
cursor=0instead ofcursor=-1. The backend PTY can emit shell capability queries (and early output) between PTY creation and xterm connection; tailing from-1discarded those bytes. xterm now receives the replayed startup data, answers Fish's capability handshake immediately, and the prompt appears without the timeout. Each newly created terminal has one initial attachment, so there is no duplicate-output risk.getClientAsync()rather than calling the synchronousgetClient()accessor. Whenkilo serveis already starting, the request joins that connection instead of failing withNot connected.Why
The missed capability handshake was a concrete user-visible regression for Fish users. The cold-connection race made terminal creation unreliable on first use in a window. Both are fixed in Kilo-owned extension code with no shared OpenCode changes.
Validation
knip, andcheck-kilocode-changepass.