Skip to content

[pull] main from github:main - #252

Merged
pull[bot] merged 3 commits into
ehtick:mainfrom
github:main
Aug 4, 2026
Merged

[pull] main from github:main#252
pull[bot] merged 3 commits into
ehtick:mainfrom
github:main

Conversation

@pull

@pull pull Bot commented Aug 4, 2026

Copy link
Copy Markdown

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 : )

HindzStark and others added 3 commits August 4, 2026 10:51
* 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>
@pull pull Bot locked and limited conversation to collaborators Aug 4, 2026
@pull pull Bot added the ⤵️ pull label Aug 4, 2026
@pull
pull Bot merged commit 98c6834 into ehtick:main Aug 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants