Skip to content

fix(node): reject sendAndWait on session shutdown - #2336

Open
connor4312 wants to merge 2 commits into
github:mainfrom
connor4312:fix/send-and-wait-session-shutdown
Open

fix(node): reject sendAndWait on session shutdown#2336
connor4312 wants to merge 2 commits into
github:mainfrom
connor4312:fix/send-and-wait-session-shutdown

Conversation

@connor4312

@connor4312 connor4312 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The runtime now emits session.shutdown when a session is torn down during an accepted turn, but sendAndWait() previously only observed session.idle and session.error, leaving callers waiting until timeout.

POC: index.js

Validation

  • npm test -- session-send-and-wait.test.ts
  • npm run typecheck
  • npm run lint -- --quiet
  • npm run format:check
  • deterministic resumed-session POC against the local SDK and current runtime main

Treat session.shutdown as a terminal outcome while waiting for a response, including when the send RPC itself remains pending.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Node.js sendAndWait() to reject when a session shuts down before becoming idle.

Changes:

  • Adds shutdown handling during pending sends.
  • Adds regression coverage for lost sessions.
Show a summary per file
File Description
nodejs/src/session.ts Races pending sends against session shutdown.
nodejs/test/session-send-and-wait.test.ts Tests shutdown rejection behavior.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread nodejs/src/session.ts Outdated
Use a shared terminal latch so a later shutdown cannot override an earlier idle or error while the send RPC is still pending.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@connor4312
connor4312 enabled auto-merge August 14, 2026 20:38
@rotationtv1-crypto

Copy link
Copy Markdown

Click link for telegram and come join the future with (Rotationtvnetwork LLC) Everything from AI automation, too Web3 tokenization technology, NFT'S. Rotationtvnetwork has AI NATIVE telegram mini apps for personal and enterprise grade companies. Our motto at ( Rotationtvnetwork) is we keep buiness Rotating globally 🌎 ✨ and we quantum precision and quality ratings. From building your Brand and buiness portfolio to building your company website, Rotationtvnetwork LLC is here too keep your Enterprise running even while your sleep. Click the link in Bio and Let's get you in Rotation ♾️ 🌍

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.

3 participants