Repository navigation
fix(integrations): cancel the Hermes MCP actor once so a repeat shutdown cannot orphan bm mcp - #2052
Merged
Merged
Conversation
…own cannot orphan bm mcp When start() times out it cancels the actor task, and stdio_client then runs a shielded teardown that closes stdin, waits, and kills the child's process group. If shutdown() is called again before that teardown ends (the provider's own cleanup after the failed start, or the host's shutdown hook), request_stop() cancels the task a second time. A repeat native cancel breaks the shield, the teardown is abandoned, and the `bm mcp` child keeps running. Cancel the task at most once per run; later shutdown() calls only join. Fixes #1649 Signed-off-by: tonydzi <194927794+tonydzi@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…op request #2049's guard covered repeat cancels, but a ready actor's first shutdown() resolves the stop future without marking the stop, so a second shutdown() during stdio teardown still cancelled the task and could orphan bm mcp (Codex review on #2049). One _stop_sent flag now covers both paths, and a regression test drives the graceful one. Co-Authored-By: tonydzi <194927794+tonydzi@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CMYVL4TcbWdXhdvAzxfqjo Signed-off-by: phernandez <paul@basicmachines.co>
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. |
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.
Salvages #2049 by @tonydzi onto an in-repo branch so CI runs, and fixes its open Codex finding. Fixes #1649.
Commit 1 (@tonydzi, unchanged).
_BmMcpActor.shutdown()cancels the actor task at most once per run. A secondshutdown()during the timed-out start's teardown used to cancel again. That second cancel brokestdio_client's shielded teardown and leftbm mcprunning. See #2049 for the reproduction against the realmcptransport.Commit 2 (follow-up). On a ready actor, the first
shutdown()stops it gracefully by resolving the stop future. That path didn't record the stop, so a secondshutdown()during the same teardown still calledtask.cancel(). One_stop_sentflag now covers both the cancel and the graceful stop.The new test
test_repeat_shutdown_does_not_cancel_graceful_teardownfails on commit 1 and passes on commit 2.Verification:
just package-check-hermes(361 passed, 21 skipped) andjust fast-check.🤖 Generated with Claude Code
https://claude.ai/code/session_01CMYVL4TcbWdXhdvAzxfqjo