fix: clean up main abort listeners#590
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
src/main/ai-provider.tsHTTP requests and Whisper uploads so tracked abort listeners are removed on success, HTTP error, request error, and explicit abort.ollama-pullmain-process handler to use a named abort listener and centralized finalizer for request-map and listener cleanup.Why
Long-running AI and Ollama paths reused caller-owned abort signals while lower-level helpers attached inline one-shot listeners. Successful and failed requests could leave listener closures attached until the caller signal was garbage collected, and abort/error races had no shared cleanup path.
Compatibility impact
Behavior is intended to be preserving: cancellation still uses the existing
Request abortedandTranscription abortederrors, HTTP error messages are unchanged, and Ollama aborts still suppress user-facing pull errors when the controller is aborted.How tested
node --test scripts/test-ai-provider-gemini-prompt-streaming.mjsnode --test scripts/test-ai-provider-whisper-upload.mjsnode --test scripts/test-ollama-pull-listener-cleanup.mjspnpm run build:mainpnpm run typecheck:renderersrc/main/ai-provider.tsandsrc/main/main.ts: no diagnostics found.Performance evidence
adds=1 removes=1 active=0for success, HTTP error, request error, and abort; during a successful streaming response the listener remains active after headers (adds=1 removes=0 active=1) and is removed when the stream completes (adds=1 removes=1 active=0).adds=1 removes=1 active=0; pre-aborted requests remainadds=0 removes=0 active=0.progress=6 done=6 error=6; after cleanup they areprogress=0 done=0 error=0. The new main-process guard verifiesollama-pulluses a namedonAbort, callsremoveEventListener, and centralizes active request deletion infinishPullRequest().Stack validation
206eab8280a2eb91a57e4e74ea6df99e45a55cb4oncodex/perf-wave3-integration-stack-20260704lineage.codex/perf-wave4-main-abort-listeners.Replaces
None.