fix(vscode): handle fragmented CLI startup output - #13466
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Reviewed by grok-4.6 · Input: 83.1K · Output: 11K · Cached: 482.2K Review guidance: REVIEW.md from base branch |
marius-kilocode
enabled auto-merge
August 26, 2026 12:46
marius-kilocode
disabled auto-merge
August 26, 2026 12:52
iscekic
approved these changes
Aug 26, 2026
This was referenced Aug 28, 2026
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.
What Problem This Solves
The VS Code extension discovers its local CLI backend by parsing the
kilo serve --port 0listening announcement from stdout. Process stream chunks do not preserve message boundaries, so a split announcement can make the extension wait 30 seconds for a server that is already running. A split inside the port number is worse: port43123can be accepted prematurely as43, sending the client to the wrong local address.This is the exact defect documented in #7649. The earlier fix in #7650 was closed without merging.
Open reports with matching extension startup or backend-unavailable symptoms:
These reports do not contain enough diagnostics to prove stdout fragmentation individually. They are linked as potentially affected reports, not as confirmed duplicates or automatic closures. Reports with a confirmed unrelated cause, such as SQLite migration failures or filesystem permissions, are intentionally excluded.
Why This Change Was Made
Buffer startup stdout across chunk boundaries, require a complete LF or CRLF-terminated listening line before accepting its port, and retain only a bounded 1 KB rolling buffer. Parse the complete combined output before trimming it so a valid announcement is not discarded when the same chunk also contains a large amount of subsequent output.
User Impact
Prevent intermittent "Server connection failed" banners, incorrect localhost port connections, and 30-second startup timeouts when opening the VS Code extension. The stream handling is platform-independent and explicitly covers Windows line endings.
Evidence
43was accepted instead of waiting for43123.nullinstead of43123.bun run test:unit: 4,208 passing tests across 353 files.bun run compile: extension and webview typechecks, lint, and bundling passed.bun run knipandbun run check-kilocode-changepassed.