Repository navigation
fix: close abandoned static web asset readers - #23062
Conversation
|
Run failed. View the logs →
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe static web handler exits when a response is destroyed, ties file-stream cleanup to response events, and avoids writing status to destroyed responses. Tests cover stream lifecycle cases and real HTTP Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Abandoned static responses are fenced and their file streams cleaned up, while hourly-build callers retain the package.json fallback. No material merge risk is evidenced; normal CI validation remains appropriate. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The static handler changes and stream lifecycle tests match the stated reader-cleanup scope. The changes to
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Close abandoned readers —
static-web-client-handler.tsnow registersclose/errorlisteners on the response thatdestroy()the fileReadStream, and removes those listeners when the stream closes. A client that disconnects under backpressure no longer leaves a descriptor open, sincestream.pipe(response)alone only unpipes. - Ownership re-checks — early returns when
response.destroyedat entry, afterawait stat, and insidewriteHttpStatus, so no headers or readers are produced for a response that is already gone (covers the delayed-stat window). - Correct 500 framing — a pre-headers read error now rewrites
Content-Length: 0+Cache-Control: no-storebefore the 500 instead of advertising the asset length with an empty body; after headers it disconnects the response. - Tests — nine new tests cover 25 abandoned readers, close-before/during-stat, response/source errors, real HTTP GET/HEAD, and an empty 500; both suites pass locally (13 tests).
4d7a719 to
2b4a995
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run covered the delta since the prior pullfrog approval at 2b4a9952: commit 21741ca353, merged as 373e85aacc, which restores three missing diff-note translation keys across all six locale catalogs. The static-web handler and its tests are unchanged from the approved revision.
- Restore diff-note catalog entries —
DiffCommentDraftCardreferencesDiffCommentPopover.f6c449191e("Add note for the AI"),5fa4bfebaa("Add note"), and5e9b3d0c2e("Adding..."), which were absent from every locale's catalog; all three are now present inen,es,fr,ja,ko, andzh, each translated from an existing entry for the same English string.
ℹ️ Unrelated i18n change merged from another open PR
The delta is the head of ci/fix-note-catalog, which is also PR #23256 ("fix(i18n): restore missing diff note draft text"). The merge commit 373e85aacc pulls that PR's content into this one, so the same six-file change would land twice. The content is byte-identical and correct, and it will not conflict, but it makes this fix's diff include an unrelated i18n change and can leave #23256 a no-op. Worth confirming which PR should own the catalog restoration.
Technical details
# Duplicate i18n change across PR #23062 and PR #23256
## Affected sites
- `src/renderer/src/i18n/locales/{en,es,fr,ja,ko,zh}.json` — the added `f6c449191e` / `5fa4bfebaa` / `5e9b3d0c2e` entries under `...diff.comments.DiffCommentPopover` are identical to the diff of open PR #23256.
## Required outcome
- Decide which PR owns the catalog restoration. If #23256 is the intended vehicle, drop `373e85aacc` from this branch; otherwise close #23256 once this merges.
## Open questions for the human
- Was `ci/fix-note-catalog` merged here only to make this PR's missing-key CI check pass? If so, landing #23256 unblocks both.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
The catalog entries are an identical prerequisite from #23256, included to restore strict CI after updating from main. Git applies this content once; landing either branch does not duplicate catalog entries. #23256 is the standalone catalog review. This PR’s runtime-file change and its tests remain unchanged, and all nine focused stream tests pass at 373e85a. I am retaining the prerequisite while CI runs and will let the base comparison drop it once the catalog correction lands. |
There was a problem hiding this comment.
ℹ️ No critical issues — one minor consistency suggestion inline.
Reviewed changes
This run covered the delta since the prior pullfrog review at 373e85aacc: commit f2865ad15d, which retranslates the Japanese and Korean DiffCommentPopover.f6c449191e ("Add note for the AI") hint so the note is addressed to the AI rather than about it. The static-web handler and its tests are unchanged from the approved revision.
- Correct the ja/ko recipient wording — ja
AI に関するメモを追加→AI 向けのメモを追加, koAI에 대한 메모 추가→AI에게 전달할 메모 추가, matching the actual action (a note sent to the AI).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
f2865ad to
b608869
Compare
|
Reviewed the latest scope and docstring warnings. The four locale values reconcile shared main-branch catalog maintenance and address the reviewer’s consistency request for the identical English note placeholders. This prerequisite and its localization checks are disclosed in the description; the static handler and its tests are unchanged by the rebase. No issue will be created: the user explicitly requested PR-only work. Generic 80% docstring coverage is declined under AGENTS.md’s concise, non-obvious-comments-only policy. No new actionable code finding remains; successful current-head CI is still required. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run covered the delta since the prior pullfrog review at f2865ad15d: commit b608869dcb, a fresh-main rebase plus the Japanese/Korean wording alignment. The static-web handler and its tests are unchanged from the approved revision.
- Rebased onto fresh main — the three diff-note catalog entries added by earlier commits now exist on the base, so
en/es/fr/zhdrop out of the diff and the duplicate-with-#23256 concern is moot. - Aligned ja/ko recipient wording —
MarkdownPreview.d737791433andDiffCommentPopover.f6c449191enow share the same ja (AI 向けのメモを追加) and ko (AI에게 전달할 메모 추가) rendering for the one English source"Add note for the AI", resolving the prior inline consistency note.
Minor: the PR body's "Notes" section still describes this branch as restoring the three diff-note catalog entries, which is now stale after the rebase — cosmetic only, no code impact.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run covered the delta since the prior pullfrog review at b608869: commits 9e99e4b265 and 30975d0e22, which make the pre-existing hourly-version identity test hermetic. The static-web handler, its tests, and the ja/ko locale values are unchanged from the approved revision.
- Injectable package version —
getHourlyBuildIdentitynow accepts an optionalpackageVersionand uses it in place of readingpackage.json(packageVersion ?? JSON.parse(readFileSync(...)).version), so the release script's runtime behavior is unchanged. - Hermetic fixture for the regression test — the "unpublished buggy main release" test passes
packageVersion: '1.4.201'directly instead of mockingnode:fs, so it no longer depends on the repository's current package version. All 16 tests in the file pass locally.
ℹ️ PR description's historical-fix paragraph is now slightly stale
The "Historical release-test CI prerequisite" paragraph says "Only the test input changes—release generation and application code are unchanged," but 30975d0e22 also edits the exported getHourlyBuildIdentity in config/scripts/hourly-build-version.mjs. Runtime behavior is unchanged because the new option defaults to reading package.json, so this is documentation accuracy only.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Historical release-test CI prerequisite
The CI merge base advanced the package version beyond a historical release fixture: the test expected 1.4.203 but read today’s 1.4.214 package. The build-identity helper now accepts an optional package version alongside its existing release inputs, and that test supplies its historical 1.4.201 version. Normal callers still read package.json. Both original version/build-number assertions remain; all 16 tests pass, and two exact before/after comparisons confirm unchanged default output. Targeted lint, including the no-module-mocking rule, passes. Application and native terminal code are unchanged; fresh CI remains required.
ELI5
When a browser stops downloading an Orca web-client file, the host now closes its file reader too. It also avoids opening a reader after the browser has already left.
What Changed
Canceled bundled web-client downloads no longer accumulate file descriptors. The handler checks response ownership before and after asynchronous file inspection, stops reading when the response closes or fails, and removes its response listeners when the source closes.
Successful GET/HEAD bytes, MIME types, cache headers, allowed paths and proxy-prefixed routing remain unchanged. Read errors still produce500 before headers or disconnect afterward; the empty500 now advertises zero bytes and disables caching so clients can finish the error response and retry.
Why
Piping a stream into a response does not close the source when the client disappears under backpressure. This reuses the existing local-build feed's ownership pattern. A blanket pipeline replacement would destroy the response on a source error and lose the intended pre-header500 policy.
Linked Issue
Fixes #23060
Visual Proof
N/A — HTTP/file resource cleanup and complete error framing, with no intentional rendered change. No app was launched.
Performance proof
Actual handler, native HTTP and real synthetic files:
The unchanged permanent count test fails against exact baseline source with25 open readers. Resource counts are deterministic; read volume during disconnect is scheduling-sensitive. Buffered bytes are not a total heap measurement. No UI latency, throughput or typical cancellation-frequency claim is made.
Testing
ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/runtime/rpc/static-web-client-handler-stream.test.ts src/main/runtime/rpc/ws-transport-static-web.test.ts.Review
Merge risk: low to moderate. The change crosses stat/open/error/close boundaries in production asset serving. Exact output/header and ownership oracles cover those transitions. Independent review exercised eight additional real HTTP lifecycle cases and caught a transient-error cache-header issue before publication; the final empty500 uses no-store.
Negative user-facing trade-offs: none identified. Two one-shot response listeners and one source-close listener are limited to each GET's lifetime. No new polling, timer, queue, subprocess or retained registry. The500 framing/cache correction is an intentional improvement to error delivery; successful response lengths and cache headers are unchanged.
Invariant: each static reader belongs to its live response and cannot restart after abandonment. Failure source: repeated canceled requests and delayed stat completion. Oracle: closed descriptors/listener cleanup, no stale source and exact HTTP results. Diagnostics are test counts using synthetic files. This asset-only change does not alter a terminal/session reliability invariant or claim broader transport coverage.
Agent skill upstream boundary
Notes
The shared diff-note catalog entries are now in main and have dropped out of this diff. The remaining Japanese/Korean values make the AI the note’s recipient. The identical English placeholders in MarkdownPreview and DiffCommentPopover have matching translated values.
The serving host still owns its package files. HTTP response loss says nothing about PTY/process liveness. No RPC opcode/schema/capability, published terminal data, Git/folder-workspace handling, WSL launch or mobile terminal stream changes. HTTP and HTTPS share the handler; only HTTP was exercised.
Checklist
The Japanese/Korean recipient wording is now consistent across both the diff-note and Markdown-note placeholders. Both English keys contain “Add note for the AI”; both translated values match. This addresses the review consistency finding. All four localization gates and the nine stream tests pass after the fresh-main rebase.