[pull] main from github:main - #252
Merged
Merged
Conversation
* feat: support reasoningEffort 'max' in SDK types and docs * Fix Java formatting Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Steve Sanderson <SteveSandersonMS@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Stop sendAndWait from emitting an unhandled rejection
`sendAndWait` creates `idlePromise` and registers the event listener that
can reject it, but the first consumer is only attached by the
`Promise.race` further down -- after `await this.send(options)`, a full
JSON-RPC round trip to the CLI.
A `session.error` arriving in that window therefore rejects a promise
that has no handler yet. Node's rejection tracker runs at the following
checkpoint, well before the `session.send` response lands, and classifies
it as unhandled, which terminates the process under the default
`--unhandled-rejections=throw`.
The window is reachable from ordinary, non-fatal traffic. `session.log`
with `{ level: "error" }` emits a `session.error` carrying
`errorType: "notification"` (asserted in test/e2e/session.e2e.test.ts),
so a joined client or extension writing an error log line while another
caller is mid-`sendAndWait` is enough. MCP servers failing to start and
sub-agent errors do the same. A caller cannot defend against this: the
rejection is on the internal promise, not on the one `sendAndWait`
returns, so even correct `.catch`/`try` handling around the call does not
prevent the crash.
Attaching a no-op `catch` marks the promise handled without consuming the
rejection, so the `Promise.race` still observes it and `sendAndWait`
rejects with the original error exactly as before.
The added test drives a session whose `session.send` RPC is held open,
dispatches a `session.error` into the window, and asserts both that no
`unhandledRejection` fires and that `sendAndWait` still rejects. It fails
on the unfixed code with the error captured by the process-level listener.
* Model sendAndWait completion without rejected promise
Represent idle and error events as a resolved outcome so an error received while session.send is pending cannot become an unhandled rejection. Preserve send failure precedence and first-event settlement, with focused ordering tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: thejesh23 <thejesh23@users.noreply.github.com>
Co-authored-by: Steve Sanderson <SteveSandersonMS@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )