fix(agent-core-v2): let steer interrupt background task waits - #3697
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🦋 Changeset detectedLatest commit: f0a9c84 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
teknium1
added a commit
to NousResearch/hermes-agent
that referenced
this pull request
Sep 13, 2026
…ort of MoonshotAI/kimi-code#3697) A user message sent mid-turn (CLI busy_input_mode=interrupt, gateway priority redirect, ACP redirect) goes through AIAgent.redirect(), which during tool execution degrades to steer() + request_yield() on the tool worker threads. The local terminal backend's foreground wait honours the yield (adopting the process into the background registry), but ProcessRegistry.wait() — the process_manage(action='wait') path — never checked it: a model sitting in a wait on an already-background process parked the user's message for up to the full wait window (default 180s, clamp allows more). wait() now consumes a pending yield on its own thread each poll pass and returns status "interrupted" with process_running=true and a note telling the model to respond to the user; the process is untouched and still notify-tracked. The plain-interrupt and timeout paths are unchanged. Live repro: on origin/main, request_yield() against a thread blocked in wait(timeout=12) had no effect (wait ran to timeout); after this change the wait releases in <1s with status=interrupted, process still running. Port of MoonshotAI/kimi-code#3697 ("let steer interrupt background task waits") adapted to Hermes' per-thread yield mechanism from 4632923.
teknium1
added a commit
to NousResearch/hermes-agent
that referenced
this pull request
Sep 13, 2026
…ort of MoonshotAI/kimi-code#3697) A user message sent mid-turn (CLI busy_input_mode=interrupt, gateway priority redirect, ACP redirect) goes through AIAgent.redirect(), which during tool execution degrades to steer() + request_yield() on the tool worker threads. The local terminal backend's foreground wait honours the yield (adopting the process into the background registry), but ProcessRegistry.wait() — the process_manage(action='wait') path — never checked it: a model sitting in a wait on an already-background process parked the user's message for up to the full wait window (default 180s, clamp allows more). wait() now consumes a pending yield on its own thread each poll pass and returns status "interrupted" with process_running=true and a note telling the model to respond to the user; the process is untouched and still notify-tracked. The plain-interrupt and timeout paths are unchanged. Live repro: on origin/main, request_yield() against a thread blocked in wait(timeout=12) had no effect (wait ran to timeout); after this change the wait releases in <1s with status=interrupted, process still running. Port of MoonshotAI/kimi-code#3697 ("let steer interrupt background task waits") adapted to Hermes' per-thread yield mechanism from 4632923.
teknium1
added a commit
to NousResearch/hermes-agent
that referenced
this pull request
Sep 13, 2026
…ort of MoonshotAI/kimi-code#3697) A user message sent mid-turn (CLI busy_input_mode=interrupt, gateway priority redirect, ACP redirect) goes through AIAgent.redirect(), which during tool execution degrades to steer() + request_yield() on the tool worker threads. The local terminal backend's foreground wait honours the yield (adopting the process into the background registry), but ProcessRegistry.wait() — the process_manage(action='wait') path — never checked it: a model sitting in a wait on an already-background process parked the user's message for up to the full wait window (default 180s, clamp allows more). wait() now consumes a pending yield on its own thread each poll pass and returns status "interrupted" with process_running=true and a note telling the model to respond to the user; the process is untouched and still notify-tracked. The plain-interrupt and timeout paths are unchanged. Live repro: on origin/main, request_yield() against a thread blocked in wait(timeout=12) had no effect (wait ran to timeout); after this change the wait releases in <1s with status=interrupted, process still running. Port of MoonshotAI/kimi-code#3697 ("let steer interrupt background task waits") adapted to Hermes' per-thread yield mechanism from 4632923.
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.
Related Issue
No linked GitHub issue. This addresses new steering messages being blocked while the agent waits for a background task.
Problem
When the model calls
WaitFor, steering adds input for the next step but does not release the active wait. A user can therefore wait up to 600 seconds before the model handles their new message, even though the background task runs independently.What changed
WaitForreturns a non-errorinterruptedresult when steered, preserving tool history and leaving background tasks running.Validation:
pnpm --filter @moonshot-ai/agent-core-v2 run typecheckpassed.pnpm run lintpassed with zero errors; existing repository warnings remain.pnpm -C docs run buildpassed.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.