Repository navigation
fix(backup): run the SQLite header probe as a declared worker entry - #183476
Conversation
Replace the separate Node eval helper from #148857 with a declared worker launched through the current runtime. Preserve process isolation for POSIX locks, batched header discovery, and fail-closed backup classification.
|
🦞👀 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. |
|
Codex review: needs changes before merge. What this changesRun SQLite header discovery through a declared worker using the current OpenClaw executable instead of a separately resolved Node executable. Example: Bun runs a verified backup containing notes.db on a machine without Node installed.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — verified: source commit Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this PR fixes a current backup runtime dependency, but the extracted worker introduces an assertion-safety check failure that needs a small repair. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherBackup inventory supplies candidate paths to an isolated child process, which returns SQLite-header classifications before snapshotting and archive publication. flowchart LR
A[Backup CLI or pre-update backup] --> B[Backup resource inventory]
B --> C[Header probe launcher]
D[Runtime process manifest] --> C
C --> E[Current runtime child]
E --> F[SQLite header classifications]
F --> G[Snapshot and archive publication]
Technical reviewBest possible solution: Keep the single manifest-owned, process-isolated probe and document its two assertion invariants without expanding the baseline. Do we have a high-confidence way to reproduce the issue? Current-main source explicitly requires a separate Node executable under Bun; the PR also records a red-to-green real-child regression, but this read-only review executed no target code. Is this the best way to solve the issue? The extraction is the smallest complete runtime repair: it reuses existing launch and packaging owners while preserving the original probe semantics and removing the superseded eval path. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1bb18fd0aa51. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +11, Tests +26. Total +37 across 5 files. Added test files: 0. 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 October 25, 2026, 5:32 AM ET / 09:32 UTC. |
The launcher moves from sqlite-files.ts (imported by snapshot/port worker cores) into sqlite-header-probe.ts, used only by backup discovery, so worker cores no longer reach the runtime-process entrypoints. The worker validates its input instead of asserting its type.
…penclaw#183476) 1579c37 (openclaw#148857) made backups probe file headers in a child that ran a PATH-resolved node with an -e eval string. Under Bun that lookup could fail (four update-cli tests failed on main under Bun), and standalone builds forbid eval helpers, so backups, including the pre-update backup, failed with 'Could not determine whether backup files are SQLite databases'. The probe is now a declared runtime-process worker launched by the current runtime, in its own launcher module so database worker cores stay free of runtime-process entrypoints. Child-process lock isolation, batching and fail-closed behavior are kept. Proof: the Bun regressions and SQLite backup tests pass on Node and Bun; live backups verified on both.
…183476) 513597f (#148857) made backups probe file headers in a child that ran a PATH-resolved node with an -e eval string. Under Bun that lookup could fail (four update-cli tests failed on main under Bun), and standalone builds forbid eval helpers, so backups, including the pre-update backup, failed with 'Could not determine whether backup files are SQLite databases'. The probe is now a declared runtime-process worker launched by the current runtime, in its own launcher module so database worker cores stay free of runtime-process entrypoints. Child-process lock isolation, batching and fail-closed behavior are kept. Proof: the Bun regressions and SQLite backup tests pass on Node and Bun; live backups verified on both. (cherry picked from commit bc22cdb) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit d875bf32b71d8843cce21c9d8b57cfb324aca1c3)
Related: #148857
What Problem This Solves
Fixes backup and pre-update backup failures when OpenClaw runs under Bun or standalone without a separate Node executable.
User Impact
SQLite discovery uses the running OpenClaw runtime, including for
.dband extensionless databases. No configuration or migration is required. Unreadable candidates still fail closed before archive publication.Why This Change Was Made
The probe introduced by #148857 resolved a separate Node executable and launched an eval string. Move the same probe into a declared runtime-process worker, launched with
process.execPathand the canonical runtime-worker helpers. The shared manifest supplies package, standalone, and Vitest entries.Keep child-process isolation: closing a raw descriptor in the parent can release another SQLite connection's POSIX locks. Batched input, header semantics, timeout, and complete-result validation remain intact. The old eval script and Node lookup are removed.
Evidence
-e.backup-create.sqlite-{alt-names,hardlinks,header-probe}.test.tsandbackup-sqlite-snapshot.performance.test.tspassed: 6 files, 45 tests passed, 4 platform-specific skips. All four reported update regressions passed. Vitest time 378.57 s; total 459.74 s, including 70.51 s of shared worker preparation. The single Windows-autostart reproduction also passed on this macOS base; the new launch-contract regression supplies red-to-green proof.HOME,OPENCLAW_STATE_DIR, andOPENCLAW_CONFIG_PATH;pnpm exec node openclaw.mjs backup create --output <isolated archive> --no-include-workspace --verify --json, then the same command through the pinned Bun executable. Both returned"verified": true, including the expected warning for an unmanaged SQLite.db. The source wrapper first encountered a build-lock timeout and runtime-artifact publication refusal, so the completed package launcher was used without rebuilding runtime artifacts or changing a Gateway.PATH:[true,false,false]for SQLite, plain, and missing files. Verified package, standalone, and Vitest manifest projections and built output. A standalone executable was not compiled.pnpm buildpassed in 9m25.8s. Core tsgo, infra-test tsgo, targeted oxlint, oxfmt, andgit diff --checkpassed; Madge found 0 cycles. Codex autoreview at P2 found no actionable findings. Fullcheck:changedwas omitted under the SQLite-inventory time budget; PR CI remains the broad gate.The broader Node failures were recorded without weaker assertions, longer timeouts, or retries to chase green:
ok, followed by the same unsupported delegated post-core warning and missing plugin event. The transport fixture explicitly rejects that capability check inupdate-command-transport.test-support.ts; this patch does not change that protocol or fixture.extensions/codex/isolated-completion.adapter.e2e.test.ts: synthetic app-server completion hit its 22 s deadline (runtime-unavailable). Attribution remains unresolved.extensions/onepassword/src/op-client.test.ts: 11 assertions returnedOP_NOT_FOUNDbecause the synthetic executable failed the trust check before token processing or the mocked process call. No real credentials were used.Build warnings remain in untouched UI modules: six
INEFFECTIVE_DYNAMIC_IMPORTwarnings (session-snapshot-invalidation, composer-draft-store.runtime, modal-dialog, sidebar-attention, app-sidebar-session-narration, chat-outbox-drain). The backup/runtime bundle emitted none. Advisory UI budgets reported startup JS gzip 273146 B vs 273120 B and total CSS raw 1595572 B vs 1595521 B; no baselines changed. The same memory-host mixed-import warning appeared in base and fixed Vitest worker preparation.Existing slow proof: the plugin database-worker group passed 36 files / 731 tests in 882.42 s; the Prometheus install E2E took 30.2 s while exercising a real plugin install and scoped HTTP access. The added header-worker test remains subsecond.
Production delta: +47/-36 lines (net +11). Tests: +28/-2 (net +26). One probe implementation remains; the new module contains the former eval body.