Skip to content

feat(database): shared-state port and backup on PostgreSQL - #173676

Merged
steipete merged 5 commits into
mainfrom
pgprep/r13-state-port
Oct 16, 2026
Merged

steipete merged 5 commits into
mainfrom
pgprep/r13-state-port

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Registers shared state with R12's existing database port and matched-backup provider. Existing state/openclaw.sqlite stores can move between SQLite and PostgreSQL through the same family owner used for backups and restores.

User Impact

Discovery covers the selected state root, retained Voice Call roots, and explicitly configured stores even when the plugin is disabled or removed. Matrix account/token roots remain excluded for R18. Exact captures retain secrets and transient rows; user backups use the existing sanitizer. Restores use normal owner admission, including PostgreSQL catalog drift checks. Older SQLite schemas must run Doctor with a compatible binary before porting. No canonical schema or schema-version change.

R14a (#173683) is integrated. The port holds exclusive offline maintenance custody throughout publication. It materializes initially absent shared state before capture, retires source actors before replacement, and selects the target for config publication effects after publishing stores. Recovery follows the physical shared anchor when config and files reflect an interrupted transition. Boot selection remains immutable; pooled readers scope selection to each request. PostgreSQL admission accepts an absent redundant content-version row when current schema metadata already declares the version, matching valid SQLite stores; mismatched metadata still refuses.

The config writer's own metadata and audit writes occur after capture. Recovery records their canonical state in a recovery receipt in the existing private manifest artifacts while custody remains held. Original captures stay unchanged, and later recovery verifies against the recorded state. Rollback verifies canonical contents even when a SQLite WAL write leaves the main-file hash unchanged. Failed manifest writes no longer consume an in-memory revision before publication, so the config-failure receipt can be recorded and resumed. The publication/drift helpers now live in one sibling module to keep the command within its line cap. Command recovery suites dispatch the real port handler in-process under native-section control, while retaining real backup, snapshot, proxy and foreign-owner workers; repeated isolate startup no longer dominates full shared-state captures. An abrupt process death between a config side effect and its durable receipt, or an I/O failure after manifest rename but before directory synchronization, can still require guarded manual recovery; immutable original captures are retained and unrecognized contents are refused.

Why This Change Was Made

The descriptor contains port-specific copy order, identity allocation policy and DDL offsets. It references the bundled PostgreSQL runtime DDL/catalog, canonical SQLite schema and feature-schema owners; fragment dependencies come from runtime facts. Loading remains lazy through the R12 registry, once per operation.

state-port.json shrank from 457,460 bytes / 14,386 lines to 26,959 bytes / 1,905 lines (94.1% smaller). It contains no inline SQL or duplicate column/constraint facts. The generator enforces a 60 KB ceiling. All 134 canonical tables and optional fragments remain covered, including absent Doctor-owned deletion history, keyless duplicate/null rows, UTF-8/blob bytes and allocator high-watermarks.

Evidence

  • PostgreSQL 17 state/admission/backup/custody: 19 passed, including 2 state cases, 12 admission cases, exact/user restore, and PostgreSQL backup/Git/updater recovery.
  • Updater, root discovery, import guard, provider and context checks: 52 passed. Local owner/read-worker unit tests: 10 passed.
  • Command recovery: the in-process real-handler run passed 31 of 33 cases, including both reverse/WAL recovery cases. It exposed an outdated initial-capture path expectation and a manifest revision bug; both are corrected. All four manifest-write failure cases pass after the correction. Final-head PostgreSQL CI passes all command cases, including both reverse/WAL cases and every injected recovery phase.
  • SQLite capture: all 10 sanitizer statements and four backup/export owner source hashes are identical before/after the rebase and repair.
  • pnpm db:postgres:gen and pnpm db:postgres:check: passed after rebase and again on final head, including generator tests; regeneration produced no changes.
  • Full core test typecheck, formatting, Knip, wrapper inventory and SQL/assertion/timeout ratchets passed. Final focused lint and infra test typecheck passed. Prior production and harness reviews were scoped-clean at P0–P2. The final delta review found only a staged copy of the already-corrected path expectation; the reviewed correction is included in the final commit. No actionable findings remain.

The local max-lines failure on untouched ui/src/pages/chat/components/chat-message.test.tsx is inherited: the same check fails on rebased main 415b542893a3c5606f471ac3d1ecd7ac35120881, and the source, baseline and guard are byte-identical. Knip passes on this rebased branch; the older loading-skeleton finding disappeared when its removal on main was integrated.

Doctor schema-migration end-to-end proof remains a follow-up. The Doctor migration backup/recovery runner and native repair entry still explicitly reject PostgreSQL; a truthful success proof needs production integration beyond a 40-line test. Data-only Doctor custody is covered here.

Related: #172677. Parallel append-only generator work in #173617 remains open; whichever lane lands second must integrate and regenerate, keeping both registrations.

The full change is +459 net handwritten production lines, +575 test lines, +1,924 generated lines, and +8 documentation lines against the rebased main. The descriptor removes duplicate schema ownership; the remaining production growth covers provider loading/discovery and custody across publication/recovery. Independent review identified the config-effect receipt and WAL-drift cases; both were fixed and covered through command recovery tests. CI also caught a missing SAFETY annotation on the already-explained private receipt cast; its comment was corrected.

CI

Final run 38860699217, head 9f08ba661af96288fe46ff87c3e77f10088d4d2e:

Check Result
PostgreSQL conformance Passed: 530 tests passed, 38 existing skips across the complete job; all 155 infra tests passed, including 2 state cases, 12 admission cases, both port directions, exact/user restore, and all 33 command/custody/recovery cases.
Baseline ratchets Passed, including assertion safety.
Other test/build checks Passed; the previous timer, chat-cleanup, ownership-race and transcript failures did not recur.
Changed compact large-2 Failed: agent.visitor-access.test.ts retains [email protected] in the remote access-policy email list. Inherited: latest scheduled main run 38856273519, job 116828581734, fails the identical case and assertion at agent.visitor-access.test-utils.ts:456, retaining the same expired email. The classifier missed it because the main job is named checks-node-compact-large-27.
Aggregate CI gate Failed because of the visitor test above.

The PostgreSQL, generator, updater, inventory and typecheck requirements are green. Overall CI remains red solely for the inherited Visitor failure; landing uses the operator-authorized native admin exception.

Causal path: the failing assertion follows Visitor plugin startup → VisitorAccessService.sweep() → Cloudflare policy update. It does not invoke the state-port descriptor, port commands, database backups, or updater inventory. Shared SQLite state-reader infrastructure is exercised, including R13-touched request-scoped engine selection; the identical current-main failure independently establishes baseline attribution. Main evidence: https://github.com/openclaw/openclaw/actions/runs/38856273519/job/116828581734. PR evidence: https://github.com/openclaw/openclaw/actions/runs/38860699217/job/116842627256.

Initial run 38855894511 on the preceding head failed PostgreSQL because repeated one-shot worker startup exceeded existing command test timeouts and polluted later fixtures. The real-handler test harness removes that startup cost without changing SQL or timeout budgets. The corrected run also proves recovery after a failed manifest publication without consuming an unpublished revision. Its separate assertion-safety annotation failure is fixed.

The inherited UI max-lines warning was reproduced on rebased main with identical source/baseline/guard files. Knip is green after integrating main's removal of the former loading-skeleton issue. Matrix roots remain R18; the Doctor PostgreSQL schema-migration end-to-end proof remains the follow-up described above.

@clawsweeper

clawsweeper Bot commented Oct 16, 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 scripts Repository scripts size: XL labels Oct 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR registers shared state for PostgreSQL port and backup operations through the existing database-family registry.

Example: Port a schema-24 shared-state database containing audit sequence 9007199254740993 to PostgreSQL.

  • Before: The port registry does not recognize shared state.
  • After: The new provider copies shared-state tables and preserves the audit sequence and allocator high-watermark.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Focused production-owner harness coverage supports the design, but the external-target recovery defect blocks merge and persisted-data compatibility remains unproven.
Proof confidence 🦐 gold shrimp (3/6) Maintainer authorship exempts ordinary contributor proof; reported PostgreSQL 17 results exercise the copy owner and destination admission, but mandatory persisted-data compatibility remains insufficient because recovery conformance is explicitly pending and no latest-stable upgrade run is supplied.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Existing shared-state installations cannot move their data to PostgreSQL through the registered offline port workflow.
Reason: The maintainer-authored direction extends the established database-family design; the documented pending reverse and restore work remains an explicit validation boundary.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this PR open: it adds useful maintainer-directed PostgreSQL support, but external-store discovery introduces a recovery defect.

Priority: P2
Reviewed head: a491787600b8627fea4d3d6c731faad823d07474

Before merge

  • Preserve recovery for configured external state stores (P1) - With OPENCLAW_STATE_DIR=/srv/openclaw and plugins.entries.voice-call.config.store=/srv/calls, this resolver adds /srv/calls/state/openclaw.sqlite to the port targets. If the operation is interrupted after recording its manifest, both --resume and --rollback reach loadRecovery in src/commands/doctor-database-port.ts, where line 622 rejects that original path because it is outside ctx.stateDir. The incomplete manifest then keeps Gateway startup blocked. Extend the existing recovery owner to validate and recover the recorded external target set, or refuse unsupported external targets before creating a recovery manifest.
  • Complete next step - Resolve the author's explicit draft hold before requesting landing.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P1] Preserve recovery for configured external state stores — src/infra/database-engine/state-port.ts:25-31

Tests

  • Missing end-to-end proof: Existing-installation compatibility still needs a latest-stable upgrade and shipped CLI port/recovery run, including reverse-port and exact/user backup restore with settings and data preserved.
Agent review details

How this fits together

The offline database owner discovers registered stores, captures originals, copies and verifies canonical rows, admits destinations, and publishes their files before switching configuration.

flowchart TD
  A[Database port CLI] --> B[Offline state owner]
  B --> C[Family provider registry]
  C --> D[Shared state descriptor]
  D --> E[Verified copy and admission]
  E --> F[SQLite or PostgreSQL destination]
  B --> G[Recovery manifest]
Loading

Technical review

Best possible solution:

Make the existing port owner recover every admitted target safely and complete shared-state recovery compatibility validation.

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

Source establishes the failure: configure Voice Call storage outside the selected state directory, interrupt a port after its manifest is recorded, and loadRecovery rejects either recovery action; no target code was executed.

Is this the best way to solve the issue?

Reusing the family registry and canonical copy owner is appropriate, but discovery must stay consistent with recovery target validation.

Full review comments:

  • [P1] Preserve recovery for configured external state stores — src/infra/database-engine/state-port.ts:25-31
    With OPENCLAW_STATE_DIR=/srv/openclaw and plugins.entries.voice-call.config.store=/srv/calls, this resolver adds /srv/calls/state/openclaw.sqlite to the port targets. If the operation is interrupted after recording its manifest, both --resume and --rollback reach loadRecovery in src/commands/doctor-database-port.ts, where line 622 rejects that original path because it is outside ctx.stateDir. The incomplete manifest then keeps Gateway startup blocked. Extend the existing recovery owner to validate and recover the recorded external target set, or refuse unsupported external targets before creating a recovery manifest.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4e90d155d8ab.

Provenance checked

  • Canonical-key requirement in the copy loop changes intended behavior with a stated reason (cd32ddc: The original verified port foundation used canonical keys for bounded ordered reads and exact row verification.)
  • Generated PostgreSQL DDL hash admission changes intended behavior with a stated reason (e3b8a28: Schema admission rejects incompatible definitions and seals exact catalog facts; the PR explains why equivalent fragment regrouping should undergo comparison and resealing.)
  • Family port and backup ownership keeps the original intent (d6f6f76: The registry was introduced to let additional families reuse one lazy descriptor, copy, backup, and recovery lifecycle.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/infra/database-engine/port-command.integration.test.ts --maxWorkers=1
  • pnpm test src/infra/database-engine/state-port.test.ts src/infra/update-candidate-state.inventory.test.ts --maxWorkers=1
  • git diff --check

What I checked:

  • Reviewed introduction: The pinned introduction adds the state provider, generated descriptors, keyless-row copying, destination admission, discovery, and focused tests; fetched main still lacks the state registration. (src/infra/database-engine/port-provider.ts:19, a491787600b8)
  • External targets cannot recover: Configured Voice Call paths are admitted to discovery, but loadRecovery rejects every original path outside ctx.stateDir. An interrupted operation involving such a store cannot resume or roll back, while its incomplete manifest blocks Gateway startup. (src/commands/doctor-database-port.ts:622, a491787600b8)
  • Recovery blocks startup: An incomplete database-port manifest refuses startup and directs the operator to the resume or rollback commands. (src/infra/database-port-recovery.ts:119, a491787600b8)
  • Compatibility coverage remains incomplete: The added PostgreSQL suite exercises forward materialization and normal destination admission, but explicitly leaves reverse-port and exact/user backup restore as a TODO; the body likewise records those paths as pending maintenance custody. (src/infra/database-engine/state-port.postgres.test.ts:142, a491787600b8)
  • Equivalent DDL retains drift checks: Changed DDL hashes now trigger the existing exact catalog comparison and resealing rather than immediate refusal; added tests cover equivalent text and a changed default. (src/infra/database-engine/postgres-schema.ts:161, a491787600b8)
  • Current draft and validation state: The reviewed head remains draft and mergeable. PostgreSQL conformance, build, published-driver update, and the aggregate CI gate are skipped, so they establish no validation result; cancelled auto-response jobs are unrelated automation outcomes. (a491787600b8)

Likely related people:

  • Peter Steinberger: Raw commit d6f6f76 adds src/infra/database-engine/port-provider.ts:16 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d6f6f76abbe0; files: src/infra/database-engine/port-provider.ts)

PR surface

Source +14526, Tests +281, Docs +10, Other +87. Total +14904 across 23 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 13 14557 31 +14526
Tests 8 284 3 +281
Docs 1 18 8 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 1 89 2 +87
Total 23 14948 44 +14904

Review metrics

Metric Value Why it matters
Handwritten production versus tests Production net +208 LOC; tests net +281 LOC The growth extends existing registry and admission owners, with meaningful data-preservation and schema-equivalence coverage.

Labels

Label changes:

  • add P2: This experimental database feature has limited adoption, but interrupted ports involving configured external stores lose their supported recovery path.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This experimental database feature has limited adoption, but interrupted ports involving configured external stores lose their supported recovery path.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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 15, 2026, 11:16 PM ET / October 16, 2026, 03:16 UTC.

@steipete
steipete marked this pull request as ready for review October 16, 2026 03:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 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-16T06:26:23.134313Z 9f08ba6 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c643ed5dee

ℹ️ 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".

Comment on lines +29 to +31
path.resolve(
store.trim().replace(/^~(?=$|[\\/])/, () => context.env.HOME?.trim() || os.homedir()),
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep external state roots recoverable

When plugins.entries.voice-call.config.store resolves outside stateDir, which this code explicitly supports, an interrupted port cannot be resumed or rolled back: loadRecovery() in src/commands/doctor-database-port.ts rejects every captured target whose original path does not start with stateDir, while the active manifest continues blocking startup. Either allow these recorded external targets during recovery validation or exclude them from the port operation.

AGENTS.md reference: AGENTS.md:L50-L53

Useful? React with 👍 / 👎.

Comment on lines +100 to +102
`openclaw database port` as the migration path. The port command handles
current-schema shared state, Workboard, Logbook, and Team Reports. Upgrade older
shared state with `openclaw doctor --fix` using a compatible binary before porting.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the port inventory consistently

This now says the command handles shared state, but the same “Port existing stores” section at lines 184–197 still says only Workboard, Logbook, and Team Reports are registered and that the command does not port shared state. That contradiction leaves operators unable to tell whether the newly documented workflow is supported; update the registry and inventory paragraphs with this behavior change.

AGENTS.md reference: AGENTS.md:L127-L129

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the pgprep/r13-state-port branch from c643ed5 to 5768aa0 Compare October 16, 2026 05:27
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes commands Command implementations labels Oct 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5768aa0cee

ℹ️ 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".

Comment on lines +222 to +224
try {
return await run();
} finally {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Make the post-config state receipt crash-recoverable

If the process terminates after writeConfigFile publishes the config and writes config.lastTouchedAt or audit rows into the newly published shared-state store, but before this finally records its receipt, recovery has only the pre-write staged verification. A subsequent --resume treats the target anchor as fresh and compares the live rows against that stale proof, so it refuses and leaves startup blocked; the receipt must be persisted at the point of effect or recovery must safely recognize and re-verify this committed target state.

AGENTS.md reference: AGENTS.md:L7-L7

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f08ba661a

ℹ️ 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".

Comment on lines +29 to +31
path.resolve(
store.trim().replace(/^~(?=$|[\\/])/, () => context.env.HOME?.trim() || os.homedir()),
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Canonicalize configured state roots before matching

When an external Voice Call store path contains a symlink, this records only its lexical absolute path, while discoverBackupDatabasePaths() canonicalizes every existing database with fs.realpath() before preflight() compares it against these roots. The configured store is therefore excluded: SQLite-to-PostgreSQL can complete the global config switch while leaving that store on SQLite, and an existing PostgreSQL anchor instead fails as “unclassified.” Canonicalize the configured roots before matching them to the discovered inventory.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 17e833b into main Oct 16, 2026
228 of 232 checks passed
@steipete
steipete deleted the pgprep/r13-state-port branch October 16, 2026 07:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

steipete added a commit that referenced this pull request Oct 16, 2026
R4 (#173462) installed each worker task's engine selection as immutable
process state. R13 (#173676) reuses those workers across offline database
port transitions, so reverse-port lease inspection failed with
OWNER_UNAVAILABLE before its handler could run.

Scope the incoming engine selection around task execution and serialized
resource cleanup. Preserve immutable Gateway boot selection and clear
absent task selections. Extend the existing prewarmed-worker regression
across SQLite, PostgreSQL, and return-to-boot selection in both transports.

Validation: PostgreSQL conformance fallback 526 passed; worker/context
checks 95 passed; core and affected test types, scoped lint, formatting,
and independent review passed. Testbox capacity queued; pgvector-dependent
coverage remains unverified on the Homebrew PostgreSQL 17 fallback.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…173676)

* feat(database): add shared-state port and backup provider

* refactor(database): reuse shared-state schema owners for port metadata

* fix(database): preserve state recovery identities and restore receipts

* fix(database): retain shared-state custody across port publication

* fix(database): preserve recovery revisions after failed publication
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
R4 (openclaw#173462) installed each worker task's engine selection as immutable
process state. R13 (openclaw#173676) reuses those workers across offline database
port transitions, so reverse-port lease inspection failed with
OWNER_UNAVAILABLE before its handler could run.

Scope the incoming engine selection around task execution and serialized
resource cleanup. Preserve immutable Gateway boot selection and clear
absent task selections. Extend the existing prewarmed-worker regression
across SQLite, PostgreSQL, and return-to-boot selection in both transports.

Validation: PostgreSQL conformance fallback 526 passed; worker/context
checks 95 passed; core and affected test types, scoped lint, formatting,
and independent review passed. Testbox capacity queued; pgvector-dependent
coverage remains unverified on the Homebrew PostgreSQL 17 fallback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant