Repository navigation
Release completed browser helper drain timers - #26210
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The timer cleanup and its regressions present no identified merge-blocking risk; merge after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
ELI5
After a browser command returns a large result, Orca can briefly keep the finished helper and extra copies of its reply alive. Release the helper's fallback timer when the command completes.
What Changed
Keep the existing 500 ms pipe-drain timer handle and clear it in the
execFilecompletion callback. Results, errors, cancellation, output limits, and the fallback delay stay the same.Add lifetime regressions using the full browser bridge and real helper subprocesses: completed child collection while the bridge stays usable, timer retirement after error/cancellation, and spawn failure without a drain timer. The existing 5 MiB inherited-pipe regression remains unchanged.
Why
The timer callback captures the child process, which still owns Node's buffered reply and completion context after normal closure. Retiring this finished timer removes that temporary ownership. The fallback itself remains necessary when a Windows daemon inherits the helper's pipes.
Seven alternating before/after trials ran four real helpers returning 5 MiB each, keeping the bridge-method fixture owner live and retaining only output lengths and hashes. At 4.8–8.6 ms after completion and GC, median extra heap was 42,249,944 → 280,024 bytes; completed child references were 4 → 0. Every reply length and SHA-256 matched. After 600 ms, both variants released all children. Four 256 KiB replies measured 2,414,904 → 298,440 bytes; four 1 KiB replies measured 312,880 → 287,624 bytes.
This is transient retention for supported generated large replies, not a permanent leak, captured typical workload, typing-latency result, or CPU speedup. The measurements use the actual bridge method and native
execFilewith fixture session state; persistent tests also exercise the full bridge constructor. Raw RSS is recorded separately and is not treated as retained heap.Linked Issue
N/A — maintainer performance audit.
Visual Proof
N/A — process ownership cleanup has no visual or interaction change.
Testing
All selected PR CI checks pass, including all five Node 24 test shards, relay tests, static analysis, and macOS/Windows packaging.
macOS, all tests launched with
ORCA_BACKGROUND_LAUNCH=1:pnpm tc:node: passed.pnpm tcpasses, and the 85-file changed-code quality gate reports zero new findings.oxlintandoxfmt: passed.4077fb4a8de8: passed, two changed files, zero new findings.Review
The completion callback retires the drain timer before clearing the active process and settling the result. Spawn errors have no exit timer; inherited-pipe callbacks still wait for the same fallback to release the pipes. The lifetime test clears mock call records before GC so those records cannot keep the child alive.
Reproduce the focused regressions with:
ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/browser/agent-browser-bridge-raw-process-retention.test.ts src/main/browser/agent-browser-bridge-raw-process.test.tsAgent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
The completion callback already owns settlement and helper cleanup. Clearing an undefined or already-fired timer is harmless, so spawn failure and inherited-pipe fallback preserve their existing behavior. No new timeout, polling, cache, or cross-host protocol change.
Checklist
N/Awith reason