Skip to content

fix(update): prevent retained plugin stores from blocking activation - #174973

Merged
steipete merged 1 commit into
mainfrom
upd/upd-l1660
Oct 17, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-l1660

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes updates failing during activation when retained plugin databases are mistaken for agent databases, leaving the Gateway stopped.

Fixes #174913. Supersedes #174523, thanks @vishnusenthil-16.

User Impact

Updates can activate while default or configured plugin shared-state stores are retained, including when their plugin is disabled. Their data stays in the backup and rollback inventory. Actual agent databases still require the candidate agent schema, and the primary shared database still requires the shared-state schema.

Why This Change Was Made

The activation verifier treated almost every inventoried SQLite file as an agent database. It now consumes the inventory's existing agent ownership and registration facts instead of maintaining path-specific exclusions. Explicit agent-directory overrides and the held deleted-agent exemption remain covered. Core contains no plugin-id special case.

Release-note context: update activation now preserves retained plugin shared-state stores without comparing them to the agent schema; fixes #174913, with thanks to @vishnusenthil-16 for #174523. The contributor branch was read only; this implementation was written against main.

Production: +19/-5, net +14 lines. The necessary growth carries existing inventory facts and preserves unregistered environment-selected agent databases; the two special-case store exclusions are removed. Tests: +334/-237, net +97; test routing: +2; docs: +4. Existing schema cases moved into a separate file to keep test time bounded. No schema, dependency, or configuration changes.

Evidence

  • Confirmed on current main at src/cli/update-cli/update-command-migrated.ts:80–88; git log -S 'entry !== shared' traces the predicate to b37936459a68. The previous held-agent fix from fix(update): allow held deleted-agent databases to keep older schemas #172975 remains intact.
  • Negative control: all six default/configured/scoped plugin-store cases failed on the unfixed implementation with Agent database migration did not finish … expected schema 28, found 25. Coverage includes enabled and disabled plugins, plus both explicit agent-directory environment overrides.
  • Focused affected-import run: 118 tests passed across six files. After splitting the schema cases: 40 tests passed across two files. Final schema file: 109.815 s test time; finalization file: 63.039 s; longest test 11.845 s. The unchanged rollback sibling took 178.44 s in tests (longest case 11.11 s), with existing per-case native Doctor cost. Shared runtime build preparation took 173 s in the final split run and is separate from test time.
  • Core tsgo, the core-test-cli-update test-type graph, scoped core/script oxlint, six-file oxfmt, and git diff --check passed. Madge: 0 cycles. Full check:changed was not run: its SQLite inventory step was omitted under the lane's local gate budget; PR CI supplies the broad proof.
  • Fresh independent Codex review: no actionable P0–P2 findings.
  • Real local npm update: exit 0, status: ok, durable run status: succeeded, 380491 ms, from 2026.10.4 to the canonical same-schema fixture 2026.10.5-first-hop.0. Candidate Doctor, lint, config, plugin, recovery, and Gateway-startup checks passed. Both retained stores were explicitly snapshotted. Both remained at shared schema 26 (agent schema 28) with their sentinel rows and exact SHA-256 hashes unchanged. The replacement Gateway passed RPC health and /readyz, then was stopped cleanly; no proof Gateway remains running.
Live commands and environment limits

All commands used an isolated HOME, OPENCLAW_STATE_DIR, configuration path, profile, npm prefix, and temporary directory under this worktree's .artifacts/l1660/. The Gateway listened on the verified-free loopback port 57264. The artifact came from this patch, with the native package helper and canonical same-schema fixture helper; nothing was published to npm.

source .artifacts/l1660/live.env
node --import ./scripts/tsx.mjs scripts/write-plugin-sdk-entry-dts.ts
node scripts/ui.js build
env -u NPM_CONFIG_PREFIX node scripts/package-openclaw-for-docker.mjs \
  --skip-build --allow-unreleased-changelog --output-dir .artifacts/l1660/packages
node --import ./scripts/tsx.mjs scripts/e2e/lib/update-first-hop-package-fixtures.mjs \
  first-hop-tarball .artifacts/l1660/packages/openclaw-2026.10.4.tgz \
  .artifacts/l1660/packages/openclaw-2026.10.5-first-hop.0.tgz 0
npm install --global --prefix "$NPM_CONFIG_PREFIX" \
  "$PWD/.artifacts/l1660/packages/openclaw-2026.10.4.tgz" --no-audit --no-fund
npm rebuild --global --prefix "$NPM_CONFIG_PREFIX" \
  --allow-scripts=@google/genai,esbuild,protobufjs,openclaw
"$NPM_CONFIG_PREFIX/bin/openclaw" gateway run --port 57264
# In another owned process:
node "$NPM_CONFIG_PREFIX/lib/node_modules/openclaw/openclaw.mjs" update \
  --tag "$PWD/.artifacts/l1660/packages/openclaw-2026.10.5-first-hop.0.tgz" --yes --json
# Restart the owned foreground Gateway after package replacement:
node "$NPM_CONFIG_PREFIX/lib/node_modules/openclaw/openclaw.mjs" gateway run --port 57264
node "$NPM_CONFIG_PREFIX/lib/node_modules/openclaw/openclaw.mjs" gateway health --port 57264 --json
curl --fail http://127.0.0.1:57264/readyz
node .artifacts/l1660/verify-live.mjs

Native macOS service installation refused the isolated home by design, so this is a foreground live update, not a native-service restart proof. Native continuation is covered by the focused tests. The nested npm bin symlink initially selected the enclosing dirty checkout and stopped before installation; invoking the actual installed package entry point selected npm correctly. The first package check found missing SDK declarations/UI assets from the runtime-only test build; generating them made the full tarball integrity check pass. npm's lifecycle policy was satisfied by the explicit rebuild above.

The successful update recorded advisory warnings for the intentionally unavailable disabled plugin, isolated native service management, deferred inspections, the synthetic token fixture, and Darwin process inspection (unterminated Darwin environment, retaining the updater runtime). Those warnings did not turn the update into a failure. Raw logs are not attached because they include host paths and automatically generated diagnostic context.

@clawsweeper

clawsweeper Bot commented Oct 17, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes scripts Repository scripts size: L labels Oct 17, 2026
@steipete
steipete marked this pull request as ready for review October 17, 2026 02:07
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T02:33:06.041620Z e88f537 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The PR limits agent-schema verification to agent-owned databases while retaining plugin stores in backup and rollback checks.

Example: A disabled Voice Call plugin retains voice-calls/state/openclaw.sqlite at shared schema 26 while the candidate requires agent schema 28.

  • Before: Activation rejects the retained store as an incompletely migrated agent database.
  • After: Activation accepts the plugin store without changing its contents and continues checking actual agent databases.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused ownership repair with meaningful regressions and scoped live CLI evidence; CI attribution remains an operational gate rather than an established patch defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied installed-CLI npm update exercises the changed activation verifier with retained plugin stores, records successful durable completion and subsequent health/readiness, and reports unchanged store schemas, sentinels, and hashes; native-service restart is outside that run's claim.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A valid retained plugin database can make managed activation fail and leave the Gateway stopped.
Reason: The maintainer-authored direction restores the documented update contract through existing ownership facts, without adding configuration or changing persisted formats.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current managed-update failure using existing inventory ownership, with no introduced correctness defect found; required CI remains unresolved.

Priority: P1
Reviewed head: deb9ea60af8d9499347a6a7d1540e053e0f99718

Before merge

None.

Findings

None.

Agent review details

How this fits together

The managed updater combines candidate schema versions with database inventory facts to determine activation readiness and rollback compatibility.

flowchart TD
  A[Managed update] --> B[Candidate database inventory]
  B --> C[Agent ownership and registrations]
  B --> D[Database schema versions]
  C --> E[Activation verifier]
  D --> E
  E --> F[Finalization and rollback decision]
Loading

Technical review

Best possible solution:

Land the inventory-based classification repair while preserving active-agent validation, retained-store contents, and rollback inventory.

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

Current-main discovery includes retained plugin shared stores, and the activation predicate compares their versions against the agent schema; the linked report supplies a matching live failure, while this read-only review executed no target code.

Is this the best way to solve the issue?

Using inventory ownership fixes the shared classification boundary without plugin-specific exclusions or schema changes, while retaining registered, configured, environment-selected, and held-agent behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7807f20085de.

Provenance checked

  • Agent-schema activation predicate keeps the original intent (b379364: Prevent successful activation reports when actual agent migrations remain unfinished and the candidate Gateway cannot start.)
  • Held deleted-agent exemption keeps the original intent (a72e9a3: Doctor intentionally retains some deleted-agent stores at older schemas; activation must accept them while rollback verification still inventories them.)
  • Local credential and daemon-store exclusions keeps the original intent (feat: prepare local client credential storage and recovery #174294: Independently versioned local stores require exact capture and restoration without being treated as agent databases; daemon-store provenance is additionally recorded in the supplied evidence.)
  • Schema test placement and process routing keeps the original intent (d1a69c0: Exercise candidate validation and migrated finalization with prepared runtime prerequisites and isolated processes.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +14, Tests +98, Docs +4, Other +1. Total +117 across 6 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 19 5 +14
Tests 3 335 237 +98
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 6 359 242 +117

Review metrics

Metric Value Why it matters
Production versus tests Production +19/-5; tests +334/-237 Production growth carries existing ownership facts and preserves environment overrides; test growth adds classification regressions while moving existing schema coverage.

Labels

Label changes:

  • add P1: The source-supported update failure has left a real Gateway stopped until manual recovery.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: The source-supported update failure has left a real Gateway stopped until manual recovery.
  • 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.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 16, 2026, 10:22 PM ET / October 17, 2026, 02:22 UTC.

Use the existing state inventory's agent ownership and registrations to
limit agent schema checks to agent databases. Keep retained plugin stores
in snapshot and rollback verification without imposing the agent schema.
Preserve explicit agent-directory overrides and held deleted-agent stores.

Add enabled/disabled default and configured plugin-store regressions,
and keep the schema inspection cases in their own bounded test file.

Fixes #174913
Supersedes #174523, thanks @vishnusenthil-16.

Co-authored-by: vishnusenthil-16 <[email protected]>
@steipete
steipete merged commit 76752e0 into main Oct 17, 2026
147 of 155 checks passed
@steipete
steipete deleted the upd/upd-l1660 branch October 17, 2026 03:19
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…er activation (openclaw#174973)

Managed updates could fail after activation and leave the Gateway stopped because the post-activation verifier treated retained plugin shared-state stores (such as the Voice Call state database) as agent databases and required the agent schema. Verification now uses the inventory's existing ownership and registration facts to compare only real agent databases against the agent schema, keeping backup/rollback coverage and the held deleted-agent exemption. Live: an isolated managed update with retained plugin stores returned status ok, both stores stayed byte-identical, and the replacement Gateway passed health and readiness. Supersedes openclaw#174523, thanks @vishnusenthil-16.

Fixes openclaw#174913

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

Labels

cli CLI command changes docs Improvements or additions to documentation 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. scripts Repository scripts size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Retained Voice Call shared-state database blocks managed update activation

1 participant