Skip to content

fix: release completed runtime RPC queue payloads - #21131

Merged
OrcaWin merged 1 commit into
mainfrom
np-oom-scan-rpc-consumed-queue
Sep 18, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
np-oom-scan-rpc-consumed-queue

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​183 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​183
Prod 15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1119 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1115

Problem and change

Completed RPC calls remain reachable through consumed lane slots while another call keeps the selector active. Their closures retain request parameters until that lane compacts or the selector becomes idle. Clear each slot when taking its entry; the active call remains owned by its completion closure.

The change preserves lane order, foreground priority, cancellation, admission and byte accounting. Production callers use this pool for remote/paired operations; their retainedBytes values currently default to zero. This does not identify a cause for the local-only report in #19831.

Validation

  • Eight completed calls capturing 1 MiB each: eight payloads remain reachable before, zero after, on Node 26 and installed Electron 43.7 in Node mode. A rolling cross-lane control keeps the selector active across 70 finite calls.
  • Active-call ownership, queued cancellation, synchronous failure, eventual compaction/idle cleanup, and a 140-call mixed burst preserve behavior. All 14 queue tests pass; the reconstructed baseline fails the three retention regressions.
  • Electron also retains fresh response payloads through saved resolve functions; Node 26 does not. An independent resolver control records this runtime difference.
  • Node/Web typechecks and changed-code quality pass. The committed proof reruns successfully.

The portable proof and source hashes include bounded before/after cases and runtime-specific results. Record count is bounded by existing compaction/admission behavior; this is unnecessary retention, not proof of unlimited growth or an incident's magnitude.

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 559e80c2-2ff5-4375-8168-b6c2e98477bc

📥 Commits

Reviewing files that changed from the base of the PR and between 77cd61d and 671bf4c.

📒 Files selected for processing (16)
  • docs/audits/runtime-rpc-consumed-queue/README.md
  • docs/audits/runtime-rpc-consumed-queue/baseline.config.mjs
  • docs/audits/runtime-rpc-consumed-queue/electron-extended-results.json
  • docs/audits/runtime-rpc-consumed-queue/electron-resolver-results.json
  • docs/audits/runtime-rpc-consumed-queue/electron-results.json
  • docs/audits/runtime-rpc-consumed-queue/extended-controls.cjs
  • docs/audits/runtime-rpc-consumed-queue/extended-results.json
  • docs/audits/runtime-rpc-consumed-queue/fix.patch
  • docs/audits/runtime-rpc-consumed-queue/queue-source.cjs
  • docs/audits/runtime-rpc-consumed-queue/reproduce.cjs
  • docs/audits/runtime-rpc-consumed-queue/resolver-controls.cjs
  • docs/audits/runtime-rpc-consumed-queue/resolver-results.json
  • docs/audits/runtime-rpc-consumed-queue/results.json
  • docs/audits/runtime-rpc-consumed-queue/source-versions.json
  • src/shared/runtime-rpc-call-queue-retention.test.ts
  • src/shared/runtime-rpc-call-queue.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The runtime RPC queue now clears consumed foreground and background entries by assigning undefined before advancing queue heads. The queue types permit undefined slots. New tests and audit scripts cover payload retention, cancellation, synchronous failures, lane ordering, compaction, and queue cleanup. New Node and Electron result files record baseline and fixed measurements, runtime metadata, source hashes, and resolver retention results.

Area Change
Queue implementation Clears consumed slots and updates array element types.
Tests Adds garbage-collection, cancellation, ordering, and compaction coverage.
Audits Adds baseline reconstruction, reproduction scripts, controls, and runtime reports.
Documentation Adds the audit README and source identity metadata.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 671bf

The queue cleanup change and its audit tooling have no remaining actionable merge risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the problem, implementation, compatibility constraints, and validation results, but it does not follow the required template. It omits the required ELI5, What Changed,… Restructure the description using the repository template. Add an ELI5 summary, separate What Changed and Why sections, provide a valid Linked Issue entry such as Fixes #<issue>, add N/A with a reason under Visual Proof if applicable, c…
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 7 files. (9 skipped: 9… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: releasing completed runtime RPC queue payloads.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the problem, implementation, compatibility constraints, and validation results, but it does not follow the required template. It omits the required ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Review, Notes, and Checklist sections. It also does not provide the required issue link or explicit visual-proof and platform-testing statements.

Resolution

Restructure the description using the repository template. Add an ELI5 summary, separate What Changed and Why sections, provide a valid Linked Issue entry such as Fixes #&lt;issue&gt;, add N/A with a reason under Visual Proof if applicable, complete the Testing section with platforms and checkboxes, and complete the remaining Review, Notes, Agent skill upstream boundary, AI Disclosure, and Checklist sections as applicable.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 7 files. (9 skipped: 9 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Released consumed queue slots — takeForeground/takeBackground in src/shared/runtime-rpc-call-queue.ts now assign undefined to the consumed lane slot before advancing the head, so a settled call's run closure (and the request params it captures) is no longer reachable through the array while another call keeps the selector active. Lane element types widen to (QueuedRuntimeCall<unknown> | undefined)[]; compaction comment reworded.
  • Retention regression tests — new src/shared/runtime-rpc-call-queue-retention.test.ts (6 cases) covers completed-call release on both lanes, active+cancelled release, rolling cross-lane traffic, and lane order/FIFO/cancellation under compaction.
  • Audit bundle — docs/audits/runtime-rpc-consumed-queue/** documents production reachability, a SHA-pinned baseline reconstruction from fix.patch, and Node 26 vs Electron 43.7 results.

I verified the product change preserves the queue invariants: queuedCount = length - head and isEmpty never see the cleared holes (all sub-head slots undefined, all at/after-head slots defined), and cancelQueuedCall's indexOf(call, head) starts past the holes. pump already treats a falsy take as an empty lane. All 14 queue tests pass locally, and running the committed baseline.config.mjs ablation reproduces exactly the three claimed failures (both releases completed … inputs cases and releases old foreground inputs …), so the regression tests genuinely fail without the fix. Product file sha256sum matches the committed fixedSha256, and oxlint is clean on both source files.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@OrcaWin
OrcaWin merged commit 0e3acf5 into main Sep 18, 2026
53 of 55 checks passed
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
Co-authored-by: m4air <m4air@Mac.localdomain>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant