Repository navigation
fix(memory): bound OOM-prone accumulators across Orca - #10179
Merged
Merged
Conversation
nwparker
force-pushed
the
nwparker/fix-bounded-memory-accumulators
branch
from
July 23, 2026 12:50
be3240a to
4d038c2
Compare
nwparker
force-pushed
the
nwparker/fix-bounded-memory-accumulators
branch
from
July 23, 2026 13:04
4d038c2 to
301d599
Compare
brennanb2025
added a commit
that referenced
this pull request
Jul 23, 2026
…ory file limits Semantic resolutions where #10179 bounded the same reads this PR made asynchronous: - add async variants of the bounded terminal-history readers and use them for checkpoint.json, output.log, and legacy scrollback.bin so the reads are both off-thread and size/JSON-structure capped - keep the header-only stat bypass ahead of the replay semaphore; the bounded log read now rejects oversized logs inside the slot - daemon-pty-adapter keeps the shared ColdRestorePayload type from cold-restore-payload-cache alongside main's PtyProcessListAdmission - await the now-async detectColdRestore in main's history-reader-memory tests - extract the legacy scrollback restore path into terminal-history-legacy-scrollback-restore.ts to stay within max-lines
5hseok
added a commit
to 5hseok/orca
that referenced
this pull request
Jul 24, 2026
Resolve conflicts from stablyai#10179 (bound OOM-prone accumulators), which moved the parse-cache map into session-parse-cache-retention.ts and rewrote the list caches around boundAiVaultListResult: - session-parse-cache: re-export invalidateSessionParseCacheEntry from the retention module (new home of the cache map) instead of deleting from a now-removed local map. - discovery: keep upstream's bounded openclaw scan (retainNewestFile) while calling the shared openClawAgentsRootDir / isOpenClawSessionFilePath helpers the deletion validator also consumes. - cached-session-list & ipc/ai-vault: keep the cacheGeneration guard on top of upstream's boundAiVaultListResult so a delete landing mid-scan still can't repopulate the cache with a pre-delete result. - ipc/ai-vault imports: drop the inline-subagent-handler imports upstream kept; this branch serves that handler from ai-vault-subagent-list.ts, which calls the same (now memory-bounded) scanner.
5 tasks done
nwparker
added a commit
that referenced
this pull request
Jul 24, 2026
This reverts commit 8f40ddf (#10179). Rebased on current main. The revert applied cleanly across the vast majority of the 1,626-file PR; the remaining work was preserving PRs that had been built on top of #10179 after it merged. All are preserved: - #9990 perf(terminal): cold-restore replay - #10213 fix(codex): TUI settings promotion - #10135 fix(mobile): images in native chat - #9387 fix(status-bar): Resource Manager badge + concurrent listSessions - #9853 fix(app): bound wake/quit paths (phone-session-ended freeze) - #10237 fix(claude-accounts): quote claude path for Windows (kept shell:false) Because those PRs were written against helper modules/APIs that #10179 introduced, the minimal, typecheck-verified closure they depend on is kept so the tree builds and every later-PR test passes: - bounded file/JSON readers used by #10213/#9990 (agent-state-file-reader, node-bounded-file-reader, json-text-structure-limit, terminal-history limits) - claimed-agent-pty-owner cap API + pty:listSessions admission (#9990/#9387) - the mobile-E2EE outbound-memory-budget subsystem #9853 builds on (e2ee-channel, mobile-e2ee-*, ws-outbound-backpressure-queue, remote-runtime-request-frames/-memory-limits, map-with-concurrency, e2ee-crypto) Everything else #10179 added (~555 files) is deleted; every file it modified elsewhere is restored to its pre-#10179 state. Verified: root typecheck (node+cli+web), mobile typecheck, full root test suite, full mobile test suite, oxlint, localization catalog + coverage, reliability gates, max-lines ratchet, and the CLI emit build all pass. Two checks fail only locally and fail identically on clean origin/main (this clone's git-tag namespace for verify:skill-bundle-manifest; an inherited GIT_CONFIG_* env for one relay test) — both pass on a clean CI environment. Co-authored-by: Orca <help@stably.ai>
nwparker
added a commit
that referenced
this pull request
Jul 24, 2026
5hseok
added a commit
to 5hseok/orca
that referenced
this pull request
Jul 24, 2026
Upstream reverted "bound OOM-prone accumulators (stablyai#10179)" (stablyai#10255), which deleted the parse-cache/list retention modules my earlier merge had adapted to. Re-resolve back to the pre-stablyai#10179 structure while keeping this branch's work: - session-scanner-parse-cache: the cache Map is local again; move invalidateSessionParseCacheEntry back here (from the deleted retention module) as a plain cache.delete, keeping ai-vault-delete's import path unchanged. - session-scanner-discovery: upstream's openclaw scan restored, but calling the shared openClawAgentsRootDir / isOpenClawSessionFilePath helpers the deletion validator also consumes. - cached-session-list & ipc/ai-vault: keep the cacheGeneration guard on top of upstream's inline (unbounded) scan + direct-result caching, so a delete landing mid-scan still can't repopulate the cache with a pre-delete result. - ipc/ai-vault imports: keep serving the subagent handler from ai-vault-subagent-list.ts; use upstream's mergeAiVaultListResults.
This was referenced Jul 24, 2026
This was referenced Jul 25, 2026
This was referenced Jul 25, 2026
6 tasks done
This was referenced Jul 27, 2026
This was referenced Jul 27, 2026
This was referenced Jul 27, 2026
3 of 5 tasks
Merged
9 tasks done
10 of 14 tasks
This was referenced Sep 19, 2026
This was referenced Oct 5, 2026
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.
Summary
Follow-up to #9936: a repository-wide audit found the same unbounded-memory failure class in other long-lived maps, caches, queues, streams, parsers, scans, and fan-outs.
This change adds explicit count, byte, depth, concurrency, and retention ceilings across desktop, renderer/preload, daemon, relay, SSH/WSL, web, mobile, CLI, browser/emulator, filesystem, providers, notifications, speech, native chat, and session discovery.
The pattern is consistent:
Final scope: 1,626 files changed, including 686 test files and 303 newly added test files. There are no dependency, lockfile, or native-binary changes.
ELI5
Orca had many containers that were safe during ordinary use but could keep growing forever if a host, repository, provider, terminal, or client supplied enough data.
This change gives those containers labeled maximum sizes. Normal data still goes through unchanged. If a container becomes abnormally full, Orca now drops an old/reconstructible item, pauses or rejects new work, returns a bounded partial result, or asks the caller to retry instead of continuing until the process runs out of memory.
OOM hazards addressed
Intentional overload-only behavior
There is no intentional normal-path behavior change for workloads below the new ceilings. These safety degradations can be user-visible only under extreme input or sustained backpressure:
Screenshots
No normal-path visual change.
The only new visual state is the overload-only oversized-CSV fallback, localized in English, Spanish, Japanese, Korean, and Chinese. No screenshot was captured because it requires a synthetic CSV beyond the safety ceiling.
Evidence of the fix
Representative hard boundaries and regression tests include:
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildDetailed results on final commit
301d5999a5:301d5999a5: root and mobile verification, Wayland terminal input, Windows terminal restart, packaged crash survival, Linux/macOS golden E2E, and Linux/Windows native-smoke.build:cli→build:electron-vite→verify:cli-runtimepassed.git diff --checkpassed.max-linesbypasses.Local lint note: the primary clone contains unrelated local version tags that confuse the skill snapshot verifier. The full lint chain passed against an origin-only Git tag namespace; clean CI clones should not need that workaround.
AI Review Report
AI-assisted review explicitly checked:
The independent final review found one medium-severity issue before publication: a synchronous WebSocket send exception could escape a timer callback and strand the remaining queue with stale timer state. The shared queue now catches both immediate and drain-send failures, releases the backlog, clears the timer, and signals reconnect/resync exactly once. Two focused regression tests were added. The first CI run then exposed a cross-build module-boundary regression: Electron output replaced a CLI dependency emitted under
out/main. The dependency now lives in shared output, and production plus computer-use workflows permanently boot-check the compiled CLI after Electron builds. No other high- or medium-severity findings remain.Residual review risk is primarily the breadth of the change. The boundary tests demonstrate bounded state and cleanup, but this PR does not include a repository-wide before/after heap or RSS benchmark. The final GitHub Actions matrix passed on Linux, macOS, Windows, mobile, Wayland, packaged crash-survival, terminal-restart, and native-smoke paths. SSH/WSL and Git 2.25 behavior remain covered by focused tests and compatibility checks rather than live remote-host CI.
Security Audit
The primary security benefit is reducing memory-exhaustion denial-of-service risk from untrusted or unexpectedly large local, remote, IPC, WebSocket, provider, filesystem, and persisted inputs.
Reviewed areas include:
No unresolved input-handling, command-execution, path, authentication, secret, dependency, or IPC vulnerability was identified by the completed reviews. Multi-platform CI remains the final confirmation before merge.
Notes