Skip to content

[P0] Make large-repository analyze bounded, staged, resumable, and SIGTERM-safe #132

Description

@100yenadmin

Parent: #130

Goal

Make large 2,048-dimensional repository analysis bounded, staged, resumable, and cooperative under memory pressure while keeping the canonical index readable.

Non-goals

Do not increase resource limits to hide leaks, restart all embeddings after interruption, auto-SIGKILL analyzers, or mutate the live canonical database before staged validation.

Required behavior

  • Automatic heap cap: max(2048, min(6144, floor(effectiveMemoryMb * 0.5))); explicit NODE_OPTIONS wins.
  • Stream cached-vector identity, buffer at most 256 vectors for preservation, page at most 512 embeddable nodes, use embedding batch 16 and HTTP sub-batch 8.
  • Add analyze --staged with durable promotion journal: prepared, old-backed-up, new-installed, metadata/registry-committed.
  • Preserve the 5,000-node pending window and resume only it plus genuine changes.
  • Route SIGTERM through bounded checkpoint shutdown and emit sanitized JSONL resource progress via GITNEXUS_ANALYZE_RESOURCE_LOG.

Acceptance and proof

Crash injection at every promotion/checkpoint boundary; 25k x 2,048 CI integration; sequential clean and interrupted/resumed 85k and 125k release soaks; one disposable OpenClaw corpus. Record V8, RSS, and swap as observational telemetry for Voyage-backed runs; acceptance is bounded buffering/checkpoint behavior and no missing or mixed canonical generation, not a host-resource admission threshold.

Evidence: /Volumes/LEXAR/Codex/session-notes/2026-07-20/gitnexus-repository-health-sprint/evals/.

Stop conditions

Stop on unbounded materialization, analyzer crash, unresolved WAL/shadow state, false-success exit, credential/source leakage, or any failure path able to delete both generations.

Exact next action

Create feat/staged-large-repo-analyze from current protected main, run graph impact on heap/cache/pipeline/shutdown symbols, and implement bounded behavior before promotion mechanics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Release-blocking priority zero workevidence-gateMust close with retained validation evidencerelease-blockerBlocks promotion or release readiness

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions