Skip to content

fix(rust): respond when request handlers panic#2077

Open
hogeheer499-commits wants to merge 1 commit into
github:mainfrom
hogeheer499-commits:agent/rust-handler-panic-2053
Open

fix(rust): respond when request handlers panic#2077
hogeheer499-commits wants to merge 1 commit into
github:mainfrom
hogeheer499-commits:agent/rust-handler-panic-2053

Conversation

@hogeheer499-commits

Copy link
Copy Markdown

Fixes #2053.

The Rust session event loop spawns each inbound JSON-RPC request handler independently. If one of those futures panics, Tokio isolates the panic to that task, but the request receives no response and the caller waits until its own timeout.

This catches unwinds at the request-dispatch boundary and returns JSON-RPC internal error (-32603) for the affected request. The panic payload is not exposed. It also updates the stop_event_loop documentation and tests to reflect the current lifecycle: independently spawned handlers may finish after the parent event loop exits.

Regression coverage verifies both the internal-error response and post-loop handler completion.

Tests:

  • cargo test --no-default-features --features test-support --lib (182 passed)
  • Non-live Rust integration targets, including session_test (144 passed, 3 ignored)
  • Nightly rustfmt check
  • CI-equivalent Clippy check

@hogeheer499-commits
hogeheer499-commits requested a review from a team as a code owner July 24, 2026 13:24
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.

Rust SDK: follow-ups from #2034 — spawned request handlers can outlive stop_event_loop, and a panicking handler leaves the request unanswered

1 participant