Skip to content

fix(mcp): stop notification tasks during manager shutdown - #196

Merged
BunsDev merged 1 commit into
mainfrom
fix/mcp-lifecycle-closeout
Oct 13, 2026
Merged

BunsDev merged 1 commit into
mainfrom
fix/mcp-lifecycle-closeout

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 13, 2026

Copy link
Copy Markdown
Member

Summary

Stop MCP notification tasks when their manager is dropped or explicitly shut down, including quiet streams and resource delivery blocked by a full channel.

Context

  • User request: recover the focused shutdown correction from the saved command/runtime worktree.
  • Scope: MCP notification lifecycle only. The broader CLI/plugin/scheduler draft is archived separately.

Changes

  • Add a sticky, idempotent shutdown signal that wakes idle polling and cancels blocked delivery.
  • Retain the subscription registry during delivery without retaining the manager across an await, so manager destruction can signal shutdown.
  • Add regression tests for idle-manager drop, explicit shutdown, and backpressure cancellation.
  • The public subscription registry is now Arc<DashMap<...>>; existing in-repository call sites remain compatible. The protected engine CLI/environment/stream contract is unchanged.

Validation

All Cargo commands used the stable toolchain with CARGO_INCREMENTAL=0.

  • git diff --check
  • cargo fmt --all
  • cargo test -p claurst-mcp: 55 passed
  • cargo check --workspace (no warnings)
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace: clean workspace-package rebuild, 2,132 passed, 7 ignored. An earlier shared-target run reused unrelated API/core test binaries and was discarded; workspace check, Clippy, and the full suite were rerun after cleaning all 12 local packages while preserving external dependencies.
  • Idle-manager-drop regression timed out on the original implementation, then passed after the fix.
  • Independent spec and quality review passed.
  • Manual TUI checks: N/A, no TUI behavior or layout changes.

PR Readiness

  • Diff is limited to one intended file.
  • Generated files were not edited by hand.
  • Lifecycle documentation is included with the new shutdown API.
  • No secrets, credentials, local paths, or unrelated logs are included.
  • Public Rust field ownership change is described above; no broader runtime changes are included.

@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Oct 13, 2026 1:31pm UTC

Request Review

@BunsDev
BunsDev merged commit 03a6271 into main Oct 13, 2026
5 checks passed
@BunsDev
BunsDev deleted the fix/mcp-lifecycle-closeout branch October 13, 2026 13:45

This branch was successfully deployed

1 active deployment
Preview — 36d9fdb3 Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant