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 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b57a3a744
ℹ️ 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".
|
Codex review: needs maintainer review before merge. What this changesThis PR reclaims abandoned installation-scoped database snapshots and avoids unnecessary copies during ordinary status reads. Example: A snapshot creator is killed after copying 596 MiB.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR addresses concrete snapshot leaks and unnecessary status copies using existing owners; no introduced correctness defect was found, but failing CI checks remain unattributed. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherStatus and update inspection use the shared SQLite read infrastructure; Gateway maintenance sends abandoned snapshot directories through the existing native worker and token-protected retirement owner. flowchart TD
A[Status request] --> B[Shared state read owner]
B --> C[Native read connection]
D[Gateway maintenance] --> E[Installation snapshot namespace]
E --> F[Native cleanup worker]
F --> G[Token protected retirement]
Technical reviewBest possible solution: Keep the installation-scoped sweep in the existing maintenance worker and preserve explicit inspection custody and legacy-cache boundaries. Do we have a high-confidence way to reproduce the issue? Current-main source establishes both paths, and the supplied evidence reports parent-failing regressions and real interrupted-copy measurements; this review executed no target code. Is this the best way to solve the issue? The change uses the existing read, maintenance, worker, and retirement owners, with necessary namespace isolation and inspection custody rather than a competing cleanup system. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 003f1f6ed569. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +164, Tests +282, Docs +14, Other +570. Total +1030 across 31 files. Added test files: 2. View PR surface stats
LabelsLabel 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 Reviewed November 3, 2026, 6:47 PM ET / 23:47 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* fix: reclaim abandoned read-only database snapshots * fix: let snapshot reclamation progress past retained copies
* commit 'b4ebd3673fea4932296b92bbc07b7abc4bdc792d': fix(ci): allow serial SDK API reports to finish (#192196) fix(ci): run PostgreSQL checks when its shard planner changes (#191963) fix(ci): model native Linux updater asset entry improve(test): speed up config and device binding browser tests (#192404) improve(ui): show arrivals top right with a contextual session status (#192016) improve(ui): mark error toasts and split two-sentence copy (#192015) fix(sandbox): give dependency builders a writable home (#192390) fix(worktrees): keep archive manifest checks off the main thread (#192358) fix(cron): preserve admitted runs and pacing across unrelated MCP reloads (#192399) improve(ui): stack toasts in a center lane and an arrivals lane (#192014) fix: reclaim abandoned read-only database snapshots (#192368) improve(ui): rebuild the toast on one component with variants and a hover dismiss (#192013) docs: consolidate team server and team setup into one Multiplayer page fix(ci): reconcile remaining unallocated test lines feat: run admitted MCP tools on the worker node that hosts them (#191387)
The browser CI bundle fails its invalid-database and WAL-cookie import cleanup controls because they expect the entire cache root to disappear. Upstream c16858b intentionally introduced a retained per-installation SQLite namespace. The fixture now checks the correct cleanup boundary: exactly one recognized namespace remains, and it is empty. Extra root entries and leftover scratch files or directories still fail. Related: openclaw#192368 Validation: the original fixture reproduces both CI failures locally (2 failed, 24 passed). The repaired browser/identity/early-exit/system-profile group passes all 26 cases on pinned Bun in 12.80 seconds. No runtime SQLite behavior changes. Independent P0-P2 review reports no findings.
What Problem This Solves
Fixes: read-only database copies accumulate after a creator is killed, and plain
openclaw statuscan unnecessarily copy the entire state database when reading update history.User Impact
New abandoned snapshots are reclaimed by Gateway maintenance after a 15-minute grace period, without deleting copies held by live creators, nested workers, or inspection workers. Plain status reads avoid an unnecessary snapshot. Existing flat shared-cache snapshots remain explicit offline cleanup because their installation cannot be identified safely.
Why This Change Was Made
Stage new copies under a private namespace derived from the installation's state directory. The existing delayed startup/hourly maintenance owner runs a streaming scan with bounded memory and the native worker deadline through the existing native SQLite worker, using the existing lifetime-token retirement protocol. Inspection workers retain their own read token through result publication, so killing their launcher cannot expose a live snapshot to reclamation. Explicit artifact-preserving update diagnostics retain their existing behavior.
No new configuration, SQLite schema, survivor process, or cleanup IPC. Production growth is 164 lines for the deferred reclamation owner and complete lifetime coverage; removing the redundant status scope is a net deletion. Related: #191639, #191782.
Evidence
Focused regressions fail on exact parent
073498226768e62d6ee0232b4e196cb487fc56ccand pass on this change: unnecessary update-history snapshot; inspection-worker lifetime after launcher release; Gateway maintenance leaving an aged abandoned copy. Real native byte-copy SIGSTOP/SIGKILL proof covers abandoned journal files, live parent ownership, live nested ownership, and subsequent reclamation. Relevant read-only, update, cancellation, cleanup, and Gateway maintenance tests pass.pnpm build:ci-artifactspasses. Independent Codex autoreview: no actionable findings.Synthetic btrfs workload: 35.03 GiB database, 4,000 sessions, 62,000 workspace files / 1.10 GB. A/A controls and five interleaved A/B pairs: all unchanged-owner samples retain the abandoned copy; all reclamation samples remove it; live owners remain. Median copied bytes at kill: 596 MiB. Reclamation median/p95: 45.47/59.14 ms wall, 10.76/11.47 ms owner CPU, 364/446 KB sampled allocation. This measures a byte copy; it does not assert a production-matched fragmentation ratio.
Rerunnable workloads:
scripts/perf/sqlite-staging-reclamation-measure.mts,scripts/perf/sqlite-staging-maintenance-measure.mts, andscripts/perf/gateway-status-read-measure.mts. Acceptance: zero unnecessary status snapshots; dead copies reclaimed with live copies retained; five paired fresh-process measurements plus A/A controls; maintenance/rollback wall, CPU, allocation and tails must not materially regress (20% is a stop). Final status-owner results on a synthetic 12.03-GiB shared state database (five counterbalanced pairs):A/A wall controls were 44.78/26.51 s. Allocation includes the staging observer, so longer copies incur more observer allocation. Endpoint RSS increased 467→677 MB at substantially different process ages; peak RSS is the one-shot process maximum and improved. This measures the update-history owner, not every possible diagnostic read.
Quiet fresh-maintenance/rollback qualification (A/A controls and five counterbalanced pairs):
Median wall/CPU changes are at most +1.82%, below A/A variation (about 2–6%); allocations decrease slightly. Loads were 7.42–12.98. An earlier campaign overlapped builds/checks and regressed maintenance/rollback timing tails by 52.5%/73.5%; those raw results were retained and a serial repeat resolved the qualification gap. No speedup is claimed from baseline tail variation.
Commands:
node --import ./scripts/tsx.mjs scripts/perf/sqlite-staging-reclamation-measure.mts --root <synthetic-root>;node --import ./scripts/tsx.mjs scripts/perf/sqlite-staging-maintenance-measure.mts --base <parent> --candidate <candidate> --out <new-output>; andnode --import ./scripts/tsx.mjs scripts/perf/gateway-status-read-measure.mts --subject src/infra/update-run-reader.ts --export getUpdateRunHistoryStatusAsyncwith isolated synthetic state/cache environment.Hosted review found fixed-prefix scan starvation; the corrected streaming scan is covered by 257 reclaimable copies mixed with 256 missing-token directories. The regression fails before that correction and passes afterward. Initial CI also caught the omitted wrapper inventory entry and a proof byte-count race before SIGSTOP delivery; both are repaired, with the exact byte-count assertion retained. Focused wrapper, Gateway maintenance, and real SIGKILL tests pass.
pnpm check:changedexposes a main regression: four unused exports insrc/gateway/node-plugin-tool-snapshot.ts, reproduced on the exact parent and introduced bye0ac3370bbe37d73abc057bc8bd4dd32670c8e97(#191589). This PR does not modify that owner; the failure is retained for attribution rather than hidden with a baseline change.The exact parent also exceeds the test-line ceiling by 53 (6,443,949 versus 6,443,896). Commit
073498226768(#192297) added 65 lines with only 12 slack and no allocation. The exact-parent staged ratchet against its predecessor reproduces the failure. This is a second inherited main regression; this PR adds only its own 282-line justified allocation and does not alter the baseline.Final CI checks out merge
f185cb0d5e7f34143c148f1b2b40f3bb22e1e7a7of this head into main70f04d86b7c52c5948d50c0593745d9fdd99c8b5. That actual main parent has 47 lines of inherited budget debt: #192302 removed six lines from the original 53-line overrun.A newly introduced main type regression also appears in final CI:
f32ee258e30983f699abbe4fd3c4d3ad0114f563(#192302) movedMcpCatalogTooltoagent-bundle-mcp-catalog.types.tswithout updating the import inmcp-metadata.ts. The repository core typecheck on exact main parent70f04d86exits 2 with all five diagnostics identical to CI. The owner sources, configuration, package manifest and lockfile are identical between that parent and the tested merge. SDK declaration emission fails on the same missing type; the later missing-full-receipt publication error is downstream. This is a main regression requiring repair, not noise or a PR-caused failure. Final CI run 41739591548, attempt 1, completed with exactly nine inherited root failures plus the aggregate: the budget ratchet, seven typecheck jobs, and SDK declaration/publication. All selected test jobs, including PostgreSQL conformance, passed;security-fastpassed. Extension lint was selected but skipped because the failed SDK declaration job emitted no artifact, and its job condition requires that artifact. This downstream skip is included explicitly in the aggregate attribution. Native admission uses the explicitly authorized pinned-head inherited-failure route and retains failed CI rather than relabeling it green.