Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR releases private transcript records during export and joins rendered text in smaller groups to reduce worker memory use. Example: Index a session containing 12,460 assistant messages with 15 KB of text each.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it provides a focused, demonstrated repair for a current Gateway crash, with no actionable findings; required CI remains pending. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe session export worker reads admitted transcript snapshots, renders conversation text and aligned metadata, and delivers complete entries to the memory indexer. flowchart LR
A[Memory search or catch-up] --> B[Transcript export worker]
B --> C[Admitted database snapshot]
C --> D[Shared session renderer]
D --> E[Complete text and metadata]
E --> F[Acknowledged host delivery]
F --> G[Memory index]
Technical reviewBest possible solution: Land the existing owner-local repair once the reviewed head satisfies required CI. Do we have a high-confidence way to reproduce the issue? Supplied built-Gateway Docker logs reproduce exit 134 twice on baseline main using the reporter's 12,460-message fixture; source inspection confirms the responsible allocation path remains on fetched main. Is this the best way to solve the issue? The patch removes simultaneous retention at the existing renderer and worker owners while preserving complete output, cached snapshots, observer behavior, reset metadata, and acknowledgement; no smaller complete repair was identified. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 25e722837249. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +36, Tests 0. Total +36 across 4 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed November 9, 2026, 2:59 PM ET / 19:59 UTC (Revision 4). |
|
@clawsweeper re-review The Evidence section now includes the completed real Gateway startup catch-up and post-compaction acceptance at unchanged head Separately, the current CI, CodeQL, Critical Quality, Security Review, and Periphery summary pages report Could someone with Actions write access retry those workflows at this head? My repository access is read-only. These failures remain a delivery blocker; this is not a request to waive CI or merge. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Addressed the test-budget P2 in The requested test-line check reproduced the failure before the record and now passes (6,602,929 lines, ceiling 6,602,932, slack 3). Formal exact-head proof also passed the full-PR whitespace check and verified that runtime and all test blobs are byte-identical to Exact-head changed-test shards, lint, production types, Security Review, and Critical Quality have passed. The remaining main-CI/CodeQL jobs are still running; this request does not claim author delivery or passing aggregate CI. Push/body dispatches reported |
|
🦞👀 Re-review progress:
|
|
Maintainer proof for the out-of-memory crash in #196132 (built Gateway, secretless Docker, node 24.22.1). Setup: the reporter's
Controls:
Test changes: the allocation file is removed. The regressions are folded into existing cases with net 0 test lines. The worker batch test now grows a cached session past the 4 MB retention limit and checks that the whole consumed export comes back (6,250 wrapped lines). The dreaming-provenance test now uses a fragment large enough to flush a text chunk before the reset. Run summaries: |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Maintainer override:
|
|
Landed in e64c351. Thanks @ericcaiwx-star. Large session exports no longer crash the Gateway. |
fix(memory): keep large session exports under the worker memory limit
One large session could make the memory-index session export worker exceed its 512 MB heap limit. The whole Gateway then aborted with exit 134 and the index stayed empty. The renderer now releases intermediate data while it exports, so peak memory stays under the limit. Exported content is unchanged.
Evidence: a built Gateway in Docker on node:24.22.1 with no heap changes, using the reporter's own seed script (12,460 messages of 15 KB, about 178 MB of text), indexed through openclaw memory search. On main the Gateway aborted twice with exit 134 ("Reached heap limit"); the export worker was at about 615 to 622 MB. With this change the search succeeds twice on the same Gateway process, the session is fully indexed (236,702 chunks), both runs give identical rows, and the worker peaked at 436 to 494 MB. A small mixed session and an 8,000-message session give identical index rows on main and this change, and the 8,000-message chunks match the large export at the same positions. Details: openclaw#196158 (comment).
check-lint-core-4 is an inherited max-lines red in six untouched files: openclaw#196158 (comment)
Thanks @ericcaiwx-star.
Co-authored-by: Ayaan Zaidi <[email protected]>
The session memory export rendered a whole session into one string inside the 512 MB transcript worker and returned it to the main thread. #196158 halved the peak, but sessions above roughly 240 MB of message text still exhausted the worker, and the full text still landed on the main heap. The renderer now emits ~1 MB pages over the existing session-entries channel, reads large transcripts in 2 MiB slices, and computes the persisted entry hash and dreaming prefix hash incrementally (byte-identical to the previous formula). buildSessionEntry/buildSessionEntries keep their shape; memory indexing, startup eligibility, dreaming ingestion and memory-forget move to streamSessionEntry/streamSessionEntries. Snapshot-based export paths made dead by the cutover are removed. Refs #196132 Co-authored-by: obviyus <[email protected]>
The session memory export rendered a whole session into one string inside the 512 MB transcript worker and returned it to the main thread. #196158 halved the peak, but sessions above roughly 240 MB of message text still exhausted the worker, and the full text still landed on the main heap. The renderer now emits ~1 MB pages over the existing session-entries channel, reads large transcripts in 2 MiB slices, and computes the persisted entry hash and dreaming prefix hash incrementally (byte-identical to the previous formula). buildSessionEntry/buildSessionEntries keep their shape; memory indexing, startup eligibility, dreaming ingestion and memory-forget move to streamSessionEntry/streamSessionEntries. Snapshot-based export paths made dead by the cutover are removed. Refs #196132 Co-authored-by: obviyus <[email protected]>
The session memory export rendered a whole session into one string inside the 512 MB transcript worker and returned it to the main thread. #196158 halved the peak, but sessions above roughly 240 MB of message text still exhausted the worker, and the full text still landed on the main heap. The renderer now emits ~1 MB pages over the existing session-entries channel, reads large transcripts in 2 MiB slices, and computes the persisted entry hash and dreaming prefix hash incrementally (byte-identical to the previous formula). buildSessionEntry/buildSessionEntries keep their shape; memory indexing, startup eligibility, dreaming ingestion and memory-forget move to streamSessionEntry/streamSessionEntries. Snapshot-based export paths made dead by the cutover are removed. Refs #196132 Co-authored-by: obviyus <[email protected]>
The session memory export rendered a whole session into one string inside the 512 MB transcript worker and returned it to the main thread. #196158 halved the peak, but sessions above roughly 240 MB of message text still exhausted the worker, and the full text still landed on the main heap. The renderer now emits ~1 MB pages over the existing session-entries channel, reads large transcripts in 2 MiB slices, and computes the persisted entry hash and dreaming prefix hash incrementally (byte-identical to the previous formula). buildSessionEntry/buildSessionEntries keep their shape; memory indexing, startup eligibility, dreaming ingestion and memory-forget move to streamSessionEntry/streamSessionEntries. Snapshot-based export paths made dead by the cutover are removed. Refs #196132 Co-authored-by: obviyus <[email protected]>
* fix(memory): stream session memory exports in bounded pages The session memory export rendered a whole session into one string inside the 512 MB transcript worker and returned it to the main thread. #196158 halved the peak, but sessions above roughly 240 MB of message text still exhausted the worker, and the full text still landed on the main heap. The renderer now emits ~1 MB pages over the existing session-entries channel, reads large transcripts in 2 MiB slices, and computes the persisted entry hash and dreaming prefix hash incrementally (byte-identical to the previous formula). buildSessionEntry/buildSessionEntries keep their shape; memory indexing, startup eligibility, dreaming ingestion and memory-forget move to streamSessionEntry/streamSessionEntries. Snapshot-based export paths made dead by the cutover are removed. Refs #196132 Co-authored-by: obviyus <[email protected]> * fix(memory): keep session export indexing live under one compute permit The session export worker holds the shared compute permit while it waits for indexing to take each page. Indexing in the shared pool then waited for that permit, so one-permit hosts (two CPUs) deadlocked. Chunk session pages in a one-worker pool that runs under the export's permit, and dispatch the chunker only once its export delivers, so a queued chunker never waits on a queued export. Co-authored-by: obviyus <[email protected]> * fix(memory): revalidate incognito authority before each export page A consumer that revoked the selected actor's authority inside onPage still received later pages because authority was checked only after rendering. Assert live authority immediately before every page and reset delivery. Co-authored-by: obviyus <[email protected]> * test: allocate test lines for paged session memory export coverage Co-authored-by: obviyus <[email protected]> --------- Co-authored-by: obviyus <[email protected]>
…#196480) * fix(memory): stream session memory exports in bounded pages The session memory export rendered a whole session into one string inside the 512 MB transcript worker and returned it to the main thread. openclaw#196158 halved the peak, but sessions above roughly 240 MB of message text still exhausted the worker, and the full text still landed on the main heap. The renderer now emits ~1 MB pages over the existing session-entries channel, reads large transcripts in 2 MiB slices, and computes the persisted entry hash and dreaming prefix hash incrementally (byte-identical to the previous formula). buildSessionEntry/buildSessionEntries keep their shape; memory indexing, startup eligibility, dreaming ingestion and memory-forget move to streamSessionEntry/streamSessionEntries. Snapshot-based export paths made dead by the cutover are removed. Refs openclaw#196132 Co-authored-by: obviyus <[email protected]> * fix(memory): keep session export indexing live under one compute permit The session export worker holds the shared compute permit while it waits for indexing to take each page. Indexing in the shared pool then waited for that permit, so one-permit hosts (two CPUs) deadlocked. Chunk session pages in a one-worker pool that runs under the export's permit, and dispatch the chunker only once its export delivers, so a queued chunker never waits on a queued export. Co-authored-by: obviyus <[email protected]> * fix(memory): revalidate incognito authority before each export page A consumer that revoked the selected actor's authority inside onPage still received later pages because authority was checked only after rendering. Assert live authority immediately before every page and reset delivery. Co-authored-by: obviyus <[email protected]> * test: allocate test lines for paged session memory export coverage Co-authored-by: obviyus <[email protected]> --------- Co-authored-by: obviyus <[email protected]>
fix(memory): keep large session exports under the worker memory limit
One large session could make the memory-index session export worker exceed its 512 MB heap limit. The whole Gateway then aborted with exit 134 and the index stayed empty. The renderer now releases intermediate data while it exports, so peak memory stays under the limit. Exported content is unchanged.
Evidence: a built Gateway in Docker on node:24.22.1 with no heap changes, using the reporter's own seed script (12,460 messages of 15 KB, about 178 MB of text), indexed through openclaw memory search. On main the Gateway aborted twice with exit 134 ("Reached heap limit"); the export worker was at about 615 to 622 MB. With this change the search succeeds twice on the same Gateway process, the session is fully indexed (236,702 chunks), both runs give identical rows, and the worker peaked at 436 to 494 MB. A small mixed session and an 8,000-message session give identical index rows on main and this change, and the 8,000-message chunks match the large export at the same positions. Details: #196158 (comment).
check-lint-core-4 is an inherited max-lines red in six untouched files: #196158 (comment)
Thanks @ericcaiwx-star.
Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit e64c351)
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 574ac6c27c0df9683bf7546c6db798062cbcc073)
Co-authored-by: vincentkoc <[email protected]>
* fix(memory): stream session memory exports in bounded pages The session memory export rendered a whole session into one string inside the 512 MB transcript worker and returned it to the main thread. #196158 halved the peak, but sessions above roughly 240 MB of message text still exhausted the worker, and the full text still landed on the main heap. The renderer now emits ~1 MB pages over the existing session-entries channel, reads large transcripts in 2 MiB slices, and computes the persisted entry hash and dreaming prefix hash incrementally (byte-identical to the previous formula). buildSessionEntry/buildSessionEntries keep their shape; memory indexing, startup eligibility, dreaming ingestion and memory-forget move to streamSessionEntry/streamSessionEntries. Snapshot-based export paths made dead by the cutover are removed. Refs #196132 Co-authored-by: obviyus <[email protected]> * fix(memory): keep session export indexing live under one compute permit The session export worker holds the shared compute permit while it waits for indexing to take each page. Indexing in the shared pool then waited for that permit, so one-permit hosts (two CPUs) deadlocked. Chunk session pages in a one-worker pool that runs under the export's permit, and dispatch the chunker only once its export delivers, so a queued chunker never waits on a queued export. Co-authored-by: obviyus <[email protected]> * fix(memory): revalidate incognito authority before each export page A consumer that revoked the selected actor's authority inside onPage still received later pages because authority was checked only after rendering. Assert live authority immediately before every page and reset delivery. Co-authored-by: obviyus <[email protected]> * test: allocate test lines for paged session memory export coverage Co-authored-by: obviyus <[email protected]> --------- Co-authored-by: obviyus <[email protected]> (cherry picked from commit e881eb8) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 9c7100ce7686c74daf4b644e96666c64c2dde192) Co-authored-by: vincentkoc <[email protected]>
Backport-of: openclaw#196158 and openclaw#196480. Only the rendered export remains materialized for the existing consumer.
Backport-of: openclaw#196158 and openclaw#196480. Only the rendered export remains materialized for the existing consumer.
Closes #196132
What Problem This Solves
One large session could exhaust the capped memory-index export worker while it retained the projected transcript, sanitized string backing stores, rendered lines, and final joined output together. Export grouping and acknowledgement already bounded batches, but did not release these intermediates within an individual export.
Why This Change Was Made
The existing renderer now consumes records only from private, uncached worker snapshots and flattens rendered text in groups. Reset boundaries are captured before consumption. Cached, actor/caller-owned, and observer snapshots retain their existing behavior. Late generated-session classification clears both buffered and flushed text plus aligned metadata.
This keeps the repair in the current export owner. Complete content, order, hashes, source line mappings, timestamps, provenance, snapshot fences, cold behavior, and whole-entry acknowledgement remain intact. No heap increase, truncation, disabled memory feature, public SDK export, configuration option, schema, or streaming protocol was added. Necessary production growth is 36 lines net for explicit ownership and intermediate release.
User Impact
Large historical sessions can finish cross-conversation memory indexing and remain searchable while other sessions continue to work. The existing full-output API and per-message allocation still cost O(result); 256 KiB is a text flush threshold plus one message, not a universal peak-memory bound.
Evidence
Current head:
20d5573d6540f0a74319c623abf1ba9829bba1ea. The follow-up commit adds only the dedicated test-line allocation. Runtime and all test blobs are byte-identical to implementation924fb74a2e120778c23b5f2d9ed132e0df5b774b, where all behavior evidence below was executed; it is reused on that explicit basis, not claimed as a rerun. Named main base:6edcaa28edb7817efda38eccc4f0c7fd13ad148c. Runtime: Node 26.7.0, macOS arm64. Production worker limits remain 512 MiB old / 32 MiB young generation.Real-worker red / green
The added production-pool regression persists one 12,460-message session, 15,000 characters per message (186,900,000 text bytes, 178.24 MiB), with spaced text and distinct ordered markers. It checks full expected output length, every message marker in order, aligned metadata, and a subsequent successful export.
The initial solid-text control passed and is not represented as a failure. The reproduced failure is worker OOM; the reporter's separate Gateway exit 134 was not reproduced.
Real Gateway: startup catch-up and post-compaction indexing
Task-owned Node Gateways used isolated state/free ports, active memory-core, sessions/FTS-only indexing, and a real local Gemma3 model on an independently owned Ollama service with verified 32K context. No reporter fork was executed, no direct manager sync supplied the result, and no production Gateway/state/model daemon was changed.
Startup catch-up used a fresh Gateway and an unindexed 178.24 MiB transcript. Public resident
memory.searchacquired the default manager and its automatic startup catch-up; this is cold manager acquisition, not a claim of eager indexing at process-ready time. The source and 37,381 chunks were published, all head/middle/tail sentinel searches returned independently identified source ranges, and real sibling turns succeeded before and after indexing. Gateway survived; cleanup joined.Post-compaction proof retained the same full 178.24 MiB raw history. The declared prior-history fixture used
SessionManager.appendCompactionAsyncwith the existing atomic compaction/accounting persistence owner, following the repository's precompacted-history test pattern. Its prior summary is synthetic input, not claimed model-generated evidence. A small active tail and a 4 KiB test-profile byte trigger exercised the next real compaction without asking a local model to summarize millions of historical tokens from scratch. This changes the trigger size, not the transcript export size or worker limits.Observed native export tasks completed after the new boundary and continuation. Both flows kept complete raw historical content available to export. Repeated filler fragments can share existing chunk IDs, so stored chunk character totals are not a raw-byte equality oracle; full export length/order and independent per-message index coverage provide that evidence.
Paired diagnostic observations: startup worker observed heap maximum 430.4 MiB; post-compaction 431.6 MiB across three successful export tasks, with unchanged resource limits (observed V8 aggregate heap limit 560 MiB). Gateway status samples observed main-heap maxima 1159.3/1163.2 MiB and process RSS maxima 3938.2/4122.3 MiB for startup/post-compaction. RSS is process-wide, heap is isolate-local; sparse instrumented samples are not exact peaks, a latency benchmark, or a constant-memory claim. No new host accumulator was introduced.
Coverage limits and preserved setup failures: the real Gateway used synthetic persisted history and FTS-only indexing, not external embedding services or live user data. Initial model setup had a mismatched context/output-budget contract; the task route was corrected to the provider's supported settings. Two all-active-history compaction attempts timed out during multi-request real-model summarization, before a compaction result; they are not passing proof or export failures. The passing post-compaction flow proves new compaction → complete historical export/indexing, not first-time summarization throughput for 178 MiB of active context.
Checks and independent review
packagesandagents-sessions. Scoped type-aware lint, format, andgit diff --checkpassed.OpenClaw 2026.11.2 (924fb74).scoped-clean, no findings, both for the local candidate before commit and through the source-bound clean exact-head monitor review (--mode branch --base 6edcaa28edb7817efda38eccc4f0c7fd13ad148c --engine codex --max-priority P2). The reviewer inspected code and did not execute tests; runtime evidence above was executed separately.Maintainer update (head 7378aa2)
openclaw memory searchaborts the Gateway on main (exit 134, V8 heap limit, twice). This head completes the export twice with identical index rows, and the controls match main exactly. Details: fix(memory): large session exports exhaust workers #196158 (comment)Author-side checks and actionable reviews are complete. The PR remains open and unmerged for maintainer review; no merge is performed by this contributor workflow.