Skip to content

Add regression tests for thenable RPC proxies - #330966

Merged
Joaquín Ruales (jruales) merged 1 commit into
mainfrom
jruales/test-thenable-rpc-proxies
Aug 14, 2026
Merged

Add regression tests for thenable RPC proxies#330966
Joaquín Ruales (jruales) merged 1 commit into
mainfrom
jruales/test-thenable-rpc-proxies

Conversation

@jruales

Copy link
Copy Markdown
Contributor

Follow-up to #330923, which stopped the observable debugger RPC proxies and Copilot's worker RPC proxy from answering then. This adds the regression coverage that was intentionally left out of that PR.

Why

Those proxies synthesize a callable for any property name, so without the guard proxy.then is a function and the proxy is a thenable. awaiting one — or returning it from an async function — hands the promise machinery's own resolve/reject callbacks to a remote then call that never invokes them, and the await never settles. That is the deadlock originally hit in #330571.

The guards are four unremarkable-looking lines. Without tests, a future reader can delete them as dead code and silently reintroduce a hang that only shows up as a spinner in the UI.

Tests

Test Covers
src/vs/base/test/common/observableInternal/logging/debugger/rpc.test.ts SimpleTypedRpcConnection requests + notifications proxies
extensions/copilot/src/util/node/test/worker.spec.ts createRpcProxy, exposed publicly as WorkerWithRpcProxy.proxy

Each asserts the proxy exposes no then and that awaiting it resolves to the proxy itself. The Copilot test additionally asserts no remote call was dispatched, since the failure mode is a spurious then call over the wire.

Validation

Confirmed these are genuine regression tests, not tautologies — each was run with its corresponding guard temporarily reverted and fails, then passes once restored:

  • Core, guards reverted: AssertionError: + [AsyncFunction (anonymous)] - undefined
  • Copilot, guard reverted: fails on the then assertion
  • Both green against current main

The core test needs observableInternal internals, so it carries an eslint-disable-next-line local/code-no-deep-import-of-internal matching the existing convention in src/vs/base/test/common/observables/observable.test.ts.

#330923 stopped the observable debugger RPC proxies and Copilot's worker
RPC proxy from answering `then`. Without that guard each proxy is a
thenable, so `await`ing one -- or returning it from an `async` function
-- hands the promise's own resolve/reject callbacks to a remote `then`
call that never invokes them and the await never settles.

Cover both boundaries so the guards cannot be removed silently. Each
test asserts the proxy exposes no `then` and that awaiting it resolves
to the proxy itself. Verified both fail when the corresponding guard is
reverted.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 14, 2026 21:37

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

Adds regression coverage ensuring RPC proxies cannot be treated as thenables and cause unresolved awaits.

Changes:

  • Tests debugger request and notification proxies.
  • Tests Copilot worker proxy and verifies no remote call occurs.
Show a summary per file
File Description
src/vs/base/test/common/observableInternal/logging/debugger/rpc.test.ts Covers debugger RPC proxies.
extensions/copilot/src/util/node/test/worker.spec.ts Covers the worker RPC proxy.

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: 0
  • Review effort level: Balanced

@jruales
Joaquín Ruales (jruales) enabled auto-merge (squash) August 14, 2026 21:49
@jruales
Joaquín Ruales (jruales) merged commit f764694 into main Aug 14, 2026
28 checks passed
@jruales
Joaquín Ruales (jruales) deleted the jruales/test-thenable-rpc-proxies branch August 14, 2026 21:56
@vs-code-engineering vs-code-engineering Bot added this to the 1.134.0 milestone Aug 14, 2026
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