fix(shell): resolve bash timeout hang when daemon inherits stdio pipes - #10
Merged
Merged
Conversation
Collaborator
Author
sailist
force-pushed
the
haozhe/timeout-bugfix
branch
from
May 25, 2026 07:42
055a1ca to
7183e78
Compare
- destroy stdout/stderr on abort to release stdio pipes held by detached daemons\n- use `exit` instead of `close` event to resolve exit promise
sailist
force-pushed
the
haozhe/timeout-bugfix
branch
from
May 25, 2026 07:44
7183e78 to
cf73f1f
Compare
RealKai42
approved these changes
May 25, 2026
wintrover
added a commit
to wintrover/kimy
that referenced
this pull request
Jun 29, 2026
- kimy wrapper: move hash writes after smoke test (MoonshotAI#1) - kimy wrapper: add public/ to web hash inputs (MoonshotAI#3) - kimy wrapper: widen vis hash to include config files (MoonshotAI#4) - kimy wrapper: move lockfile from /tmp to ~/.kimy/bin (MoonshotAI#5) - kimy wrapper: use explicit package list for native hash (MoonshotAI#7) - 01-bundle.mjs: skip vis-asset build when already done (MoonshotAI#2) - justfile: sync deploy with new wrapper, add deploy-full (MoonshotAI#9,MoonshotAI#10,MoonshotAI#11) - flake.nix: add unpin guidance to nixpkgs comment (MoonshotAI#12)
asdshuaishuai
pushed a commit
to d2rabbit/kimi-code
that referenced
this pull request
Jul 21, 2026
…onshotAI#10) The mention machinery existed but had four UX gaps that made it feel broken: 1. **Empty query returned nothing.** Typing '@' alone wouldn't show any suggestions because searchMention short-circuited on falsy query. Now an empty query is treated as 'give me the default ranking' and the daemon's searchFiles returns a sensible default (recent / popular files). The user sees a populated menu the moment they hit @. 2. **Stale async overwrites.** Typing fast fired several searchFiles requests; the slowest one would land last and clobber the right answer. Added an incrementing sequence id — only the response matching the current seq is committed to mentionResults. 3. **mentionIndex past end of new list.** When a new search returned a shorter list, the old mentionIndex could point past the end. An $effect now resets mentionIndex to 0 whenever mentionResults changes. 4. **insertMention was fragile.** The previous implementation used lastIndexOf('@') without verifying the token between @ and cursor was still the same — typing a stray @ somewhere else in the textarea and then mentioning a file could insert the path at the wrong spot. Now we check the slice between the candidate @ and the cursor: if it contains whitespace we bail without modifying text. The caret is also moved to just after the inserted trailing space so the user can immediately keep typing. 5. **Mouse / keyboard were not synced.** Hovering a mention-item with the mouse now updates mentionIndex, so the next Enter key press picks the visually highlighted item. Each item also has role=option and aria-selected for screen-reader parity. 6. **File vs folder icon.** Items whose path ends with '/' or kind is 'dir' get a folder icon; everything else gets file-text. svelte-check 0 errors.
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 bug where the Bash tool'''s timeout would not take effect when a command spawned a detached daemon process that inherited stdio pipes. The agent would hang indefinitely because the process exit promise waited for stdio streams to close, which never happened while the daemon held the pipe file descriptors open.
1. Destroy stdio streams on abort in BashTool
Problem: When a Bash command spawned a detached daemon that inherited stdout/stderr pipes, aborting the shell command did not release those pipes. The daemon kept the file descriptors open, preventing the
closeevent from firing and causing the agent to hang indefinitely.What was done:
proc.stdoutandproc.stderrin the abort handler insideBashToolto forcibly close the stdio pipes.2. Use
exitinstead ofclosein LocalProcessProblem:
child.on('\''close'\'')waits for all stdio streams to close before resolving the exit promise. If a detached daemon inherits stdio pipes, thecloseevent never fires.What was done:
closetoexitinLocalProcessso the exit promise resolves as soon as the child process itself terminates, regardless of stdio stream state.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.