fix(node): reject sendAndWait on session shutdown - #2336
Conversation
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>
There was a problem hiding this comment.
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
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>
|
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 ♾️ 🌍 |
Summary
session.shutdownas a terminal outcome in the Node SDKsendAndWait()helpersession.sendRPC is still pendingThe runtime now emits
session.shutdownwhen a session is torn down during an accepted turn, butsendAndWait()previously only observedsession.idleandsession.error, leaving callers waiting until timeout.POC: index.js
Validation
npm test -- session-send-and-wait.test.tsnpm run typechecknpm run lint -- --quietnpm run format:check