Repository navigation
improve(memory): lower memory-core startup RSS - #119372
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 8:11 PM ET / August 5, 2026, 00:11 UTC. ClawSweeper reviewWhat this changesDefers Memory Core session-backfill execution loading until a valid gateway request, reducing plugin-startup memory while retaining synchronous method registration and validation. Merge readinessNo blocking findings: current main still eagerly imports the backfill execution graph, while this PR isolates that load behind valid gateway requests. The member-authored, maintainer-labeled change needs ordinary merge judgment; likely related people: Shakker and Peter Steinberger (high confidence). Priority: P3 Review scores
Verification
How this fits togetherMemory Core registers memory and session-backfill gateway methods during plugin startup. Valid backfill requests then read session ingestion state and return preview, apply, or rollback results. flowchart LR
A[Memory Core startup] --> B[Gateway method registration]
B --> C[Backfill request]
C --> D[Input and agent validation]
D --> E[Lazy backfill runtime]
E --> F[Session ingestion state]
E --> G[Gateway result]
Decision needed
Why: The PR is authored by a repository member and carries the protected maintainer label, so automated triage must leave the final merge choice to maintainers. Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +8, Tests +81. Total +89 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Merge the dedicated gateway runtime boundary so plugin startup avoids the backfill execution graph while CLI execution keeps its existing static path. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a measured startup-memory optimization, not a report of broken existing behavior; the PR supplies repeated exact-artifact profile output. Is this the best way to solve the issue? Yes: the gateway adapter is the sole non-CLI registration edge, so deferring only its execution graph avoids both eager startup loading and an unnecessary change to CLI behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9ff9aac71a8b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
811dbf9 to
43ce571
Compare
Punchcard-Session: coral-workshop-workshop-3f
43ce571 to
af2957a
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Exact artifact-backed memory profile evidence Both sides used the same host, Node runtime, dependency tree, profiler command, and restored base Command shape: OPENCLAW_LOCAL_CHECK=0 node scripts/profile-extension-memory.mjs \
--extension memory-core \
--skip-combined \
--concurrency 1 \
--json <report-path> |
|
Maintainer decision: accepted. I reviewed the exact-head owner boundary, exact CI, paired artifact profile, and ClawSweeper recommendation. No repair or rank-up move remains. The latest |
|
Merged via squash.
|
Punchcard-Session: crisp-lantern-orchard-nv * origin/main: perf(memory): defer session backfill runtime (#119372) fix(ci): isolate built TUI PTY fixture (#119339) fix(commands): restore tool inventory for dynamic models (#119306) fix(media): release rejected BytePlus and Runway video downloads under debug capture (#119257) docs: add ChromeOS (Crostini) platform install guide (#107663) test(msteams): serve JWKS from in-process server in auth coverage (#119354) fix(qa): enable OpenAI for stored audio scenario (#119349) test(agents): realpath apply-patch temp dir fixture (#119353) test(slack): drop redundant .js-suffixed system-event mock (#119352) fix(exec): leave safe builtins unrewritten in enforced mode (#119351) fix(sessions): keep gateway responsive while large transcript archives are built (#112424) fix(tui): restore provider auth in installed local mode (#119283)
…time * origin/main: fix(ui): clear split-pane questions after answers and cancellations (#118787) fix(slack): authorize reaction and message reads before applying limits (#118736) fix(ci): isolate cache warmer configs (#119381) fix(slack): Fix bad escaping in slack tool commentary (#119373) feat(audit): add execution identity inspection (#117034) fix(fs): adopt fs-safe 0.5.2 untrusted filename sanitization (#119363) fix(ci): preserve release evidence across reruns (#119380) fix(telegram): keep commands responsive during Codex login perf(memory): defer session backfill runtime (#119372) fix(ci): isolate built TUI PTY fixture (#119339)
Punchcard-Session: coral-workshop-workshop-3f
What Problem This Solves
Loading the selected memory-core plugin also loaded the historical session-backfill execution graph, even when operators never used the Control UI backfill methods. Paired profiling of exact CI artifacts from
mainand this PR shows that graph adds about 141 MB of avoidable peak RSS during the isolated plugin import.Why This Change Was Made
Gateway method names, scopes, request validation, config lookup, and error mapping remain synchronously registered. The heavy backfill implementation now loads once on the first valid request through a dedicated gateway runtime facade, selection validation lives in a dependency-light leaf, and memory-core uses its focused host facade instead of the deprecated broad agent runtime barrel.
The dedicated facade keeps the gateway's dynamic import separate from the CLI runtime's static imports. Dreaming registration is intentionally unchanged because its timers, generations, and shutdown cleanup need a separate lifecycle-focused change.
Architectural owner: the memory-core gateway adapter. Production delta: +68/-60 lines (net +8); tests: +81 lines.
User Impact
Operators get lower startup memory use with no change to memory tools, prompts, gateway method availability, permissions, request validation, or backfill results.
Evidence
dist-runtime-buildartifacts from successful main CI atfb81d03d8eb2and exact-head PR CI ataf2957ab7f9b:node scripts/run-vitest.mjs extensions/memory-core/src/session-backfill-gateway.lazy.test.ts extensions/memory-core/src/session-backfill-gateway.test.ts extensions/memory-core/src/session-backfill.test.ts extensions/memory-core/index.test.ts30960740376passed, including build artifacts, production/test types, lint, runtime topology, extension package boundaries, and all selected test shards.git diff --checkpassed.AI-assisted: yes. The implementation and evidence were reviewed before submission.
Punchcard-Session: coral-workshop-workshop-3f