Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review Ready for review at |
|
🦞👀 Re-review progress:
|
Codex Review Summary: ✅ CompletedThis 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. |
|
Codex review: needs maintainer review before merge. What this changesThis PR bounds history-cut planning memory, streams retained transcript payloads, and preserves typed budget errors across the worker boundary. Example: Rewind a local history containing 20,000 messages with 32 KiB bodies.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a current shared-worker OOM path; no actionable introduced defects were found, including in the final fixture repair, while exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway history actions call the session accessor, which plans and commits transcript cuts in the database worker and returns the new session identity and editor content. flowchart TD
A[Gateway history action] --> B[Session accessor]
B --> C[Database worker transaction]
C --> D[Bounded navigation reader]
D --> E[Existing cut planner]
E --> F[Streaming append owner]
F --> G[SQLite transcript and session rows]
Technical reviewBest possible solution: Keep bounded planning and streamed copying inside the existing session transaction and append owners, preserving exact history and atomic refusal. Do we have a high-confidence way to reproduce the issue? Current main materializes every transcript body before planning, matching the recorded 20,000-message public-worker OOM reproduction; this read-only review executed no target code. Is this the best way to solve the issue? The change removes full-body retention at its producer, reuses the planner and append owner, and preserves workspace preflight and transactional settlement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 93fdc3d9ada2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +128, Tests +20, Docs +3, Other +291. Total +442 across 10 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
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 14, 2026, 5:47 AM ET / 10:47 UTC (Revision 4). |
|
Final-head public-entry-point proof for the review's Tests note is now complete at The public This public-path timing includes admission/lifecycle work and is separate from the controlled owner measurements already in the body. The body now includes both boundaries. No source changes were needed; the review has zero findings and no open checklist items on this head. CI remains in progress with a failed shard being investigated. |
|
@clawsweeper re-review The head is now Production source is byte-identical to the previously reviewed head, so its large public-worker proof and payload comparison remain applicable. The body now includes that public proof and accurately records the first CI run's other failures. A new exact-head CI run is required before landing. |
|
🦞👀 Re-review progress:
|
Main #198775 groups exact archive reads by store identity. The pinned-page fixture held archive-pin before main while waiting for main to progress, causing a reproducible 120-second timeout on the CI main parent. Sort the held fixture store after main without changing assertions, timeouts, or production behavior. All 22 cases pass on both the PR branch and CI parent with this fixture correction; Codex review is clean.
|
The final head is The previous review has zero findings and zero open items. Please verify the test-only follow-up on this head. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
… worker (openclaw#198786) * fix(sessions): bound worker memory during large history cuts * test(sessions): bind benchmark observers to their native owners * test(sessions): preserve held archive read ordering Main openclaw#198775 groups exact archive reads by store identity. The pinned-page fixture held archive-pin before main while waiting for main to progress, causing a reproducible 120-second timeout on the CI main parent. Sort the held fixture store after main without changing assertions, timeouts, or production behavior. All 22 cases pass on both the PR branch and CI parent with this fixture correction; Codex review is clean.
Backport #198786 onto the existing stable message-cut path. Plan with compact navigation and hydrate copied rows lazily inside the existing transaction. Refuse oversized history before it reaches the worker heap and preserve the canonical actionable error through Gateway responses. Retain existing SQL/navigation helpers and append ownership. Do not import newer worktree preflight, in-place rewind migration, or performance fixtures. The real SQLite baseline accepted an oversized row and rotated the session; 121 targeted tests now pass across six files, including native settlement. No measured performance or full release qualification is claimed. (cherry picked from commit b62210f) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes large local session rewinds exhausting the shared database worker's heap and failing unrelated requests using that worker.
User Impact
Large local histories can be rewound without holding every message body in memory. Rewind, fork, and branch-switch preserve their existing history and editor results. Requests exceeding the safe navigation or individual-event budget fail clearly without changing the conversation or killing its database worker. Workspace preflight retains its existing full-history read with an explicit 8 MiB budget.
The limits are 8 MiB per event, 8 MiB of retained navigation/editor/header data, and 100,000 events. These reject an oversized operation rather than truncate its result. No configuration, schema, worker heap limit, or integrity-gate change.
Why This Change Was Made
The transaction previously loaded the entire transcript into JavaScript before planning the cut. It now reads SQLite's navigation projection, hydrates only the selected editor/header content, and feeds retained full events one at a time through the existing append owner. The existing typed read-budget error survives worker transport and reaches the caller.
The simplification removes full-body materialization and the redundant stringify pass used to decide whether to rebuild the index synchronously. Production code grows by 128 lines: bounded navigation and exact-payload streaming need an explicit reader, plus error transport. No new state or cache is introduced.
Evidence
On main parent
159df507ba665110e28f1f28859d60360ced6082, the real public rewind API killedsqlite-store.workerwithERR_WORKER_OUT_OF_MEMORYfor 20,000 synthetic messages containing 32 KiB each. The worker retained its actual 512 MiB old-generation / 32 MiB young-generation limits.On production source at
3018a73ff478(byte-identical on current head7130b866ab0b), the publicrewindSessionToMessageAPI also succeeds against the real shared sqlite-store worker on the 36.55 GiB synthetic database:createdin 23.616 s, 32 KiB editor text restored, a subsequent session-entry write succeeds, and all 20,000 copied payloads compare exactly after closing the runtime handles. Worker construction reports the unchanged 512/32 MiB resource limits; there are no worker errors. This public-path timing includes admission/lifecycle work and is separate from the owner-only comparison.The fixed transaction succeeds on the same 36.55 GiB synthetic database with 17,690 sessions. All 20,000 retained payloads compare exactly against the originals in SQLite. Peak sampled worker heap is 127.3 MiB; elapsed time including the payload equality assertion is 10.17 s, with 9.92 s thread CPU.
Five paired controls with 2,000 messages on the same database, fresh workers, and Node 26.12.1:
A/A wall controls were 1,131 / 1,100 ms and CPU controls 1,055 / 1,072 ms. Separate allocation sampling showed 436.4 / 445.7 MiB medians. This fixes retained heap, not allocation volume or a demonstrated latency bottleneck. The synthetic fixture and reproduction scripts are included; no production data was used. Measurements are local filesystem owner proof, not a remote deployment or filesystem-workspace benchmark.
Focused coverage: 51 session/accessor/native-binding/Gateway tests pass, including a new oversized-history regression that fails on the exact main parent and verifies request rejection, unchanged session identity, and a subsequent successful write. Control UI browser history-settlement test and 17 chat lifecycle e2e tests pass. Codex autoreview is clean.
pnpm check:changedhas two independently reproduced main regressions in its export scan:normalizeDiscoveredAgentModelbecame unused in #198591 (730ce41827c40c9075685e5601e0371687ff05fa), andMEMBER_ROLE_PRESETSwas exported without a production consumer in #197739 (4fc7acf90a736eb92cd8690ec8036ace5f212abc). The same two failures reproduce on the exact main parent; this change does not edit either owner.pnpm buildpasses (3m 18s). Exact-head CI results will be recorded before landing.First CI run 43580654616 found one PR-caused failure: the benchmark added two lint suppressions. The observer now binds methods to the owned connection/statements without suppressions; targeted lint, all 14 suppression tests, a synthetic control replay (6,151 statements / 2,001 rows), and fresh Codex autoreview pass. Production code and its measured behavior are unchanged.
Four native Talk post-cancel assertions reproduce on exact parent
159df507; #198100 (bf0b8002c2b9) enabled the prefix assertion that exposes the native consult-history mismatch, and #198248 (f52d9254a99c) records these same remaining failures and their overlap with open #179237. A controlled parent probe using the exact pre-#198100test/setup.shared.tsmakes the cancel/transcript-first/rejection case pass; restoring the current setup restores the existing failure. The final test gate remains enabled.The pagination timeout was a newer main test regression introduced by #198775 (
ea4f8e02c973), which groups cold archive reads by sorting their identities. It reproduces at 120 seconds on CI's exact main parente3f1538c6e11; substituting only the pre-sort owner makes the same case pass. The fixture had held the alphabetically first store while awaiting progress from the second. This PR renames that held store to sort aftermain, preserving every assertion, timeout, and production read behavior. The complete 22-case file passes on both the PR branch and exact CI-parent source with the corrected fixture (formerly hanging case: 699 / 524 ms). Fresh Codex review is clean. The exact-parent replay also reproduces all four Talk assertions and passes all six archive cases, including the large case in 11.237 seconds.Run 43583302321 also timed out the unchanged large archive-reader test at 30 seconds. That same test passed in the previous Linux CI run in 5.709 seconds with identical session/state source, dependency lock, and Bun pin; local parent and candidate replays pass in roughly 3–4 seconds. No timeout, skip, or archive behavior was changed. A passing local replay is not a claim that the CI timeout was fixed; the final-head CI result remains the gate.
Final head
7130b866ab0b1b94ab80d8abd349242fcc9ab9cb: CI run 43586539993 completed with 88 successful jobs, 24 skipped jobs, and only the four native Talk cancellation assertions plus their aggregate gate failing. Both the repaired pagination shard and the archive-read shard passed;security-fastpassed. ClawSweeper reviewed this exact head with zero findings and zero open items.The Talk cases reproduce on the unmodified exact CI main parent
93fdc3d9ada2d1f34957aeacde112f74c594adfe(4 failed, 10 unselected, 66.17s). CI tested merge993e5800c9b55dcbac76bf664bb5acfa36d3afa5; test, support, and setup blobs are identical to the parent. The #198100 / #198248 attribution above applies. This scoped landing uses the native inherited-failure exception; it does not claim all CI is green. Main has separately retired the unused model normalization wrapper in #198768; that repair is preserved by the merge.