Skip to content

fix(runtime-core): reject oversized frames before they reach the sidecar - #2066

Merged
eersnington merged 1 commit into
mainfrom
fix/oversized-sidecar-frames
Oct 21, 2026
Merged

eersnington merged 1 commit into
mainfrom
fix/oversized-sidecar-frames

Conversation

@eersnington

Copy link
Copy Markdown
Member

Fixes #2051.

A writeFile over the 16 MiB frame limit stopped the shared sidecar, which took down every VM on it, and then an uncaught EPIPE crashed the host process.

  • The TS client now checks each encoded frame against the max_frame_bytes from the handshake and rejects an oversized one with a typed SidecarFrameTooLarge before writing it, as the Rust client already does. The sidecar and its other VMs stay up.
  • A write still in flight when the transport is disposed no longer leaves the stream without an error listener. A late EPIPE is logged to stderr instead of crashing the host.
  • resource-limits.mdx documents the frame limit and the per-request ceiling for writeFile after base64.
13 MiB writeFile from VM A, VM B on the same sidecar main This PR
VM A SidecarProcessExited SidecarFrameTooLarge
VM B dead still answers
Host uncaught EPIPE no crash

@railway-app

railway-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

This PR was not deployed automatically as @eersnington does not have access to the Railway project.

In order to get automatic PR deploys, please add @eersnington to your workspace on Railway.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

📟 Pip-Boy · 79b018e

📦 Packages · fresh npm install resolve, no lockfile · this PR vs base

package (linux-x64-gnu) @latest base this PR Δ vs base packages
@rivet-dev/agentos-core 458.2 MB 325.9 MB 325.9 MB +3.4 KB (+0.0%) 10 (0)
@rivet-dev/agentos-runtime-core 253.6 MB 253.6 MB 253.6 MB +3.4 KB (+0.0%) 6 (0)
`@rivet-dev/agentos-core` details
platform base this PR Δ
linux-x64-gnu 325.9 MB 325.9 MB +3.4 KB (+0.0%)
linux-arm64-gnu 323.1 MB 323.1 MB +3.4 KB (+0.0%)
darwin-arm64 302.4 MB 302.4 MB +3.4 KB (+0.0%)
darwin-x64 311.9 MB 311.9 MB +3.4 KB (+0.0%)
win32-x64 182.3 MB 182.3 MB +3.4 KB (+0.0%)

Entrypoints (own code, minified; third-party imports excluded)

entrypoint base this PR Δ imports exports
. 291.6 KB 292.7 KB +1.1 KB (+0.4%) — +SidecarFrameTooLarge
`@rivet-dev/agentos-runtime-core` details
platform base this PR Δ
linux-x64-gnu 253.6 MB 253.6 MB +3.4 KB (+0.0%)
linux-arm64-gnu 250.9 MB 250.9 MB +3.4 KB (+0.0%)
darwin-arm64 230.1 MB 230.2 MB +3.4 KB (+0.0%)
darwin-x64 239.6 MB 239.6 MB +3.4 KB (+0.0%)
win32-x64 110.0 MB 110.0 MB +3.4 KB (+0.0%)

Entrypoints (own code, minified; third-party imports excluded)

entrypoint base this PR Δ imports exports
. 248.0 KB 249.1 KB +1.1 KB (+0.5%) — +SidecarFrameTooLarge
./sidecar-client 24.6 KB 25.0 KB +448 B (+1.8%) — +SidecarFrameTooLarge
./sidecar-errors 1.1 KB 1.5 KB +448 B (+40.8%) — +SidecarFrameTooLarge
./sidecar-process 24.6 KB 25.0 KB +448 B (+1.8%) — +SidecarFrameTooLarge
All 6 packages · linux-x64-gnu
package (linux-x64-gnu) @latest base this PR Δ vs base packages
@rivet-dev/agentos-core 458.2 MB 325.9 MB 325.9 MB +3.4 KB (+0.0%) 10 (0)
@rivet-dev/agentos-node-pty 7.6 KB 18.0 KB 18.0 KB 0 1 (0)
@rivet-dev/agentos-posix 253.6 MB 253.6 MB 253.6 MB +3.4 KB (+0.0%) 7 (0)
@rivet-dev/agentos-runtime-core 253.6 MB 253.6 MB 253.6 MB +3.4 KB (+0.0%) 6 (0)
@rivet-dev/agentos-sandbox 495.5 MB 363.5 MB 363.5 MB +3.4 KB (+0.0%) 85 (0)
@rivet-dev/agentos-toolchain 130.8 KB 141.2 KB 141.2 KB 0 2 (0)

🧹 Rust dependencies

Skipped: this PR doesn't change any Rust code or dependencies.

🦀 Binaries

Skipped: this PR doesn't change any Rust code.

⏱ Timing

job wall time slowest step
zizmor 8s checkout · 2s
changes 26s checkout · 23s
footprint 2m49s Pack the base · 47s
⏭ native · ${{ matrix.platform }} — skipped
⏭ self-test — skipped
⏭ hygiene — skipped
report 27s setup-node · 10s
🔭 Full CI trace for this commit

One OpenTelemetry trace of CI and Pip-Boy for 79b018e: every job and step, with the sizes above attached. Run after CI finishes.

pnpm install --frozen-lockfile --filter 'pipboy...'
pnpm --filter pipboy pipboy trace --sha 79b018e389834b47c66a84d48ca3cc33ceb73eec

Add --otlp <url> to send it to any OTLP/HTTP collector.

Agent instruction: From a rivet-dev/agentos checkout, run the commands above, then read the trace file the last command prints. List the slowest jobs and steps and explain where CI time went.

@eersnington
eersnington force-pushed the fix/oversized-sidecar-frames branch from 5e0d87c to 36c921a Compare October 21, 2026 15:07
The TypeScript client wrote frames without checking the sidecar's negotiated max_frame_bytes. An oversized frame made the sidecar exit, which took down every VM on it. The client now rejects such a frame with SidecarFrameTooLarge before it writes it, like the Rust client does. A write still in flight when its transport is disposed now logs a late stream error (for example EPIPE) instead of crashing the host. Fixes #2051.
@eersnington
eersnington force-pushed the fix/oversized-sidecar-frames branch from 36c921a to 79b018e Compare October 21, 2026 19:25
@eersnington
eersnington merged commit 86a0d36 into main Oct 21, 2026
11 of 12 checks passed
@eersnington
eersnington deleted the fix/oversized-sidecar-frames branch October 21, 2026 19:28
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.

Uncaught EPIPE crashes the host when the sidecar dies mid-write

1 participant