agentleFS
CloudflareKnown publishercloudflare/workerd/src/tests/streams/piping/AGENTS.md

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

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 2 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 1 mentionSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the cloudflare/workerd repository that our weekly crawl found: only 12 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about cloudflare/workerd

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

1 more on GitHub

On Hacker News · 2

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
  1. Distinctive:

    Never leave a pipe with a live infinite source and a releasable stalled write: releasing it creates an unbounded pump that starves the …

    line 60

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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)

#AreaC++TypeScriptPinned in
1non-byte chunks piped into native identitystrings 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
2writable lock after a completed pipeThroughstays locked; getWriter throwsspec 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
3write-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
4ws.close() queued BEFORE pipeTopipe 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 heldpipeToJsToJsCloseQueuedDestination(+PreventCancel)
5pipeTo brand check on a broken thisTHROWS synchronously (before the capture_async_api_throws wrapper; the WPT general.any seed); a real stream with a bad destination REJECTSboth reject (spec)brandChecks
6destination hwm 0 (never desires)pipe writes an available chunk anyway — ignores desiredSize (the WPT 'dest never desires chunks' seed family)never writes (spec)sourceErroredAfterChunkHwmZero
7dest controller error()s while the pipe waits on a readHALF-PROPAGATES: cancels the source with the error but FULFILLS the pipe promiserejects the pipe and cancels the source with the error (spec)destControllerErrorsMidPipe, destErroringWaitsForInFlightWrite
8FixedLengthStream length violations via pipeoverflow: pipe NEVER SETTLES (bounded); underflow: never settlesoverflow: rejects RangeError; underflow: never settles (parity of nonconformance)fixedLengthStreamPipeOverflow/Underflow
9already-closed source → already-closed destrejects 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
10SharedArrayBuffer-backed views into CompressionStreamcopies the shared bytes; round-tripswrite path REJECTS TypeError 'The provided value is not of type (ArrayBuffer or ArrayBufferView)' (spec: BufferSource without [AllowShared]) — while its identity stream ACCEPTS the same viewssabViewThroughCompressionRoundTrip
11abort with a backlog, destination hwm 3reads and writes one chunk at a time: only the in-flight write completesreads while desiredSize is positive; the abort waits for the three writes made (spec)abortWithBacklogHighWaterMark
12source queue after a non-fatal write rejection (identity, preventCancel)the chunk after the invalid one was already read and is droppedevery chunk after the invalid one stays readableinvalidChunkWithBacklogEndsPipe
13the source's pull aborts the pipe while the pipe reads a chunkchunk dropped; the destination's pending read rejectschunk written before the destination is aborted (spec: read chunks are written)pipeToJsToNativeCancel
14a 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 sourcethe pipe's pending read takes it; it is written, and the pipe settles once that write has (spec)lateChunkDuringShutdownWait
15abort 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 rejectsthe 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

FlagPinned in main cellsOther 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_throwsledger #5's bad-dest rejection shape—
pedantic_wpt (dateless opt-in)piping-cpp-pedantic cellzero 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

ModuleCoverage
pipe-matrix.jsmigrated 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.jsbrand checks (ledger #5), option getter order, throwing getters, invalid signal, locked pipeThrough endpoints, lock safety when validation fails
abort-signal.jsthe 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.jsforward matrix (starts-errored × prevent* × truthy), hwm-0 dest (ledger #6), custom-error preservation (migrated from streams-error-edge-cases-test.js)
close-propagation.jsthe 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.jsbackpressure chain (migrated from streams-backpressure-test.js), stalled-dest read-ahead bound
shutdown-backlog.jsshutdown 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.jsabort 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.jscancel propagation ×2 (migrated from api/streams/streams-test.js), FixedLengthStream (ledger #8), pre-settled pairings (ledger #9)
special-buffers.jsSharedArrayBuffer-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.jsthe unflagged cell (flags table)
data-volumes.jsend-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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.