perf(ai): reduce streaming and native media overhead#556
Open
JustYannicc wants to merge 47 commits into
Open
Conversation
…s' into codex/perf-consolidated-integration-stack
…nd-menubar' into codex/perf-consolidated-integration-stack # Conflicts: # src/renderer/src/raycast-api/hooks/use-cached-promise.ts
…emoji' into codex/perf-consolidated-integration-stack # Conflicts: # src/renderer/src/raycast-api/list-runtime-renderers.tsx # src/renderer/src/raycast-api/list-runtime.tsx
… into codex/perf-consolidated-integration-stack
…tus' into codex/perf-consolidated-integration-stack
… into codex/perf-consolidated-integration-stack # Conflicts: # src/renderer/src/CameraExtension.tsx
This was referenced Jul 3, 2026
This was referenced Jul 3, 2026
Contributor
|
Reviewed the AI-streaming and native-media consolidation changes (per this PR's stated scope). The six targeted fixes are individually sound and well-tested; my only real reservation is the enormous, mixed review surface. Strengths
Concerns / potential bugs
Suggestions (optional)
🟡 Approve with minor comments — the in-scope AI-streaming and native-media changes look correct and safe; my reservations are the undisclosed meter change and the oversized mixed surface, not defects in the targeted fixes. 🤖 Automated review by Claude Code (Opus 4.8). |
Collaborator
Author
|
Addressed the review follow-up from the AI-streaming/native-media pass. What changed:
Review triage:
Verification:
|
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
AI.ask()caller abort listeners on every terminal stream path./bin/mkdir -psubprocess and rely on the existing main-process binary writer to create parent directories.Why
These hot paths were still doing avoidable work after the first performance stack: AI streams could emit one IPC message per provider chunk, local model polling could relaunch helper probes every tick, successful
AI.ask()calls could retain abort listeners until the caller signal aborted, Settings > AI remounts could leave stale Ollama pull listeners behind, camera capture still spawned a directory subprocess, and native WAV serialization appended two bytes per sample. Consolidating them keeps the second-wave performance fixes together on top of the integration stack.Compatibility impact
How tested
node --test scripts/test-ollama-pull-listener-cleanup.mjs scripts/test-ai-model-status-polling.mjs scripts/test-local-model-status-probe-cache.mjs scripts/test-ai-stream-ipc-batching.mjs scripts/test-raycast-ai-abort-listeners.mjs scripts/test-use-ai-stream-batching.mjs-> 27 pass.node --test scripts/test-camera-capture-single-encode.mjs-> 10 pass.pnpm test-> 184 pass../node_modules/.bin/tsc -p tsconfig.main.json --noEmit --pretty false-> pass../node_modules/.bin/tsc -p tsconfig.renderer.json --noEmit --pretty false-> pass.pnpm run build:main-> pass.pnpm run build:renderer-> pass.swiftc -O -o /tmp/supercmd-audio-capturer-check src/native/audio-capturer.swift -framework AVFoundation -framework Foundation-> pass.swiftc -O -o /tmp/supercmd-audio-wav-bulk-test scripts/test-audio-wav-bulk-write.swift && /tmp/supercmd-audio-wav-bulk-test-> pass.pnpm run build:nativepassed during branch validation after using a hoisted local pnpm validation install; the initial strict pnpm layout could not resolve the native helper addon's transitivenode-addon-apifrombinding.gyp. perf(settings): clean up Ollama pull listeners #553 touches no native files.git diff --check codex/perf-consolidated-integration-stack..HEAD-> pass.src/main/ai-stream-ipc.ts,src/main/local-model-status-probe.ts,src/main/main.ts,src/main/preload.ts,src/renderer/src/raycast-api/index.tsx,src/renderer/src/CameraExtension.tsx,src/renderer/src/settings/AITab.tsx,src/renderer/src/settings/ollamaPullProgress.ts, andsrc/renderer/types/electron.d.ts.src/native/audio-capturer.swift.Performance evidence
ai-stream-chunkIPC sends; batched path -> 1 IPC send, with final text preserved.useAIharness: 600 streamed chunks -> 600 baseline visible updates; batched path -> 1 visible update, with final flush/error/abort behavior preserved.iterations=60 legacyCalls=60 legacyMs=105.067 cachedCalls=1 cachedMs=1.791 avoidedCalls=59.AI.ask()abort listener harness: success, stream error,aiAskrejection, and explicit abort all end atactive=0, added=1, removed=1; the pre-fix retained-listener baseline wasactive=1, added=1, removed=0.6/6/6and left listener counts6/6/6; after cleanup callbacks are1/1/1and listener counts after cleanup are0/0/0. The same harness verifies stale request-id filtering and identical-progress dedupe./bin/mkdir -paveraged 1.370 ms over 80 runs, while in-process recursive mkdir averaged 0.033 ms; this branch asserts capture no longer shells out and the main IPC writer still creates parents before writing.Int16append 0.81 ms avg, 18.16x speedup.Stack validation
codex/consolidate-ai-native-mediafromcodex/perf-consolidated-integration-stackat52288a0.31caa81and verified as the only new delta after the original perf(ai): reduce streaming and native media overhead #556 head.AGENTS.md, rootpnpm-lock.yaml, rootpnpm-workspace.yaml, or local playbook/prompt markdown.Replaces