Repository navigation
perf: bound VS Code analysis and mutation memory below 2 GB - #258
Conversation
Record fresh CLI and repeated/concurrent MCP timings, process peak RSS, and complete report parity against a pinned clean source fixture. Reject timeouts, process errors, output drift, and the 2 GB ceiling. The first full run passes all 15 CLI outputs and all 20 MCP reports but exposes a 3.74 GB mixed-session peak. Preserve that failing baseline and prioritize MCP retention in the documented five-job plan.
Keep parsing and grouping in disposable worker VMs with bounded scheduling and clean exit checks. Cache one immutable declaration and grouping snapshot, avoid decoding declarations for repeated reports, and use compact numeric fingerprints without changing similarity scores or ordering. The pinned VS Code mixed session peaks at 1.868 GB instead of 3.741 GB. All 20 MCP reports, 15 fresh CLI reports and 3,809 complete similarity groups match their baselines. Preserve synchronous library search and add the async worker path for CLI, MCP and library command calls. Share cache-reset operations with workspace discovery so companion maps are cleared together without duplicating reset implementations.
Validate source membership, imported source mtimes and resolver filesystem inputs before reusing plain graph records. Reparse small edits without retaining ASTs and bound incremental resolution history with periodic full rebuilds. Invalidate discovery on source additions, renames and deletions, including outside include roots and explicitly included hidden directories. Add a disposable VS Code edit harness that compares complete ordered records against fresh graphs without materializing duplicate whole-graph JSON strings.
Report exact unresolved targets and manifest paths through analyze and unused. Prove emitted entrypoint mappings with explicit compiler layouts and preserve unknown usage for incomplete, ambiguous or out-of-graph package surfaces. Include emitter settings in graph cache validity and retain config provenance. Give standalone test projects their own package boundary and test public, imported, internal and dead exports alongside failure and invalidation cases. Add a VS Code comparator allowing only the documented additive explanations.
Stream move and rename graphs and lexical scopes, compact edit spans, and apply plans only after the analysis process exits cleanly. Isolate standalone MCP analysis jobs and reclaim similarity temporaries between bounded batches. Preserve complete reports, ordering, conflicts, verification and rollback. Preflight missing type dependencies without claiming a successful check. Count native parent and worker peaks together and exercise repeated, concurrent and applied fixture workloads. Include workers in source, compiled and library entrypoints, including nested bundles. Repeated MCP calls trade cache hits for bounded retention; record that latency cost with the benchmark evidence.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merge gate: requirements audit blocked by #259CI is green on The diff changes the engines behind many declared scenarios (ANLY-, AUDIT-, BATCH-*, find/similar/move/rename), so a focused requirements audit is required before merge. That audit cannot run:
Owner / next action: repair the receipt and line lengths under #259 on |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 13c9016181
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
runWorkerJob always awaited worker.terminate() in finally, including after the worker had already emitted exit. On the Linux runner (Bun 1.3.14) terminating an exited worker blocks or kills the caller (cf. oven-sh/bun#11335): main CI has hung until cancellation since 136fd75, and published 1.8.3 carries the same path. Track the exit and terminate only a live worker. Fail a hung CI job after 20 minutes instead of the 6 hour default. Refs #258
# Conflicts: # src/core/analysis-workers.ts
Preserve all 82 scenarios and relocate oversized register cells to linked details. Replace machine-specific receipt commands with portable validator provenance and current clause/test evidence, and align repository guidance.
Give source and manifest rewrites distinct mtimes so incremental graph tests do not depend on filesystem timestamp resolution.
Resolve ancestor and explicit projects before counting source ownership. Include unique sibling-package sources in workspace analysis so narrowed report directories cannot keep large graphs in the long-lived server. Preserve warm small-project execution and exact isolated report parity.
Refresh source provenance and validation evidence after the isolation-scope and cache-test corrections. Preserve all product scenarios and metadata.
VS Code analysis and mutations could retain 6–7 GB of parser state. The measured fixture workloads now stay below the 2,000,000,000-byte acceptance ceiling, including the caller and analysis processes, while preserving complete reports, similarity scores, ordered edits, applied bytes, and rollback behavior.
Large analyses use bounded workers, streamed graph metadata, disposable planning processes, and bounded similarity caches. Exact overlap bounds sift similarity candidates without changing greedy grouping or output order. Incremental graph updates reuse unchanged records. Unknown package entrypoints retain explicit explanations and cannot authorize destructive verdicts.
Standalone MCP isolation uses the shared 2,048-source-file threshold. Sizing resolves the actual project config, includes unique sibling-package sources in workspace mode, and handles source-subdirectory and explicit-project requests. Small projects retain warm caches. Writes and verification remain in the caller. Workers are terminated only while still live, preventing the Linux Bun hang after a successful worker exit.
Validation
225a0fa530ceff3013168a5c023290d0e8a4024b: worst mutation CLI peak 1.010 GB; read-only CLI 1.191 GB; 21-call applied MCP session 1.776 GB; mixed previews 1.417 GB. Full similarity output preserves all 3,809 groups exactly.Detailed methodology and measurement provenance are in the performance report. These recorded fixture benchmarks were not rerun for the requirements repair and final scope-selection fixes.
Requirements
Preserves all 82 scenario blocks and their metadata. Oversized register cells move verbatim to linked details, and every physical requirements line is within 200 Unicode code points. The receipt contains portable validator provenance and separate passing structure, document-quality, and implementation evidence. Repository guidance now matches the validator contract.
Fixes #259.
Tradeoffs and boundaries
Large-project MCP calls discard parser caches after each call, raising warm-call latency substantially (the recorded VS Code analyze case rises from about 1.2 s to 30 s), and heavy jobs are serialized. Small projects and ordinary library callers retain their caches.
This is measured fixture acceptance, not an OS-enforced cap. The fixture has no installed dependencies: missing required types produce an incomplete verification result before starting the full compiler. Rename rolls back; plain move preserves its existing leave-applied policy. Successful VS Code typechecking and memory use with dependencies installed are not claimed.