Repository navigation
Skip renderer callbacks after their request has ended - #24631
Conversation
|
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; 4 remain after this review. 📝 WalkthroughWalkthroughDispatch now checks that a request is still the same entry in the pending map before invoking the subscriber callback. Parameterized tests cover 64 requests settled by disposal, unsubscription, replacement, or timeout. The tests verify action-specific errors, cleared timers, and that the callback does not run. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Requests that end before callback dispatch are skipped, with tests covering disposal, unsubscription, replacement, and timeout. No actionable merge risk is identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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
- Skip callbacks for already-settled requests —
dispatchnow checksthis.pending.get(requestId) !== pendingbefore invoking the subscriber callback, so a request settled bydispose/unsubscribe/replace/timeoutno longer starts an unowned callback. This reuses the identity/subscriberGenerationfencing thatonOutcomealready applied one microtask later; the only behavior change is that the callback (and its side effects such asmountPageallocating a webview) no longer runs for abandoned requests. - Parameterized settlement test — emits 64 requests and asserts each settlement path produces exactly the 64
failedreplies with the expectederrorCode, zero timers, and zero callback starts.
I traced the reply/ordering contract and each settle path: every removal from pending goes through settle, whose callers always send exactly one reply, so no reply is lost, and already-started callbacks are untouched. The skipped callback's side effects are covered by the same settlement paths (registry disposal on unsubscribe/dispose, main-side state clear on replace); no reachable leak or stuck non-retired page.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Reuse the existing pending-request identity check before starting its deferred renderer callback.
b5454a0 to
c619468
Compare
…24962) * fix(opencode): bind legacy attach status to its TUI pane Adapt the official v1 TUI API to the existing pane reporter and learn structural session identity only after execution-host admission. Preserve known creators, gate new reports to capable hosts, and register the legacy TUI entry without changing user settings or overlay targets. Credit werlang for the same-directory investigation in #22838 and #22847; no source from that PR is copied. (cherry picked from commit d9eeb028a23a66b78b08538a5ebf6052499ec24f) * fix(opencode): fence legacy TUI viewers before creator attribution Use the execution host's existing admission policy on the physical TUI pane and launch token before rewriting to a session creator or mutating the launch-token cache. Preserve live viewers, frozen server stamps and OpenCode 2 behavior. Add HTTP regressions for retired panes, closed tabs, replaced tokens and relay retirement, plus current-launch, alias and compatibility controls. Follow-up to #22838 and @werlang's original #22847; preserves the original intentional creator attribution without copying that PR's source. * fix(opencode): preserve current plugin exports in legacy TUI wrapper Keep the current server, setup, id and other default export entries when adding the legacy TUI entry. Cover their preservation and seed the ACL fixtures with the separate installed TUI/config bytes. This completes the current-main port of the legacy identity replacement for issue #22838, carrying @werlang's original PR #22847 contribution. * fix(opencode): retry timed-out SSH plugin updates (#24666) Preserve bounded retry behavior and the current-main status-envelope fields. Original-PR: #24124 Reviewed-source: 103144f9c5029f9217f64970271a5b7f69d3f823 Co-authored-by: Justas Brazauskas <[email protected]> * fix(opencode): keep Go credentials private and resolve backend keys (#24615) Preserve the complete credential storage, migration, IPC, Settings and rate-limit refresh change alongside standalone GLM plans, current-main database diagnostics and the reviewed unknown-backend environment correction. Keep native discovery cancellation third and selected environment fourth. Original-topic-commit: 7903f1cddbc08fe1179f8bd964fff3dcb0e5d020 Original-topic-commit: 588117b5cf1dd57e2310c80068e3ddcc9f9044ec Original-topic-commit: dedd4f8c862a961393977dc3c2547f049391b509 Original-topic-commit: 6645dae104ee5271139fcc0e9564d9223b74835d Original-topic-commit: a25b80c02c1af7830b0e6a65e72d965b3ad98276 Restacked-from: a25b80c02c1af7830b0e6a65e72d965b3ad98276 Restacked-onto: b032867021c7ef1436ca606559e9d786580a84dc Co-authored-by: kespineira <[email protected]> Co-authored-by: kevimux <[email protected]> Reported-by: pullfrog Reviewed-full-source: 849fe093073f4c1606bd65d79a0c725d955d0d1f Native-helper-source: 80dbe23237db191c1e6280001c7e0563f3ca8846 Reviewed-full-current-source: 36acb57d44adb3d378c0289c8c15f7da0fda214c * Skip store notifications when refreshed work items are unchanged (#24530) An identical forced refresh previously returned an empty Zustand patch, creating a new root state and notifying every subscriber. It now returns the current state after renewing the existing freshness timestamp. Real row or metadata changes still publish once. * Read project activity once while sorting the sidebar (#24549) Reuse the existing pure recent rank once per actual entry tuple within each synchronous sort; discard the lookup after sorting. * Skip impossible link and tag matches in docs search results (#24646) * Skip impossible HTML matches when formatting docs search results After the existing link-removal phase, skip the unchanged HTML regex only when the current string has no closing delimiter. * Skip impossible link and tag matches in docs search results Skip the five unchanged link regexes when their protected-code input lacks ]; skip the unchanged HTML regex when its post-link input lacks >. * Decode complete transcript lines without copying their bytes (#24546) Decode each single owned Buffer synchronously; preserve concatenation for multipart records and remove a redundant tail array copy. * Clear unused speech worker timers after errors and exit (#24924) Call the existing idle timer cleanup when private current-worker state is cleared; keep current-worker guards, transcript/error order, deliberate warmth and stop deadline unchanged. * Reuse documentation search excerpts during result navigation (#24574) Memoize the existing pure excerpt renderer by complete raw text for the current result array, retaining original rendering as a miss fallback. * Append subagent handoffs without recopying their message list (#24672) Append each message reference to its private call-local scope list; retain the final merge and existing ordering. * Cancel plugin retry timers when their fetch is replaced (#24700) Reuse the existing timer clear block immediately after the fetch generation advances; preserve live retries and all state publications. * Avoid rebuilding visible file paths for single-row selection (#24743) Skip the visible path array only for keyboard replacement selection; the existing replacement branch never reads that order. * Reuse prepared reads while searching saved agent conversations (#24535) Use schema-complete session columns to enable the existing bounded statement cache without caching result rows. * Reuse discovered mobile chunks during static traversal (#24774) Iterate the existing live visited Set in FIFO discovery order instead of maintaining a second shifted queue; both actual callers own untouched esbuild JSON metadata. * Skip unused image-size calculations in mobile web browser requests (#24941) Use the existing mobile density budget only for mobile view; pass the existing constant to the existing assembler for web/default mode, where that argument is discarded. No cache, policy, request or native path changes. * Skip diff analysis after a result has been discarded (#24711) Move the unchanged pure render-limit calculation after both existing generation and section-token rejection fences. * Skip late browser grab toasts after their surface closes (#24727) Reuse the existing mounted-owner ref at the toast presentation entry while preserving all admitted extraction/screenshot and clipboard completion. * Classify native chat waiting messages once (#24771) Use the existing native filter traversal to populate a fresh waiting array, keeping the original predicate, policy, projection and output ordering while classifying each actual private slot once. * Skip discarded Kanban pruning for an empty selection (#24782) Guard only the existing open pruning branch when both its private selected Set and nullable anchor are empty; retain all original pre-guard projections and nonempty/anchor-only/public-helper behavior. * Index discovered test files once during shard selec

ELI5
When a browser request ends before its turn starts, skip the work that nobody can use.
What Changed
Reuse the existing pending-request identity check before starting its deferred renderer callback.
Why
The current owner already has the information needed to avoid this work. Reusing it keeps the existing ordering and lifecycle without adding a queue, cache, protocol or scheduling policy.
Linked Issue
Internal performance audit; no pre-existing issue.
Visual Proof
N/A — this changes abandoned internal work or indexing allocations; current browser output and session text remain identical.
Testing
Original reviewed-base checks (historical full typecheck/build results below apply to that earlier base):
For dispose, unsubscribe, replacement and timeout, 64 callback starts become zero. Exact failure replies, order, IDs, operations and zero timers are checked first. Fifteen existing-owner/renderer-installation tests and six extra independent owner/reentrancy cases pass. Exact stock fails four callback budgets and passes seven compatibility controls. Node typecheck, scoped lint/format, changed-code checks and Electron Vite build pass on macOS.
All tests used ORCA_BACKGROUND_LAUNCH=1. Operation counts are measured; no heap-size or user-latency claim.
Review
Root independently approved the frozen named-main integration, ran its owner/stock controls, and verified all original scope hashes and inherited main blobs.
Independent audit_mobile_cloud review approved both frozen hashes, reran the focused tests, reproduced the exact stock budget failures and added actual-owner compatibility probes.
Agent skill upstream boundary
Notes
Invariant browser-page.renderer-request-ownership: an ended request sends its one existing final reply and cannot start an unowned callback afterward; live and already-started callbacks keep their ordering. A dedicated manifest entry is an explicit accepted gap; the actual-owner failure/reply/count tests and archived stock control are the oracle and diagnostic artifact.
Current callbacks start on the same microtask; already-started work, request schemas, limits, reply channels, timeouts and host authority are unchanged. Native Electron and physical Windows/Linux/SSH journeys remain unmeasured. The original delta is now independently reviewed on named main
1fc24d311481a85d5b4ae596898ee072389f040c. Main itself fixes the three earlier unrelated terminal fixture failures; the old duplicate repair is unnecessary. Root verifies every inherited main source blob and the unchanged original scope. Independent integration: 15 controls/two suites, including actual renderer installation; full supported node compiler passes. Exact main stock still reproduces the original regression and live controls. No fresh newer-lockfile install or full named-main build is claimed; new-head CI must pass before merging.Checklist