Repository navigation
fix(backup): preserve configured agent state roots - #129773
Conversation
Inventory configured agent directories as durable backup owners regardless of layout. Reuse the owner inventory for archive planning, SQLite snapshotting, verification, restore safety, and Git/SQLite backup selection. Add manifest-first plugin backup resource declarations so regenerable runtime roots stay plugin-owned without provider IDs in core. Closes #129730
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 11:47 PM ET / August 26, 2026, 03:47 UTC. ClawSweeper reviewWhat this changesThe PR inventories configured agent directories as durable backup roots and adds active-plugin manifest metadata for durable or regenerable backup resources. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open for maintainer review. The shared inventory appears to address the configured-agent backup omission across archive and SQLite paths, but the new Codex-specific regenerable exclusions lack the required direct upstream Codex source proof. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherBackup planning turns configuration and active plugin metadata into archive assets, SQLite snapshots, Git snapshots, verification rules, and restore containment checks. Configured agent roots feed this inventory so their session and credential database is handled as agent-owned state even outside the default state directory. flowchart LR
Config[Agent configuration] --> Inventory[Backup ownership inventory]
Plugins[Active plugin manifests] --> Inventory
Inventory --> Archive[Archive planner]
Inventory --> Snapshot[SQLite and Git snapshots]
Inventory --> Verify[Archive verification]
Inventory --> Restore[Restore containment]
Archive --> Backup[Verified backup]
Snapshot --> Backup
Decision needed
Why: The repository policy requires direct sibling Codex inspection for this dependency-backed claim, and the current checkout cannot establish that contract. Before merge
Agent review detailsSecurityNone. PR surfaceSource +579, Tests +1038, Docs +124, Other -2. Total +1739 across 32 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the generic inventory, but merge the Codex exclusions only after direct upstream source evidence confirms each declared path is recreatable and contains no durable state. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: configure an external Is this the best way to solve the issue? Unclear: one shared ownership inventory is the maintainable core repair, but the Codex-specific exclusions need direct upstream lifecycle proof before they are the best safe solution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 345cfde43dc9. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
|
Land-ready proof for exact head
The first build-artifacts attempt exceeded the saturated Control UI startup gzip baseline by 3 bytes, matching the known nondeterminism tracked in #121497; the unchanged exact-head rerun passed. No product proof gaps remain for this deterministic CLI/storage repair. |
|
Direct upstream Codex ownership proof for the three
These are generated/session-temporary owner roots, not durable Codex threads, config, authentication, or operator state. The manifest exclusions are therefore retained as declared. |
|
Merged via squash.
|
* fix(backup): honor configured agent state roots Inventory configured agent directories as durable backup owners regardless of layout. Reuse the owner inventory for archive planning, SQLite snapshotting, verification, restore safety, and Git/SQLite backup selection. Add manifest-first plugin backup resource declarations so regenerable runtime roots stay plugin-owned without provider IDs in core. Closes openclaw#129730 * fix(backup): preserve canonical ownership checks
* origin/main: (24 commits) fix(gateway): reject rootless session permission modes (#128149) docs(memory): document shipped turn-taint propagation for network tool output (#129837) fix(ui): pool reply-less wake activity into one chat rollup (#128442) fix(package): prevent installs from deleting validated runtime assets (#129724) fix(nodes): approve silent initial node surfaces and name the pending surface approval (#129795) fix(backup): preserve configured agent state roots (#129773) fix(ui): own chat history issuance with a closed state machine (#129776) fix(cron): preserve cancellation reason after late finalization (#129331) fix(cron): prevent run waits from failing after clock changes (#129805) fix(telegram): route commentary through one frozen progress owner (#128259) fix(release): start approved VCR mirror recovery jobs (#129829) test: complete current-plugin-metadata-snapshot mock factories (#129791) test(telegram): remove duplicate reaction case (#129848) fix(channels): honor supported account reply-threading policies (#129679) refactor(cli): deduplicate lazy subcommand registration (#129351) fix(ai): report interrupted local-model streams instead of empty success (#129794) refactor(cli): consolidate Gateway fallback and hook ownership (#129802) fix(qa): reject token confidence lanes without executed evidence (#129830) fix(tui): fence session state and delayed actions (#129810) fix(control-ui): keep task progress full width on hover (#129832) ...
Closes #129730
What Problem This Solves
Fixes an issue where operators using
agents.entries.*.agentDiroutside the default state layout could create a backup that silently omitted durable agent state. A custom agent database covered incidentally by another source could also miss the normal agent-owned SQLite snapshot guarantees.Why This Change Was Made
Backup planning now builds one configuration-derived ownership inventory for state, configured agent roots, and manifest-declared plugin resources. Archive creation, dry-run output, SQLite discovery and compaction, verification, restore containment, and Git/SQLite backup selection reuse that inventory instead of reconstructing the default agent layout.
Plugins can declare state- or agent-relative durable and regenerable roots through manifest metadata. The Codex plugin uses that generic contract for upstream-owned temporary roots; core contains no plugin IDs or provider-specific backup policy.
The archive stays schema version 1 and keeps its existing payload encoding. Additive
paths.agentRootsmetadata lets verification preserve exact custom-agent ownership while older archives remain supported.AI-assisted implementation; maintainer reviewed the architecture, tests, generated diff, and final behavior.
User Impact
Operators can rely on full backups when agent state is configured outside
<stateDir>/agents/<id>/agent. Custom agent databases retain committed WAL data, exclude sidecars and deleted-page remnants, validate the exact agent owner, and restore through the same verified archive flow as default-layout agents.Regenerable plugin/runtime trees are excluded by their owner declarations without allowing an exclusion to remove canonical state or agent databases. Custom directories named
tmpor.tmpremain durable unless an active owner explicitly declares them regenerable.Evidence
openclaw backup create --dry-run --json --no-include-workspacelisted only the state asset while a configured externalagentDirwith durable data existed.node scripts/check-changed.mjs -- <touched paths>passed all selected formatting, typecheck, lint, architecture, metadata, and guard lanes.pnpm check:docspassed.pnpm buildpassed. The only ineffective-dynamic-import warnings were the pre-existing Control UI warnings forviewer-facepile.tsandlobster-pet.ts.pnpm plugin-sdk:surface:checkpassed.src/infra/backup-create.tsshrank by roughly 440 lines as duplicate filtering and SQLite policy moved to coherent owners.