workerd / piping
AGENTS.md8.8k starsChanged 9 months agoApache-2.0View on GitHub
Informal specification of stream piping as implemented in workerd, derived from — and kept in lockstep with — this suite. The tests are the normative artifact. Endpoint behaviors belong to the sibling suites (writable/, transform/, readable/, readable-byte/); identity↔ identity piping — including the circular pipeThrough pin — lives in the identity suite's pipe-integration.js. The suite COMPLEMENTS WPT (//src/wpt:streams). The C++ seeds in piping/error-propagation-forward largely root-cause to harness shapes plus ledger #5/#6 below; piping/close-propagation-backward and error-propagation-backward are DISABLED for hangs —…
Trending
Quiet since August.thin dataabout the whole repository
Who's talking about cloudflare/workerd
- A Hacker News story“OS Workerd, Cloudflare's JavaScript/WASM Runtime”Hacker News · Sep 27, 2022 · 27 points
- withastro/astro“Cloudflare adapter returning [object Object]”GitHub · Oct 10, 2025 · 18 reactions
- supabase/supabase-js“The 'cache' field on 'RequestInitializerDict' is not implemented - Cloudflare Workers”GitHub · Mar 28, 2024 · 16 reactions
- nodejs/node“src: improve buffer.transcode performance”GitHub · Aug 1, 2024 · 13 reactions
- NixOS/nixpkgs“Package request: workerd”GitHub · Nov 12, 2024 · 12 reactions
The biggest 5 of 12 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 12
Talked about on GitHub, Bluesky and Hacker News (12 times).
On GitHub · 6
- Oct 10, 2025Cloudflare adapter returning [object Object] — withastro/astro18 reactions · 15 comments
- Mar 28, 2024The 'cache' field on 'RequestInitializerDict' is not implemented - Cloudflare Workers — supabase/supabase-js16 reactions · 24 comments
- Aug 1, 2024src: improve buffer.transcode performance — nodejs/node13 reactions · 26 comments
- Nov 12, 2024Package request: workerd — NixOS/nixpkgs12 reactions · 8 comments
- Feb 19, 2024Add Curve25519 — w3c/webcrypto9 reactions · 16 comments
1 more on GitHub
- Nov 3, 2025Optimize TextEncoder::encode — nodejs/performance7 reactions · 33 comments
On Bluesky · 4
- Mar 24, 2026workerd : le runtime JavaScript/Wasm open source de Cloudflare Workers — @news.humancoders.com4 likes and reposts
- Aug 22, 2026Current status: trying to build github.com/cloudflare/w... on various sandbox providers — @jeremymorrell.dev1 likes and repost
- Mar 24, 2026workerd : le runtime JavaScript/Wasm qui propulse Cloudflare Workers est maintenant open source. Basé sur les standards web, il permet… — @humancoders.com1 likes and repost
- Nov 5, 2024Technically workers are open source github.com/cloudflare/w... — @userops.bsky.social1 likes and repost
On Hacker News · 2
- Sep 27, 2022OS Workerd, Cloudflare's JavaScript/WASM Runtime27 points · 2 comments
- Oct 5, 2023Cloudflare workers is adopting Ada URL parser2 points
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository61 other files it gives its agents.
- AGENTS.mdAGENTS.md
- build/AGENTS.mdAGENTS.md
- src/cloudflare/AGENTS.mdAGENTS.md
- src/node/AGENTS.mdAGENTS.md
- src/per_isolate/AGENTS.mdAGENTS.md
- src/per_isolate/crypto/AGENTS.mdAGENTS.md
- src/per_isolate/webfs/AGENTS.mdAGENTS.md
- src/per_isolate/webstreams/AGENTS.mdAGENTS.md
- src/pyodide/AGENTS.mdAGENTS.md
- src/rust/AGENTS.mdAGENTS.md
- src/rust/cxx/AGENTS.mdAGENTS.md
- src/tests/node/AGENTS.mdAGENTS.md
- src/tests/node/http-client/AGENTS.mdAGENTS.md
- src/tests/node/http-server/AGENTS.mdAGENTS.md
- src/tests/node/net/AGENTS.mdAGENTS.md
- src/tests/node/stream/AGENTS.mdAGENTS.md
- src/tests/streams/AGENTS.mdAGENTS.md
- src/tests/streams/cache/AGENTS.mdAGENTS.md
- src/tests/streams/compression/AGENTS.mdAGENTS.md
- src/tests/streams/digest/AGENTS.mdAGENTS.md
- src/tests/streams/encoding/AGENTS.mdAGENTS.md
- src/tests/streams/formdata/AGENTS.mdAGENTS.md
- src/tests/streams/htmlrewriter/AGENTS.mdAGENTS.md
- src/tests/streams/identity/AGENTS.mdAGENTS.md
- src/tests/streams/inspect/AGENTS.mdAGENTS.md
- src/tests/streams/iocontext/AGENTS.mdAGENTS.md
- src/tests/streams/r2-patterns/AGENTS.mdAGENTS.md
- src/tests/streams/readable/AGENTS.mdAGENTS.md
- src/tests/streams/readable-byte/AGENTS.mdAGENTS.md
- src/tests/streams/scaling/AGENTS.mdAGENTS.md
- src/tests/streams/sockets/AGENTS.mdAGENTS.md
- src/tests/streams/strategies/AGENTS.mdAGENTS.md
- src/tests/streams/transform/AGENTS.mdAGENTS.md
- src/tests/streams/writable/AGENTS.mdAGENTS.md
- src/workerd/api/AGENTS.mdAGENTS.md
- src/workerd/api/crypto/AGENTS.mdAGENTS.md
- src/workerd/api/node/AGENTS.mdAGENTS.md
- src/workerd/api/streams/AGENTS.mdAGENTS.md
- src/workerd/io/AGENTS.mdAGENTS.md
- src/workerd/jsg/AGENTS.mdAGENTS.md
- src/workerd/server/AGENTS.mdAGENTS.md
- src/workerd/util/AGENTS.mdAGENTS.md
- types/AGENTS.mdAGENTS.md
- bazel-test-hygieneSkill
- commit-categoriesSkill
- dad-jokesSkill
- find-and-run-testsSkill
- identify-reviewerSkill
- investigation-notesSkill
- kj-styleSkill
- markdown-draftsSkill
- parent-project-skillsSkill
- pr-review-guideSkill
- receiving-code-reviewSkill
- rust-reviewSkill
- ts-styleSkill
- update-v8Skill
- wd-test-formatSkill
- workerd-api-reviewSkill
- workerd-safety-reviewSkill
- The first 60 shown.
The file
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 60
Never leave a pipe with a live infinite source and a releasable stalled write: releasing it creates an unbounded pump that starves the …
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
pipeTo / pipeThrough
Informal specification of stream piping as implemented in workerd, derived from — and kept in lockstep with — this suite. The tests are the normative artifact. Endpoint behaviors belong to the sibling suites (writable/, transform/, readable/, readable-byte/); identity↔ identity piping — including the circular pipeThrough pin — lives in the identity suite's pipe-integration.js.
The suite COMPLEMENTS WPT (//src/wpt:streams). The C++ seeds in
piping/error-propagation-forward largely root-cause to harness shapes
plus ledger #5/#6 below; piping/close-propagation-backward and
error-propagation-backward are DISABLED for hangs — this suite covers
that territory with BOUNDED observations (a pinned 'pending' outcome is
a deliberate defect pin, not a hole).
Divergence ledger (C++ vs TypeScript)
| # | Area | C++ | TypeScript | Pinned in |
| 1 | non-byte chunks piped into native identity | strings are UTF-8 encoded and pass through on both; the NUMBER chunk fails the pipe — C++ rejects 'This WritableStream only supports writing byte types.'; TypeScript surfaces the identity validation TypeError through the non-fatal write-rejection pipe path (dest aborted, downstream reads reject) | pipeThroughJsToInternal | |
| 2 | writable lock after a completed pipeThrough | stays locked; getWriter throws | spec finalize: both locks release when the pipe settles — one macrotask after the output's done, .locked is deterministically false and getWriter() succeeds (the release cascade is not synchronized with the output's done delivery, so loop-exit-instant reads are unspecified; .locked and getWriter share one predicate and never disagree at an instant) | pipeThroughJsToInternalCloses |
| 3 | write-after-close rejection message | 'This WritableStream has been closed.' | 'Cannot write to a stream that is closing or closed' (CLOSED_WRITE_MSG helper) | pipeToInternalToJsSimple, pipeToInternalToJsClose |
| 4 | ws.close() queued BEFORE pipeTo | pipe locks both ends, waits, cancels source with 'This destination writable stream is closed.', then RESOLVES (see the TODO(conform) in the test) | pipe REJECTS IMMEDIATELY 'Destination closed before the pipe completed', cancels source with the same error (preventCancel suppresses), locks never observed held | pipeToJsToJsCloseQueuedDestination(+PreventCancel) |
| 5 | pipeTo brand check on a broken this | THROWS synchronously (before the capture_async_api_throws wrapper; the WPT general.any seed); a real stream with a bad destination REJECTS | both reject (spec) | brandChecks |
| 6 | destination hwm 0 (never desires) | pipe writes an available chunk anyway — ignores desiredSize (the WPT 'dest never desires chunks' seed family) | never writes (spec) | sourceErroredAfterChunkHwmZero |
| 7 | dest controller error()s while the pipe waits on a read | HALF-PROPAGATES: cancels the source with the error but FULFILLS the pipe promise | rejects the pipe and cancels the source with the error (spec) | destControllerErrorsMidPipe, destErroringWaitsForInFlightWrite |
| 8 | FixedLengthStream length violations via pipe | overflow: pipe NEVER SETTLES (bounded); underflow: never settles | overflow: rejects RangeError; underflow: never settles (parity of nonconformance) | fixedLengthStreamPipeOverflow/Underflow |
| 9 | already-closed source → already-closed dest | rejects TypeError (a C++ deviation: the spec's ordered shutdown conditions give closing-forward priority) | FULFILLS (spec; WPT multiple-propagation 'closed readable to closed writable' pins the fulfillment) | closedSourceToClosedDest |
| 10 | SharedArrayBuffer-backed views into CompressionStream | copies the shared bytes; round-trips | write path REJECTS TypeError 'The provided value is not of type (ArrayBuffer or ArrayBufferView)' (spec: BufferSource without [AllowShared]) — while its identity stream ACCEPTS the same views | sabViewThroughCompressionRoundTrip |
| 11 | abort with a backlog, destination hwm 3 | reads and writes one chunk at a time: only the in-flight write completes | reads while desiredSize is positive; the abort waits for the three writes made (spec) | abortWithBacklogHighWaterMark |
| 12 | source queue after a non-fatal write rejection (identity, preventCancel) | the chunk after the invalid one was already read and is dropped | every chunk after the invalid one stays readable | invalidChunkWithBacklogEndsPipe |
| 13 | the source's pull aborts the pipe while the pipe reads a chunk | chunk dropped; the destination's pending read rejects | chunk written before the destination is aborted (spec: read chunks are written) | pipeToJsToNativeCancel |
| 14 | a chunk reaches the source while an abort waits for an in-flight write (destination hwm 2, preventCancel) | not read while the write is in flight: the chunk stays in the source | the pipe's pending read takes it; it is written, and the pipe settles once that write has (spec) | lateChunkDuringShutdownWait |
| 15 | abort with nothing to write while the pipe waits on a read (preventCancel) | the pipe and its read stay pending and the source stays locked; the next chunk completes the read, which drops it, and the pipe then rejects | the pipe settles and releases the source; a later chunk stays readable (spec) | lateChunkAfterIdleAbort |
Parity worth noting (probed, pinned): the whole error-propagation-
forward core matrix (starts-errored rejection/hook IDENTITY on both
ends, preventAbort/preventCancel incl. TRUTHY coercion, dest stays
usable under preventAbort); option plumbing (getter order
[preventAbort, preventCancel, preventClose, signal], throwing-getter
identity with no locks taken, bad-signal TypeError); pipeThrough
locked-endpoint sync throws; a bad destination, an option getter that
locks it, or a shadowed locked fails without locking the source;
custom error type/instance preservation; cancel-propagation through native identity AND JS transforms (source
ends CLOSED, all locks release); external close()/abort() on a piped
(locked) destination rejects while the pipe proceeds; backward write-
error propagation with hook identity; backpressure through
pipeThrough().pipeTo() chains; stalled-dest read-ahead ≤ 3 with source
hwm 1 (contrast ledger #6); a pipe shut down with chunks buffered (abort,
source error, write failure, invalid identity chunk) writes nothing more
at hwm 1, and preventCancel leaves the unread chunks readable;
FixedLengthStream exact-length pipes; closed source → live dest closes
the destination. Parity of nonconformance: a chunk enqueued in the
abort's turn while the pipe waits on a read with no write in flight is
lost from both ends (lateChunkInAbortTurnIsLost; the spec writes it).
Hang discipline
Never leave a pipe with a live infinite source and a releasable stalled
write: releasing it creates an unbounded pump that starves the event
loop on BOTH implementations (120s bazel timeout). Wind down by erroring
the source FIRST, then releasing the write (pipeStopsPullingWhenDestStalls).
Compatibility flags
| Flag | Pinned in main cells | Other cells |
streams_enable_constructors + transformstream_enable_standard_constructor (2022-11-30) | yes (JS-backed endpoints) | piping-cpp-legacy: JS ctors throw the flag-naming Error; NATIVE→NATIVE pipes (body ↔ IdentityTransformStream) work unflagged |
capture_async_api_throws | ledger #5's bad-dest rejection shape | — |
pedantic_wpt (dateless opt-in) | piping-cpp-pedantic cell | zero observable deltas on this suite's surface |
| others (nodejs_compat, getters-on-prototype, toString tag, backpressure fixup, spec-compliant writer) | as in the sibling suites | — |
Module map
| Module | Coverage |
pipe-matrix.js | migrated pipe-streams-test.js wholesale (35): pipeThrough + pipeTo across JS↔native in all directions, prevent* combos, pre-aborted and mid-read AbortSignals, tee'd pipes, queued-destination close (ledger #1-#4, #13) |
api-surface.js | brand checks (ledger #5), option getter order, throwing getters, invalid signal, locked pipeThrough endpoints, lock safety when validation fails |
abort-signal.js | the pipe's AbortSignal is an abort algorithm: a synthetic 'abort' event is ignored, a listener's stopImmediatePropagation() cannot block the abort, an abort after the pipe settles does nothing |
error-propagation.js | forward matrix (starts-errored × prevent* × truthy), hwm-0 dest (ledger #6), custom-error preservation (migrated from streams-error-edge-cases-test.js) |
close-propagation.js | the WPT-disabled backward territory, bounded: external close/abort on piped dest, write-throw backward propagation, idle dest-controller error and one with a write in flight (ledger #7) |
flow-control.js | backpressure chain (migrated from streams-backpressure-test.js), stalled-dest read-ahead bound |
shutdown-backlog.js | shutdown with chunks buffered in the source: abort, source error, invalid identity chunk; what is written and what stays readable (ledger #11, #12) |
shutdown-pending-read.js | abort while the pipe waits on a read: a chunk arriving during the shutdown's wait, in the abort's turn, or after an idle abort (ledger #14, #15) |
interop.js | cancel propagation ×2 (migrated from api/streams/streams-test.js), FixedLengthStream (ledger #8), pre-settled pairings (ledger #9) |
special-buffers.js | SharedArrayBuffer-backed and resizable-buffer views through native and JS pipe endpoints (migrated from pipe-write-special-buffer-test.js, strengthened to content checks; ledger #10); the JS path delivers the very view uncopied, resizable buffers stay resizable |
legacy-pipes.js | the unflagged cell (flags table) |
data-volumes.js | end-to-end pipe volumes: 1 MiB pipeTo JS→JS, 8 MiB pipeThrough chain, 1 MiB JS→identity with body readback, 1 MiB identity→JS with a concurrent writer — all byte-exact |
Consumed sources (deleted or shrunk): pipe-streams-test.js and pipe-write-special-buffer-test.js (deleted), streams-error-edge-cases-test.js (−2), streams-backpressure-test.js (−1), api/streams/streams-test.js (−2; partiallyReadStream and inspect remain). The security regression files remain authoritative and separate: identity-transform-stream-uaf, pipe-source-error-uaf, identity-transform-stream-uaf and pipe-source-error-uaf.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

