fix(cli): deflake prompt and background process races - #11827
Merged
Conversation
markijbema
marked this pull request as ready for review
July 1, 2026 12:43
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by claude-sonnet-5-20260630 · Input: 6.8K · Output: 13.4K · Cached: 1.6M Review guidance: REVIEW.md from base branch |
catrielmuller
approved these changes
Jul 1, 2026
t7tran
pushed a commit
to t7tran/kilocode
that referenced
this pull request
Aug 14, 2026
…ancel-race fix(cli): deflake prompt and background process races
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
Deflake two macOS-sensitive CLI test paths:
Why
The prompt test verifies assistant finalization when cancellation interrupts processor creation, but it used the full agent layer before reaching the blocking processor. On slower CI hosts, unrelated agent initialization could consume the per-test budget before the actual race was reached.
Persistent background process readiness could also resolve from the runner's forwarded stdout before the same bytes were flushed to the persistent log file. Re-adoption then saw an empty log-backed output even though readiness had already been reported.
Notes
The prompt fixture still exercises the real prompt loop, run state, runner cancellation, and message persistence paths. The background process change preserves ordering by writing to the persistent log before forwarding output to the parent.