Skip to content

fix(backup): create --verify fails for the open Windows agent database - #157301

Merged
roboclaw-bot merged 2 commits into
openclaw:mainfrom
ericcaiwx-star:fix/backup-windows-namespace-path
Sep 24, 2026
Merged

roboclaw-bot merged 2 commits into
openclaw:mainfrom
ericcaiwx-star:fix/backup-windows-namespace-path

Conversation

@ericcaiwx-star

@ericcaiwx-star ericcaiwx-star commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #157235

What Problem This Solves

Fixes: openclaw backup create --verify fails on Windows when the running Gateway has the main agent database open, because the archive contains a non-relative duplicate payload/posix/?/C:/... entry.

User Impact

User impact: scheduled and manual verified backups can complete on Windows again. The verifier still rejects non-relative archive paths.

Why This Change Was Made

A \\?\ or \\.\ spelling of the same drive or UNC path was encoded as a POSIX path containing a drive letter, and a second snapshot was emitted beside the normal windows/<drive>/... entry. Namespace aliases now use that drive or UNC archive name, and one physical database keeps one snapshot. Volume GUID paths are left unchanged.

Evidence

On Windows at main 4d69dd020015d514fd028ab913ac9ac12ed57b6e, encoding \\?\C:\Users\...\openclaw-agent.sqlite produced payload/posix/?/C:/... and exited 1.

At 65c4242b2c9a095463ebe2b919fcb974be46f87b the same command exits 0 with payload/windows/C/.... src/commands/backup-shared.namespace-path.test.ts passed (9). On native Windows, src/infra/backup-create.ownership.test.ts created a verified archive for a namespaced registry alias, restored it, and found one SQLite payload under payload/windows/.

Maintainer verification

At source head 65c4242b2c9a095463ebe2b919fcb974be46f87b, independent source review found no actionable P0–P2 findings. The contributor-reported native Windows proof above is retained; the following independent run was Linux, not a Windows rerun.

Single-worker measurements on secretless direct AWS (Node 24.19.0), using pnpm test <file> --maxWorkers=1:

Test file Result Command wall time Vitest duration
src/commands/backup-shared.namespace-path.test.ts 9 passed 33.81 s 30.50 s
src/infra/backup-create.ownership.test.ts 8 passed, Windows-only case skipped 30.10 s 27.05 s

The namespace run included cold compiler-cache preparation (22.371 s); its nine assertions each took 0–1 ms. The ownership run reused compiler output; existing integration cases took 0.275–2.158 s. Windows-specific case runtime is not measured by this Linux run. Focused run.

The original CI run failed only in the unrelated Codex startup-teardown fixture (shared-client-lifetime.test-support.ts:121). Upstream commit 619405d49ddd fixes that fixture by waiting for the real stream-close event instead of only advancing fake timers; the contributor refreshed the branch to head 3b3e9b7 at 14:36 UTC. That head contains the upstream fixture fix. All five backup files and the patch ID are identical to the reviewed source; the prior review and focused proof are reused, while fresh exact-head CI is required before merge.

Landing CI fixture repair

A second CI failure occurred in the existing Gateway sibling-abort test before its fanout assertions: a two-second mock-call poll expired after the asynchronous agent request was accepted. The follow-up changes only that fixture to await its existing execution-start signal, then retains the exact once-called assertion. No production behavior changes; no test timeout is increased, and cancellation assertions and cleanup contracts remain unchanged.

Validation on the exact backup source plus the one-line fixture repair, in secretless AWS with Node 24.19.0:

  • 20/20 standalone repetitions passed, three cases each, using pnpm test src/gateway/server.chat-abort-sibling-fanout.test.ts --maxWorkers=1. Command wall times: 25.12–65.55 s, including process/fixture setup and transforms.
  • 3/3 original packed CI-plan repetitions passed, preserving its selection and concurrency: 305 auto-reply tests plus 1,118 Gateway tests across 89 Gateway files per repetition. Total plan walls: 990.87, 998.58, and 970.27 s; Gateway Vitest durations: 935.00, 925.17, and 914.27 s.
  • Scoped formatting/lint and independent review of the full six-file candidate passed.
  • Focused repetitions and first plan; remaining plans and lint. The latter command completed with exit 0 in captured output, but broker terminal-receipt persistence timed out; this is not being used to bypass GitHub CI.

Limit: the baseline replay passed, so the original slow startup was not naturally reproduced on the larger AWS host. The original CI failure and source ordering establish that the assertion ran before its owned completion signal; this does not claim to diagnose a production performance defect. Fresh exact-head CI passed on the published follow-up: 120 successful jobs, 19 skipped, zero failures. Both required gate entries are successful. ClawSweeper revision 3 reviewed this exact head and found no actionable defects.

Published follow-up head: 473ec74; its tree matches the reviewed and tested candidate.

Made with Cursor

@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@ericcaiwx-star
ericcaiwx-star marked this pull request as ready for review September 24, 2026 13:31
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S labels Sep 24, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 1:04 PM ET / 17:04 UTC (Revision 3).

ClawSweeper review

What this changes

The branch maps Windows drive and network-share namespace aliases to portable backup paths, deduplicates agent database snapshots, adds backup regression coverage, and adjusts a Gateway abort-test fixture.

Merge readiness

✅ Ready for maintainer review

The reported Windows backup failure remains present on current main, and this PR addresses its source-level cause. The latest change adjusts a Gateway test fixture; the earlier review’s test-runtime request is addressed in the PR body. No actionable patch defect is established.

Priority: P1
Reviewed head: 473ec7408a17674a97b415d7427af7d1855c3b32

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused repair has relevant reported Windows runtime proof and meaningful regression coverage, with no established blocking defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body reports that the changed backup command succeeded on native Windows with a portable path, then verified and restored an archive containing one agent SQLite payload. The Linux focused run is supplemental and skipped the Windows case. Source review found no established break to previously valid archive data.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body reports that the changed backup command succeeded on native Windows with a portable path, then verified and restored an archive containing one agent SQLite payload. The Linux focused run is supplemental and skipped the Windows case. Source review found no established break to previously valid archive data.
Evidence reviewed 6 items Introduced backup repair: The pinned introduced diff normalizes drive and UNC namespace aliases during archive naming and database ownership lookup.
Current-main gap: Fetched main still resolves database paths without the proposed alias normalization, and its archive encoder replaces backslashes without stripping namespace prefixes.
Backup contract: The documented command verifies archives after creation, and restore consumes previously created archives.
Findings None None.
Security None None.

How this fits together

OpenClaw’s backup command discovers local files and databases, writes them into a portable archive, and optionally verifies that archive. Restore verifies the archive again before extracting it.

flowchart LR
  A[Backup command] --> B[Local files and database registry]
  B --> C[Path and ownership inventory]
  C --> D[SQLite snapshots]
  D --> E[Portable archive]
  E --> F[Archive verification]
  F --> G[Verified backup or restore]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +22, Tests +92. Total +114 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 27 5 +22
Tests 3 94 2 +92
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 121 7 +114

Review metrics

Metric Value Why it matters
Production and test LOC production +22 net, tests +92 net The production growth is focused on alias normalization and ownership; the larger test delta exercises archive naming and create/restore behavior.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #157235
Summary: The linked issue reports the same malformed duplicate Windows agent-database archive entry that this PR targets.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep one physical agent database snapshot under a portable archive name while preserving verification and restore of previously valid archives.

Do we have a high-confidence way to reproduce the issue?

Yes, from source and the reported Windows run: a namespace-prefixed drive path reaches the old archive encoder as a path containing ?/C:, and verification rejects the resulting entry. I did not execute the Windows command in this read-only review.

Is this the best way to solve the issue?

Yes. The patch changes the existing archive path and ownership owners, and its Windows create/restore evidence covers the intended user flow.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 54bec7738313.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The reported Windows failure prevents verified backups from completing for an active user workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body reports that the changed backup command succeeded on native Windows with a portable path, then verified and restored an archive containing one agent SQLite payload. The Linux focused run is supplemental and skipped the Windows case. Source review found no established break to previously valid archive data.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports that the changed backup command succeeded on native Windows with a portable path, then verified and restored an archive containing one agent SQLite payload. The Linux focused run is supplemental and skipped the Windows case. Source review found no established break to previously valid archive data.

Evidence

What I checked:

  • Introduced backup repair: The pinned introduced diff normalizes drive and UNC namespace aliases during archive naming and database ownership lookup. (src/infra/backup-archive-path-policy.ts:8, 473ec7408a17)
  • Current-main gap: Fetched main still resolves database paths without the proposed alias normalization, and its archive encoder replaces backslashes without stripping namespace prefixes. (src/commands/backup-resource-inventory.ts:336, 54bec7738313)
  • Backup contract: The documented command verifies archives after creation, and restore consumes previously created archives. Public docs: docs/cli/backup.md. (docs/cli/backup.md:45, 473ec7408a17)
  • Reported real behavior: The PR body reports a native Windows before/after command result and a verified create-and-restore run with one SQLite payload; its separate Linux run skipped the Windows-only case. This is contributor-reported runtime evidence, not a reviewer-run Windows test. (473ec7408a17)
  • Archive compatibility boundary: Verification uses recorded manifest paths and checks SQLite snapshot coverage. The parser already rejects namespace-prefixed SQLite source paths in older manifests, while the changed encoder leaves ordinary source paths unchanged; no concrete valid older archive broken by this diff was established. (src/commands/backup-verify-manifest.ts:252, 473ec7408a17)
  • Feature history: Recent merged backup ownership and verification work identifies routing candidates; the available history does not prove introduction of any exact current source line. (src/commands/backup-resource-inventory.ts, 54bec7738313)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-24T13:38:36.672Z sha 65c4242b2c9a095463ebe2b919fcb974be46f87b :: needs changes before merge. :: [P3] Report the measured runtime of the changed tests
  • reviewed 2026-09-24T14:45:22.120Z sha 3b3e9b7 :: needs maintainer review before merge. :: none

@roboclaw-bot roboclaw-bot self-assigned this Sep 24, 2026
…ows namespace path

A \\?\ or \\.\ spelling of the live agent database was archived beside the drive path as posix/?/C:, and create --verify rejected its own archive. Those aliases now share one drive or UNC entry.

Co-authored-by: Cursor <[email protected]>
@ericcaiwx-star
ericcaiwx-star force-pushed the fix/backup-windows-namespace-path branch from 65c4242 to 3b3e9b7 Compare September 24, 2026 14:36
@roboclaw-bot
roboclaw-bot enabled auto-merge (squash) September 24, 2026 14:39
The abort fanout fixture acknowledges asynchronous agent admission before execution. Await its existing parentStarted signal rather than polling the mock call count with an unrelated two-second deadline, then retain the exact once-called assertion. Cancellation, sibling accounting, and cleanup assertions are unchanged.

Co-authored-by: Tak Hoffman <[email protected]>
Co-authored-by: Takhoffman <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Sep 24, 2026
@roboclaw-bot
roboclaw-bot merged commit 1370643 into openclaw:main Sep 24, 2026
206 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Merged via squash.

@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
openclaw#157301)

Normalize Windows namespace drive and UNC aliases before archive naming and SQLite ownership resolution so verified backups keep one portable snapshot per physical database without relaxing archive-path validation. Synchronize the Gateway abort fixture with its existing execution-start signal rather than an unrelated two-second poll.

Closes openclaw#157235

Co-authored-by: ericcaiwx-star <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
Co-authored-by: Takhoffman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

2 participants