fix: cancel extension fetch proxy requests - #587
Closed
JustYannicc wants to merge 115 commits into
Closed
Conversation
…perf-wave2-integration-stack-20260704 # Conflicts: # src/renderer/src/raycast-api/hooks/use-cached-promise.ts
…perf-wave2-integration-stack-20260704 # Conflicts: # src/renderer/src/raycast-api/list-runtime-renderers.tsx # src/renderer/src/raycast-api/list-runtime.tsx
…perf-wave2-integration-stack-20260704 # Conflicts: # src/renderer/src/CameraExtension.tsx
…perf-wave2-integration-stack-20260704
…perf-wave2-integration-stack-20260704
…perf-wave2-integration-stack-20260704
…perf-wave2-integration-stack-20260704
…perf-wave2-integration-stack-20260704 # Conflicts: # src/renderer/src/raycast-api/list-runtime.tsx
…perf-wave2-integration-stack-20260704 # Conflicts: # scripts/bench-script-command-discovery.mjs # scripts/benchmark-file-search-delete-batch.mjs # scripts/lib/script-command-runner-harness.mjs # scripts/lib/ts-import.mjs # scripts/test-file-search-delete-batch.mjs # scripts/test-script-command-runner.mjs # src/main/file-search-index.ts # src/main/main.ts
…perf-wave2-integration-stack-20260704 # Conflicts: # scripts/lib/script-command-runner-harness.mjs # scripts/lib/ts-import.mjs # scripts/test-extension-lifecycle-sandbox.mjs # scripts/test-script-command-runner.mjs # src/main/main.ts # src/renderer/src/ExtensionView.tsx
…perf-wave2-integration-stack-20260704 # Conflicts: # .github/workflows/project-checks.yml # scripts/test-root-search-perf.mjs # src/renderer/src/CameraExtension.tsx # src/renderer/src/raycast-api/list-runtime.tsx
…-integration-stack-20260704
…-integration-stack-20260704
…-integration-stack-20260704
…e3-integration-stack-20260704
…erf-wave3-integration-stack-20260704 # Conflicts: # package.json # scripts/measure-extension-bundle-cache.mjs # scripts/test-icon-runtime-file-icon-cache.mjs # src/main/extension-runner.ts # src/renderer/src/components/HiddenExtensionRunners.tsx # src/renderer/src/raycast-api/icon-runtime-render.tsx
…/perf-wave3-integration-stack-20260704 # Conflicts: # scripts/test-browser-search-performance.mjs # scripts/test-root-search-perf.mjs
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
extension-fetch-bridgehelper that generates a request ID for every proxied HTTP(S) fetch.init.signalandRequest.signalaborts toelectron.cancelHttpRequest(requestId)and removed abort listeners on every terminal proxied path.Why
Extension-level
fetch()requests could be abandoned after an extension unmounted or aborted, but the bridge did not passrequestId, so main-process sockets/work stayed alive until natural completion. Large compressed proxied responses also decoded synchronously on the Electron main thread, creating a cross-extension stall risk.Compatibility impact
HTTP(S) extension fetch responses keep the same
Responseconstruction, headers, status fields, URL override, native fallback behavior, and binary download handling. Aborted proxied fetches now reject withAbortError, matching platform fetch semantics, while non-HTTP and unsupported body requests continue through native fetch.How tested
node --test scripts/test-extension-fetch-proxy-abort.mjs scripts/test-http-response-decode-async.mjs scripts/test-use-fetch-stale-runs.mjspnpm run build:mainpnpm run typecheck:rendererpnpm run build:renderersrc/renderer/src/extension-fetch-bridge.ts,src/renderer/src/ExtensionView.tsx,src/main/http-response-decode.ts, andsrc/main/main.ts: no diagnostics found.Performance evidence
Abort/request cleanup before: extension fetch IPC sent
{ url, method, headers, body }with norequestId, sohttp-request-cancelcould not reachactiveHttpRequests; abort listeners were not part of the bridge.Abort/request cleanup after:
scripts/test-extension-fetch-proxy-abort.mjsverifies each proxied fetch sends anextensionFetch:request ID, duplicate aborts emit exactly one cancel for that ID, the abort listener count goes1 -> 0after completion, and the success path finishes with zero abort listeners and no cancel calls. Existing stale-run coverage inscripts/test-use-fetch-stale-runs.mjsstill passes for request replacement/unmount cancellation patterns.Decompression before: main proxy used
brotliDecompressSync,gunzipSync, andinflateSyncbefore converting full response bodies to UTF-8.Decompression after:
src/main/http-response-decode.tsuses async zlib APIs only; the deterministic gzip fixture test confirmed decoded text compatibility and logged event-loop timer evidence for a 9,800,000 byte fixture. Test run evidence: sync baseline delayed the timer by 24.78 ms while async decode allowed it at 1.466 ms; repeat validation after the type fix logged 4.612 ms sync vs 2.802 ms async.Stack validation
Started from detached base
206eab8280a2eb91a57e4e74ea6df99e45a55cb4and createdcodex/perf-wave4-extension-fetch-proxy. No coordinator markdown, playbooks, prompts, or generated lockfiles are included.Replaces
Replaces the perf wave 4 coordinator finding for extension fetch proxy abort propagation and compressed response main-thread stall risk.