Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cloudflare/capnweb
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: cloudflare/capnweb
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: review-bug-fixes
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 10 commits
  • 13 files changed
  • 2 contributors

Commits on Feb 6, 2026

  1. Refactor: RpcPayload.stubs -> hooks

    Instead of storing an array of RpcStub, we now store an array of the underlying StubHooks.
    
    This will make it easier to add support for new types like streams, which aren't RpcStubs, but they will wrap / be wrapped in StubHooks.
    kentonv committed Feb 6, 2026
    Configuration menu
    Copy the full SHA
    8cfa5b3 View commit details
    Browse the repository at this point in the history
  2. Add support for sending WritableStream over RPC.

    (Flow control is left for a future commit.)
    
    Written using Claude+Opencode: https://share.opencode.cloudflare.dev/share/gJU0pT8p
    
    (I cleaned some stuff up manually.)
    kentonv committed Feb 6, 2026
    Configuration menu
    Copy the full SHA
    965e1b8 View commit details
    Browse the repository at this point in the history
  3. Add support for sending a ReadableStream over RPC.

    As described in protocol.md, the basic idea here is that whenever we want to send a ReadableStream, we first send a message to the other side creating a "pipe". We pump our ReadableStream to the pipe's WritableSteam end, and we deliver the pipe's ReadableStream end to the remote peer. This way, we can begin pushing bytes immediately upon sending a ReadableStream, without waiting for the remote end to call back asking for the bytes (which would be an unnecessary round trip).
    
    Written using Claude+Opencode: https://share.opencode.cloudflare.dev/share/ctbbBnOu
    kentonv committed Feb 6, 2026
    Configuration menu
    Copy the full SHA
    c83901f View commit details
    Browse the repository at this point in the history
  4. Implement backpressure for streams.

    If more than 256kb of writes are in flight, we pause writes until past writes complete so that the number drops back below 256kb.
    
    Future commits will expand the window size.
    
    Written using Claude+Opencode: https://share.opencode.cloudflare.dev/share/D1bqkx2K
    
    This was not the best Claude session. I could probably have done it faster by hand.
    kentonv committed Feb 6, 2026
    Configuration menu
    Copy the full SHA
    09e0201 View commit details
    Browse the repository at this point in the history
  5. Optimization: Elide "pull" and "resolve" for streaming calls.

    We add a new "stream" message to the protocol which skips these. See protocol.md for explanation.
    
    (Since this is only used for streams, which were just introduced in this PR, this is not a breaking change.)
    
    Written using Claude+Opencode: https://share.opencode.cloudflare.dev/share/OfY838e7
    kentonv committed Feb 6, 2026
    Configuration menu
    Copy the full SHA
    885524e View commit details
    Browse the repository at this point in the history
  6. Add changeset for streaming.

    kentonv committed Feb 6, 2026
    Configuration menu
    Copy the full SHA
    df03a6a View commit details
    Browse the repository at this point in the history

Commits on Feb 7, 2026

  1. Adaptively resize streaming windows.

    With this change, we'll automatically update a stream's window size based on the observed bandwidth-delay product, in order to fully saturate the stream with minimal additional buffer bloat.
    
    The algorithm works by observing when each stream chunk is sent and acknowledged (via return from the RPC), allowing us to calculate:
    1. Minimum round trip time.
    2. Running average bandwidth over the last RTT.
    
    From that we calculate bandwidth-delay product and adjust the window to match. We actually set the window a bit bigger than the calculated BDP during startup (2x) and steady-state (1.25x) so that we can observe if the actual bandwidth is greater than expected, and thus update the window accordingly.
    
    I worked with Claude+Opencode to design the algorithm and implement, although I significantly refactored almost everything it wrote as the code was pretty meh: https://share.opencode.cloudflare.dev/share/rGV0SKLW
    kentonv committed Feb 7, 2026
    Configuration menu
    Copy the full SHA
    8cb6a74 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ef3f6e6 View commit details
    Browse the repository at this point in the history

Commits on Feb 12, 2026

  1. failing tests: blocked-write-lost-wakeup, readable-not-tracked-for-di…

    …sposal
    
    blocked-write-lost-wakeup: windowResolver in createWritableStreamFromHook
    never settled when all pending writes error. Error handler (streams.ts:359)
    calls fc.onError() and sets pendingError but doesn't settle windowResolver.
    Write blocked on flow control window hangs forever. Affects await
    writer.write(), pipeTo(), and abort() (which waits for pending write per
    WritableStream spec).
    
    readable-not-tracked-for-disposal: Evaluator ['readable'] case
    (serialize.ts:565) doesn't push hook to this.hooks[]. Compare with
    ['writable'] case (line 553) which does. Disposed RpcPayload containing a
    ReadableStream won't cancel the stream.
    
    args-leak-on-throw (not tested): WritableStreamStubHook.call doesn't dispose
    args when getState() or path validation throws. Only triggers on peer
    misbehavior (disposed hook or malformed wire messages), not normal user
    actions. Skipped.
    dmmulroy committed Feb 12, 2026
    Configuration menu
    Copy the full SHA
    1d8f4cd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6656e3c View commit details
    Browse the repository at this point in the history
Loading