Skip to content

fix(rpc): a plugin call waits until the plugin answers - #899

Merged
Blind-Striker merged 1 commit into
masterfrom
fix/868-rpc-no-network-window
Nov 15, 2026
Merged

Blind-Striker merged 1 commit into
masterfrom
fix/868-rpc-no-network-window

Conversation

@Blind-Striker

@Blind-Striker Blind-Striker commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #868

What

rpc.call answers only when the plugin's handler returns, or when the routing cache closes the RPC (rpc.unavailable). A long-lived plugin method therefore holds the response headers for as long as it runs. The SDK applied the client-wide NetworkTimeout (100 s by default) to it and cut a healthy call. opencode's own client sets no timeout on this call: the caller's signal is its only deadline.

rpc.call now joins the operations that answer only when their work ends. It runs with no network window unless the call sets one, and the cancellation token is its deadline. A per-call NetworkTimeout still bounds it.

Changes

  • OperationTraits: one row, rpc.call with HasNoNetworkWindow: true.
  • NetworkTimeoutTests: a manual-clock test. The handler holds its answer, the clock passes the client window, the exchange's token stays uncancelled, and the released answer comes back whole. The existing never-answering handler became HoldingHandler, which a test can release; the existing cut tests never release it.
  • The two expectation lists of no-window operation ids (NetworkTimeoutTests, HandWrittenTransportTableTests) gain rpc.call.
  • Docs: the Error channels list in client-runtime.md, the requests guide ("Eight calls", plus a client.Rpc.CallAsync bullet), the OpenCodeClientOptions.NetworkTimeout XML documentation and the NetworkTimeouts remarks.
  • CHANGELOG: one Fixes line.
  • Source watch: packages/core/src/rpc.ts at v2.3.0, anchored on the comment that a long-lived RPC releases its location when the routing cache invalidates it. The receipt was regenerated at the same pin: no operation changed and the anchor matched.

Verification

  • Mutation: with the rpc.call row removed, the new test fails on net10.0 and net11.0 at Assert.That(sentUnder.IsCancellationRequested).IsFalse(), not by a hang guard. With the row restored, the file is byte-identical.
  • Local check on Linux, full suite, Release:
    • build, format whitespace and format style, Slopwatch, clone gate, generate --verify, refresh-spec --verify, and both packs all pass;
    • tests: 11,419 passed, plus 18 ServiceElection and 3 NativeAot;
    • the tree stayed clean.
  • That run's net472 test build caught VSTHRD003 in the new handler. The handler now takes its answer through a Channel. A focused recheck then passed: the mutant red run, build, net472 build (0 warnings), formatting, Slopwatch, clone gate, 8,474 SDK tests and the clean tree.
  • net472 mutation proof: pending, on a Windows run.

A plugin method can hold response headers longer than the client-wide
network progress window. Let rpc.call wait until the plugin answers,
while retaining per-call windows and caller cancellation.

Pin the behavior with a manual-clock regression and the watched upstream
source, and document the timeout contract.
@Blind-Striker Blind-Striker added this to the Next milestone Nov 15, 2026
@Blind-Striker

Copy link
Copy Markdown
Collaborator Author

net472 mutation proof on f1715328 (Windows, .NET Framework 4.8.1, Release, full analyzer build):

  • Baseline: An_Rpc_Call_Should_Complete_With_Its_Answer_After_The_Client_Window_Passes passes, 1 of 1.
  • Mutant: the rpc.call row is removed from src/OpenCode.Sdk/Internal/Operations/OperationTraits.cs. The full analyzer build succeeds with 0 warnings and 0 errors. The test fails at its oracle: Expected to be false but found True (sentUnder.IsCancellationRequested). Total 1, failed 1.
  • Restore: the file is byte-identical afterwards, and git diff --exit-code is clean.

Together with the net10.0 and net11.0 runs in the description, the test fails on every target the rule ships on.

@Blind-Striker
Blind-Striker added this pull request to the merge queue Nov 15, 2026
Merged via the queue into master with commit b587e7e Nov 15, 2026
17 checks passed
@Blind-Striker
Blind-Striker deleted the fix/868-rpc-no-network-window branch November 15, 2026 15:07
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.

RPC: a plugin call fails after 100 s of silence, while upstream's client sets no timeout

1 participant