From 933dd2c63d60e0fb78eaf5f55197525e07e211ef Mon Sep 17 00:00:00 2001 From: ci-check Date: Fri, 20 Nov 2026 17:05:25 +0800 Subject: [PATCH] docs: document the preflight fail-fast egress invariant (#7376) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Record at the fail-fast decision point (the only egress gate for the main payload) that preflightCompressIfNeeded runs to completion BEFORE forward() is ever reached, and that it performs no upstream I/O for the main body — so a fail-fast verdict means the main payload was never sent upstream, and the only egress during preflight is the separate summarization call. Closes #7376 --- src/server/handle.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/server/handle.ts b/src/server/handle.ts index 82b4dc21ce..56ce735104 100644 --- a/src/server/handle.ts +++ b/src/server/handle.ts @@ -3426,6 +3426,17 @@ async function handleRequest( // #301: the payload still overflows the window and // preflight could not fix it — answer with a // structured error instead of forwarding. + // #7376: this is the only egress decision point for the + // main payload. preflightCompressIfNeeded (above) runs + // to completion BEFORE forward() is ever reached (below, + // only when this branch is NOT taken) — it is a local + // token-estimate + fold computation with no upstream I/O + // for the MAIN body, so a fail-fast verdict means the + // main payload was never sent upstream. The only egress + // during preflight is the separate, smaller + // summarization call (external summary chain) — a + // different request, not the fail-fasted payload. The + // "NOT forwarded" wording is therefore always true. if (respondFailFast && outcome.respond && !res.destroyed) { if (res.headersSent) { // #568: the hold already committed 200 early — the status