Repository navigation
Cancel abandoned file searches and prevent stale results - #25370
Conversation
There was a problem hiding this comment.
ℹ️ No critical issues — one small consistency gap inline. The cancellation plumbing itself checks out end to end.
Reviewed changes
This run reviews the full PR against its stack base nwparker/file-search-memory-bounds.
- Host-owned cancellation for file search —
AbortSignalis threaded renderer → preload → main IPC (token-scopedfs:search/fs:cancelSearch), the SSH provider, the runtimefiles.searchRPC, and the shared remote-runtime transport, so an abandoned search stops the actual rg child on the host. - Coalesced ripgrep termination — new
stopBundledRipgrepbounds Windows/WSL process-tree termination and de-duplicates repeated stops for the same child. - Stale-result scoping — result owners now carry
rootPath/executionHostId;useFileSearchScopeinvalidates saved results when the root, runtime, or execution host changes and re-runs the saved query, including while hidden and after remount. - Search-field shortcut policy —
fileSearchClaimsTextKeylets app chords through while keeping text-editing keys in the search inputs; composition/AltGr are handled. - Runtime subscription lifecycle extraction — subscription handlers now track pending subscriptions and abort setup on owner unsubscribe or renderer teardown.
- Legacy quick-open rg guidance — accepts the retired local-scan wording from older peers.
ℹ️ subscribeRuntimeEnvironment's new signal is dropped on the support-routed branch
files.search is not support-routed, so this does not affect the feature in this PR — but the new signal parameter is only forwarded on the non-support branch, and subscribeSupportRoutedRuntimeEnvironment has no signal member at all. Since the subscription handler passes setupController.signal for every method, aborting setup of a support-routed subscription (files.watch, session.tabs.subscribe, runtime.clientEvents.subscribe, accounts.subscribe, notifications.subscribe) currently has no effect on the host connect.
Technical details
# subscribeRuntimeEnvironment drops `signal` on the support-routed branch
## Affected sites
- `src/main/ipc/runtime-environment-transport-routing.ts:189` — new `signal?: AbortSignal` parameter.
- `src/main/ipc/runtime-environment-transport-routing.ts:225-235` — `subscribeSupportRoutedRuntimeEnvironment({...})` is invoked without `signal`.
- `src/main/ipc/runtime-environment-support-routing.ts:114-165` — `subscribeSupportRoutedRuntimeEnvironment` has no `signal` member, and neither its `supported` nor `unsupported` branch forwards one.
- `src/main/ipc/runtime-environment-subscription-handlers.ts:166-167` — every method passes `setupController.signal`, including the support-routed ones.
## Required outcome
- Aborting setup for a support-routed subscription should stop the in-flight `supportsSharedControl` probe / connect instead of letting it run to completion.
## Open questions for the human
- Is wiring `signal` through `subscribeSupportRoutedRuntimeEnvironment` in scope for this stack, or intentionally deferred to a follow-up?deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
13a87ff to
c05f4e1
Compare
7910655 to
17066ec
Compare
There was a problem hiding this comment.
✅ No new issues found. The delta since the prior review addresses both earlier findings and extends cancellation safely across the paired-web and support-routed/shared-control paths.
Reviewed changes
This run re-reviews the 4 rebased commits since the prior pullfrog review at 13a87ff (a3195045, 2571ece3, 69ceed45, c05f4e1).
- Support-routed + shared-control cancellation —
signalnow threads throughsubscribeSupportRoutedRuntimeEnvironment,subscribeRemoteRuntimeSharedControlRequest,RemoteRuntimeSharedControlConnection.subscribe, andstartSharedControlSubscription(pre/postthrowIfSignalAborted); the support probe is awaited viawaitForPromiseWithSignalso aborting one waiter leaves siblings untouched. - Paired-web search cancellation —
web-filesystem-api.tstracks asearchesmap keyed byrequestTokenand runsfiles.searchthroughcallAbortableRuntimeEnvironment;web-runtime-environments-api.tstrackspendingSubscriptionsand implementscancelSubscription;WebRuntimeClientaborts its child socket on signal and waits through the signal on connect. - Stale-error gating fix —
useFileSearchPanelnow gateserrorbyresultsAreCurrent, closing the one stale surface flagged previously. - Runtime local search abort —
searchLocalRuntimeFilesnow awaits authorization throughwaitForPromiseWithSignaland binds abort tostopBundledRipgrep. isRuntimeScopeForbiddenErrorrelocation — moved fromruntime-rpc-client.tstoruntime-rpc-result.ts, with import updates in the forbidden-toast and setup-script call sites.- Regression coverage — new tests prove sibling isolation on a shared support probe, signal forwarding on both support routes, no connection for a pre-aborted shared-control subscribe, and immediate socket close on abort in the web client.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
c05f4e1 to
252a6df
Compare
9726328 to
d4eeb8c
Compare
252a6df to
d36f171
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviews the delta since the prior pullfrog review at c05f4e1 (rebased onto base tip d4eeb8c9). The range-diff is noisy from base movement and the re-split of the series; isolating the branch-authored files between the two heads shows the feature tree is unchanged from the approved run and the only new work is CI repair.
- Search handler uses the shared process type —
filesystem-content-search-handler.tsnow importsChildProcessHandlefromshared/child-process/process-specinstead ofnode:child_process, keeping the spawn-chokepoint rule intact without a new allowlist entry. - Retired allowlist entry — removed the migrated
filesystem-search-handlers.tsline fromchild-process-import-allowlist.txt, which the "no stale allowlist entry" guard requires once the search code moved out. - Dedicated owner-boundary route test —
file-explorer-runtime-owner-boundary.test.tsnow assertsuseFileSearchRunner.tsroutes content search through both owner selectors (getRuntimeEnvironmentIdForWorktree/getExecutionHostIdForWorktree) and avoids the rawuseAppStore.getState().settingsread. - Subscription cancellation fixture —
github-pr-checks-fetch.test.tsandgithub-slice-test-harness.tsnow exercise the newsubscriptionId/cancelSubscriptioncontract.
I re-ran the affected suites (filesystem-content-search-cancellation, runtime-environment-support-routing, runtime-environments-subscription-lifecycle, remote-runtime-shared-control-connection, useFileSearchPanel.lifecycle, useFileSearchRunner, file-explorer-runtime-owner-boundary, github-pr-checks-fetch, child-process-import-boundary): 100 tests passing.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
d4eeb8c to
2f2058f
Compare
94ae722 to
fad7480
Compare
Credits @OrcaWin for the original bounded-record proposal.
Apply mobile limits before transport, list Markdown through its semantic producer, and retain complete directory results only within explicit capacity budgets. Stream SFTP directory packets and reject oversized transfer plans before reporting success; preserve narrow older-peer fallbacks and validate streamed response retention.
Keep one current document snapshot per consumer and attach completion candidates to the actual editor model lifetime. Resolve folder workspace roots through existing workspace identities so their previews and completions receive the same authorized listing as worktrees.
Leave unqualified inventories complete beyond 20,000 files. Charge retained paths and serialized bytes at local and relay producers, reject oversized full inventories explicitly, and bound old-peer response reassembly; keep caller-specific mobile and explicit result limits.
Send CLOSE even after cancellation, stop waiting after five seconds without an acknowledgement, and ignore late callbacks. Preserve the original capacity or cancellation error and close handles returned after an aborted OPENDIR.
fad7480 to
e639b82
Compare
70112b5 to
d06a8fb
Compare
e639b82 to
a6d5c5d
Compare

ELI5
Part 2 of 3; stacks on #25369 and precedes #25371.
Abandoning a search stops its host work. Switching the workspace root or owner immediately hides obsolete results and prevents opening them.
What Changed
Carries cancellation through connection setup, capability waits, host searches and both subscription routes. Saved results retain their root and owner; shortcuts and Escape keep their application behavior.
Shares the native text-search runner between desktop IPC and runtime requests, removing 171 net production lines. Callers still own authorization and request identity. An aborted subscription setup closes any host subscription, including a late acknowledgement.
Why
One process runner preserves identical parsing, deadlines and cleanup across callers. Host cancellation releases actual work, while ownership checks keep stale UI results from activating against a new workspace.
Linked Issue
Fixes #12292. Fixes #20758.
Visual Proof
Replacing a workspace root under the same ID previously retained root A results under root B. The corrected panel refreshes to B; result activation loads B content. These are controlled original-component before/after comparisons on the same fixture.
Before: root B shows root A result
After: root B shows root B result
Testing
Cancellation layer typecheck and focused request/subscription/search suites passed. Combined-stack verification passed 88 suites (888 tests, one existing skip), full typecheck and changed-code quality checks. Added failing-before/passing-after setup-abort coverage and a real bundled-ripgrep Unicode/CRLF/result-limit check.
Real SSH compatibility checks passed nine client/host pairings. Native Windows focused search and Markdown checks passed; actual Ubuntu 24.04 WSL guest termination passed abort, timeout and invalid-output probes.
Two hidden native Windows Electron checks also passed on final head
e44c29d019e0: linked-folder refresh through retargeting and Quick Open rendered filename/path results.All tests/apps used
ORCA_BACKGROUND_LAUNCH=1. Fresh hosted CI on the rewritten heads is queued; merge remains gated on required checks.Review
A fresh independent reviewer rated the final combined source
e44c29d019e0low risk, with no unresolved concrete blocker after adversarial review, compatibility repairs, real SSH latency checks and native WSL cleanup evidence. Their focused stable-source rerun passed 20 suites / 155 tests. Counts above overlap and are not summed.The final production TypeScript is 58 net lines smaller than the previous candidate; additional tests preserve the behavior that the simplification must keep.
Agent skill upstream boundary
Notes
Authorization remains canonical, while returned workspace paths preserve their lexical identity. Shared capability waits keep subscriber cancellation separate. Historical spinner issue #14488 remains outside this change.
Checklist