Repository navigation
Conversation
nwparker
force-pushed
the
oom/13-b-daemon-pty
branch
from
July 24, 2026 07:48
c2346d5 to
ed074fa
Compare
nwparker
force-pushed
the
oom/14-b-ai-vault
branch
from
July 24, 2026 07:48
2191157 to
ee38326
Compare
nwparker
force-pushed
the
oom/13-b-daemon-pty
branch
from
July 25, 2026 02:21
ed074fa to
7f5cd50
Compare
nwparker
force-pushed
the
oom/14-b-ai-vault
branch
from
July 25, 2026 02:21
ee38326 to
5b042d9
Compare
nwparker
force-pushed
the
oom/13-b-daemon-pty
branch
from
July 25, 2026 02:40
7f5cd50 to
8714ad3
Compare
nwparker
force-pushed
the
oom/14-b-ai-vault
branch
from
July 25, 2026 02:40
5b042d9 to
901b227
Compare
nwparker
force-pushed
the
oom/13-b-daemon-pty
branch
from
July 25, 2026 03:10
8714ad3 to
bf5147e
Compare
nwparker
force-pushed
the
oom/14-b-ai-vault
branch
from
July 25, 2026 03:10
901b227 to
0c5e851
Compare
Files: 61 applied, 0 deleted (from 6eb70d8) Co-authored-by: Orca <help@stably.ai>
nwparker
force-pushed
the
oom/13-b-daemon-pty
branch
from
July 25, 2026 03:34
bf5147e to
7ce7037
Compare
nwparker
force-pushed
the
oom/14-b-ai-vault
branch
from
July 25, 2026 03:34
0c5e851 to
a640d5b
Compare
Contributor
Author
|
Superseded by #10548, which re-scopes this work to the bound-at-ingress doctrine (see #10533 and An audit found the original #10179 scope was ~50x the size of the fix for the crash it targeted, and that bounds had landed ahead of their callers. Every file in these slices was re-adjudicated individually: ingress bounds (transport frames, PTY flow control, on-disk transcripts, parsing, enumeration, media decode, user-keyed accumulators) were kept; interior ceilings behind an already-bounded input were dropped. 1,882 files → 1,155, full suite green, and no No memory protection was lost — only speculation. |
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.
OOM hardening slice 14/29 — bound AI Vault discovery, readers & caches
Summary
This slice re-lands the AI Vault (agent-session scanner) OOM bounds: it replaces every unbounded readdir/readFile/readline path with streaming/opendir + a shared bounded JSONL reader and a concurrency- and byte-budgeted whole-JSON reader, and adds explicit ceilings on per-session field bytes, aggregate list bytes, discovery depth/entries, parse/title/workdir caches, and the OpenCode SQLite worker queue. It sits on top of foundation slices that provide the shared bounded-IO helpers (node-bounded-json-stringify, node-bounded-file-reader, json-text-structure-limit, opencode-database-files).
ELI5
Orca has a panel that lists your past AI coding-agent chats by scanning files on disk. Before, a corrupt or gigantic chat file could make Orca read the whole thing into memory and crash. This change puts polite size limits everywhere: it reads files in a streaming way, skips absurdly huge lines or files, caps how many sessions/titles it keeps in memory, and shows a small "some entries were omitted" note instead of blowing up. For normal-sized histories nothing looks different; the limits only bite on abusive or enormous inputs.
Proof of OOM fix
Regressions
Normal-path (ordinary use, below the new limits): none — behavior is unchanged below the ceilings.
Overload-only (extreme input / sustained backpressure) — intended, documented degradations:
Build / CI
✅ Inherited defect FIXED in this slice
src/main/ai-vault/session-jsonl-line-reader.ts— consumeAiVaultJsonlLines drives the async generator via iterator.next() without iterator.return() in finally; if the onLine consumer throws, the createReadStream fd is not closed. Repeated throwing scans leak descriptors.Adversarial review
length(CAST(id AS BLOB)) <= 16KiBpredicate — session IDs are UUID-sized, so this is overload-only.\n\n- OpenCode worker MAX_PENDING_CALLS=256 vs single-threaded batches of 8: unreachable normally.\n\nThe three low-severity user-facing items (all requiring pathological single-message / single-file / single-field sizes) match the prior reviewer's assessment; I could not refute the 'ordinary users see no change' claim. Recommend sign-off as a draft PR for human review./Users/nwparker/orca/workspaces/orca/oom-followup/src/main/ai-vault/session-jsonl-line-reader.ts: CONFIRMED cleanup leak: consumeAiVaultJsonlLines manually drives the async generator with iterator.next(), but does not call iterator.return() in a finally block. If onLine/state.consumeLine throws, the createReadStream remains open rather than receiving async-iterator teardown. I reproduced this against TARGET with a 64 MiB JSONL file and observed the descriptor still open via lsof after the rejection was caught; the equivalent direct for-await loop and an early break from iterateAiVaultJsonlLines both closed it. Repeated scans of a record that makes a production consumer throw can therefore accumulate descriptors until GC.Files
61 files changed (+3448 / −685).
🤖 Decomposed, reviewed & assembled by Claude Code from the reverted #10179. Draft — do not merge out of order.