End the cache-signal read when `encryptActionBoundArgs` hits the RDC (#100622)
### What? End the `CacheSignal` read in `encryptActionBoundArgs` on the Resume Data Cache hit path, so a request's `cacheReady()` can resolve. ### Why? `encryptActionBoundArgs` calls `startReadOnce()` before looking the serialized bound args up in the RDC. On a hit it returns the cached ciphertext immediately and never calls `endReadIfStarted()`, leaving the request's `CacheSignal` count at 1 forever. With `partialPrefetching` the dynamic render embeds a runtime-prefetch stream in the initial RSC payload and only writes/closes it after `cacheSignal.cacheReady()` (`startRuntimePrefetchRender`). With the read never ended, that stream is never closed, the Flight stream never ends, the HTML `</body></html>` suffix is never flushed, and the HTTP response of every partially prerendered page that renders an inline Server Function with bound args never terminates in production (`next start`). curl waits for its timeout; browsers stay in `document.readyState === "loading"`. The hit is the normal production case: the build-time prerender stores the encrypted bound args in the RDC, which is persisted in the postponed state whenever the page has at least one `"use cache"` entry. ### How? Call `endReadIfStarted()` before returning `cachedEncrypted`, mirroring the miss path (which ends the read after `encodeActionBoundArg`) and the error path. Adds an e2e test (`test/e2e/app-dir/partial-prefetching-inline-server-function`) with `cacheComponents` + `partialPrefetching`, a page that has a `"use cache"` entry, an inline Server Function closing over a prop and a `cookies()` hole; it asserts that a production fetch of the page completes and the body ends with `</html>`. Without the fix, reading the body never resolves. Fixes #100621🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by:Claude Fable 5.1 <noreply@anthropic.com>
Showing
Please
register
or
sign in
to comment