Skip to content

feat(database): family-scoped port, backup and update for mixed engines - #174387

Merged
steipete merged 8 commits into
mainfrom
pgprep/mixed-mode-pr2
Oct 17, 2026
Merged

steipete merged 8 commits into
mainfrom
pgprep/mixed-mode-pr2

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Current landing head

Head: 8b0b3719edaacbc831ff539f79e3cd90df9b0b4d. Mechanically rebased onto dfd396a9c23cc72d2fa43cd1606de7a003c05962 after main changed during merge admission. The only conflict was the generated database worker inventory; it was regenerated, not hand-merged. The final regeneration is clean (615 files / 2,311 calls). No source fix was added.

Current-head CI run 38983835171 passed: 103 successful jobs, 22 intentional skips. PostgreSQL conformance actually executed and passed 385 tests across 68 files; its test step completed at 2026-10-17 00:17:08 UTC. Required CI checks passed. The older runs below remain prior-head evidence.

What Problem This Solves

Implements the mixed-engine operations approved by Peter on 2026-10-16. A scoped port moves every physical store of one family, changes only that family's override, and removes a redundant override. Ambiguous unscoped ports require --family. PR3 (#174623) has now landed; scoped agent ports support both state/agent engine pairs without restoring the retired runtime refusal.

Backups use actual store engines and retain format-2 PostgreSQL envelopes beside SQLite images. Installations containing PostgreSQL remain offline for whole-installation backup. Restore verifies fresh namespaces and publishes the matching family selection before admission. Updates compose the existing protocol-1 family capability check with R14b public engine-aware admission; a global PostgreSQL declaration alone is insufficient. Recovery manifests remain version 1 with the legacy reader. No protocol/capability bump.

Semantic rebase

Head: 00a7e04806cbe653b2eed1e6117b863c2f079fe4. Rebased onto ff786f230f916cb4ebb143d6c1eacc9b947f0120 and reconciled the landed changes:

  • Database guide: keep scoped usage, Matrix resources, legacy migration guidance, and PR3’s admitted state/agent pairs and commit-authority contract.
  • Doctor engine inspection: one worker reports family observations and each retained Matrix/state root, without connection secrets.
  • Scoped port: R7c gates only pending migrations declared for the family moving from SQLite to PostgreSQL.
  • Status tests: retain existing status cases and add default/override/effective family assertions.
  • Doctor health flow: share the complete findings with interactive Doctor.
  • Backup discovery: keep explicit state roots, plugin inventory, agent registry, and workspace inputs; Matrix follows effective state selection.
  • Snapshot capture: retain verified-image classification and R10 fixed-local credential capture/sanitization, outside engine families.
  • Update inventory/admission: preserve R14b PostgreSQL generations and public admission; retained agents use their physical engine and captured connection.

Fresh Matrix roots without legacy dedupe rows need no migration receipt. The second rebase preserves main’s real legacy-dedupe refusal and Doctor repair; its shared gateway fixture preparation replaces this branch’s now-redundant helper. Version-only update inspection reads actual PostgreSQL metadata without requiring a version-specific backup descriptor; capture still requires its exact descriptor. Physical anchor and PostgreSQL metadata readers are separate so port registration stays independent of worker preparation and the SQLite reader does not import backup CLI orchestration. Port preflight prepares cold PostgreSQL plugin metadata through the existing read-only worker before migration checks and resource discovery in either direction; lifecycle cache invalidation cannot trigger a main-thread PostgreSQL read.

A final rebase also updates the PostgreSQL operator guide for scoped lifecycle operations and preserves PR3 runtime conformance; the scoped-agent regression now covers interrupted publication, resume, backup, and reverse port with SQLite state.

The follow-up CI repairs remove Doctor’s type-only import cycle and preserve coherent online WAL snapshots: versioned SQLite bypasses full-copy anchor inspection, while zero-version PostgreSQL anchors still receive physical classification. The existing concurrent-writer proof passes with one coherent native backup per store.

Evidence

Local PostgreSQL 17 uses a disposable UTF8 database with pgvector 0.8.7, pg_trgm, and unaccent. No local Docker.

  • Local full PostgreSQL conformance was attempted with the supported Bun route, Node 26, and CI's Node 24 major. It has not completed green locally: unchanged 120-second limits were exceeded under host loads around 80–86, and those runs were stopped after the timeout to avoid overlapping fixture/mocks contamination. The final fixture uses canonical SQLite initialization and suite-level arrangement/cleanup of the unrelated family. Every original migration and assertion remains; no timeout was increased. With that fixture, both state/Workboard round trips passed locally (74 seconds each), but the combined agent recovery/backup case still timed out. This remains an explicit local proof gap.
  • Production-source format, lint, core and infrastructure test types, config docs, regenerated worker inventory, and isolated full-diff plus operator-guide P0–P2 reviews passed before the final generated-only rebase. The fixture delta independently passed P0–P2 review, focused lint, and format. All six ratchets passed; worker calls were 197 → 197 and compatibility calls 10 → 10. Knip reports only the inherited findings below. Wrapper inventory/closure passed 4 checks with 18 intentionally filtered skips. Doctor/status/mixed-backup commands passed 28 tests.
  • On the preceding repaired head, the focused update suite passed 126 tests with four Windows-only skips; concurrent-WAL snapshot/discovery passed 2/2. Interrupted-publication/startup-block/resume/rollback and cold reverse-port regression passed 2/2.
  • The completed preceding full CI run passed all 100 executing jobs, with 22 intentional skips. PostgreSQL conformance actually ran and passed 385 tests across 68 files, including all five scoped-port/recovery cases, mixed backup/restore, Matrix roots, generation/admission, and pgvector cases. Pre-landing-rebase CI also passed: 103 successful jobs, 22 intentional skips, and all 385 PostgreSQL conformance tests across 68 files.
  • Required coverage includes both state/Workboard round trips with an unrelated PostgreSQL family, Matrix state roots, scoped migration refusals, interrupted publication and recovery, mixed backup and fresh-namespace restore, fixed-local credentials, offline custody with both state choices, incompatible-candidate refusal and compatible public admission, Doctor family reporting, homogeneous behavior, and SQLite artifact preservation.
Inherited static-analysis findings (untouched files)
  • extensions/codex/src/app-server/context-engine-history.ts: buildCodexSelectedHistoryItems
  • extensions/telegram/src/bot/helpers.ts: TelegramMediaKind
  • 65 duplicate-export groups in unchanged files: extensions/anthropic-vertex/provider-discovery.ts, extensions/browser/src/browser/cdp-reachability-policy.ts, extensions/codex/src/app-server/inference-upload.ts, extensions/discord/src/monitor/thread-bindings.persona.ts, extensions/elevenlabs/doctor-contract.ts, extensions/kimi-coding/onboard.ts, extensions/ollama/provider-discovery.ts, extensions/qwen/models.ts, extensions/qwen/provider-catalog.ts, extensions/signal/src/identity.ts, extensions/slack-huddles/cli-metadata.ts, extensions/teams-meetings/cli-metadata.ts, extensions/zoom-meetings/cli-metadata.ts, packages/gateway-client/src/timeouts.ts, packages/gateway-protocol/src/client-info.ts, packages/gateway-protocol/src/schema/devices.ts, packages/gateway-protocol/src/schema/progress-card.ts, packages/gateway-protocol/src/schema/projects.ts, packages/gateway-protocol/src/schema/session-discussion.ts, packages/gateway-protocol/src/schema/sessions-catalog.ts, packages/gateway-protocol/src/schema/sessions-sharing.ts, packages/gateway-protocol/src/schema/users.ts, packages/gateway-protocol/src/schema/worker-protocol-primitives.ts, packages/gateway-protocol/src/schema/worker-session-tools.ts, packages/llm-core/src/model-contracts/anthropic.ts, src/agents/agent-scope.ts, src/agents/auth-profiles/paths.ts, src/agents/mcp-lifecycle-lease.ts, src/agents/openai-routing.ts, src/auto-reply/reply/history.ts, src/channels/ids.ts, src/config/sessions/session-actor-durable.ts, src/infra/node-claude-skill-protocol.ts, src/interactive/payload.ts, src/logging/diagnostic-stability-query.ts, src/media/fetch.ts, src/routing/session-key.ts, src/security/channel-metadata.ts, src/skills/runtime/refresh.ts, src/state/openclaw-agent-schema-history.ts, src/utils.ts, src/wizard/i18n/index.ts.
  • Existing max-lines exceptions: ui/src/pages/chat/components/chat-message.test.tsx, ui/src/pages/config/config-page-state.ts, ui/src/pages/sessions/sessions-page-state.ts.

The coordinator reproduced each prior CI red 1/1 on main: history-reader import boundary and Doctor sandbox-warning timeout. An earlier run additionally exposed Doctor’s type-only import cycle and the online-WAL capture regression; both are fixed. The last rebase onto ff786f2 had only the generated worker-inventory conflict, resolved by regeneration rather than hand-merging. Pre-landing-rebase CI run 38980056703 completed successfully. The PR remains open and READY with auto-merge disabled. GitHub reported it mergeable immediately after the final push; its latest mergeability field is unknown. No merge was performed. The final format/config-doc checks passed, and the worker inventory regenerated cleanly at 615 files / 2,313 calls. The disposable local PostgreSQL server was stopped and its owned disk image removed; proof logs remain available.

Evidence Result
Prior head 2d2985e83268, CI run 38973255471 100 successful jobs; 22 intentional skips
Prior-head PostgreSQL CI 385 tests in 68 files passed; step actually executed
Pre-landing-rebase head 00a7e04806cb, CI run 38980056703 103 successful jobs; 22 intentional skips
Pre-landing-rebase PostgreSQL conformance 385 tests across 68 files passed; step executed 23:14:29–23:29:04 UTC
Local full PostgreSQL conformance Incomplete: timeout under high host load; both scoped state/Workboard round trips passed with final fixture

Size and follow-up

Production TypeScript: +724 net lines (1176 added, 452 removed), excluding tests, docs, generated output, and test routing. No memory-core source edits. PR3’s agent/state pair conformance has landed; this rebase removes the obsolete scoped agent divergence restriction. No new owner or protocol is introduced. This PR is approved for landing once the current-head required gates and executed PostgreSQL conformance pass.

Final file set (71 files)
  • docs/.generated/config-baseline.sha256
  • docs/cli/backup.md
  • docs/cli/index.md
  • docs/cli/update.md
  • docs/gateway/postgresql.md
  • docs/reference/database-engines.md
  • docs/reference/database-schemas/worker-access-inventory.md
  • scripts/pr-lib/wrapper-components.txt
  • scripts/test-database-conformance.mjs
  • src/cli/program/core-command-descriptors.ts
  • src/cli/program/register.database.ts
  • src/cli/update-cli/schema-preflight.ts
  • src/cli/update-cli/update-command-admit.test.ts
  • src/cli/update-cli/update-command-admit.ts
  • src/cli/update-cli/update-command-candidate-validation.ts
  • src/cli/update-cli/update-command-execution.ts
  • src/cli/update-cli/update-command-family-admission.test.ts
  • src/commands/backup-git.test.ts
  • src/commands/backup-git.ts
  • src/commands/backup-mixed-engines.test.ts
  • src/commands/backup-restore.test.ts
  • src/commands/backup-restore.ts
  • src/commands/backup-shared.ts
  • src/commands/backup-sqlite.test.ts
  • src/commands/backup-sqlite.ts
  • src/commands/doctor-database-engine-inspection.test.ts
  • src/commands/doctor-database-engine-inspection.ts
  • src/commands/doctor-database-engine.test.ts
  • src/commands/doctor-database-engine.ts
  • src/commands/doctor-database-port-context.ts
  • src/commands/doctor-database-port-migrations.test.ts
  • src/commands/doctor-database-port-migrations.ts
  • src/commands/doctor-database-port-state.ts
  • src/commands/doctor-database-port.test.ts
  • src/commands/doctor-database-port.ts
  • src/commands/status-all/format.ts
  • src/commands/status-json-payload.test.ts
  • src/commands/status-json-payload.ts
  • src/commands/status-overview-rows.test.ts
  • src/commands/status-overview-rows.ts
  • src/config/zod-schema.database.ts
  • src/flows/doctor-health-contributions-initial.ts
  • src/infra/backup-config-capture.ts
  • src/infra/backup-create.ts
  • src/infra/backup-database-discovery.ts
  • src/infra/database-engine/backup.test.ts
  • src/infra/database-engine/context.ts
  • src/infra/database-engine/matrix-roots.postgres.test.ts
  • src/infra/database-engine/physical-store.ts
  • src/infra/database-engine/port-command.mixed.integration.test.ts
  • src/infra/database-engine/port-command.worker.ts
  • src/infra/database-engine/port-descriptor.ts
  • src/infra/database-engine/port-provider.ts
  • src/infra/database-engine/postgres-store-metadata.ts
  • src/infra/database-engine/registry.test.ts
  • src/infra/database-engine/registry.ts
  • src/infra/database-engine/report.ts
  • src/infra/update-candidate-rehearsal.ts
  • src/infra/update-candidate-state.postgres.test.ts
  • src/infra/update-candidate-state.postgres.ts
  • src/infra/update-candidate-state.shared.ts
  • src/infra/update-candidate-state.ts
  • src/infra/update-database-backup.ts
  • src/infra/update-database-engine-admission.test.ts
  • src/infra/update-database-engine-admission.ts
  • src/infra/update-database-family-admission.test.ts
  • src/infra/update-recovery-baseline-capture.ts
  • src/snapshot/database-backup.ts
  • src/state/openclaw-agent-schema-inspection-worker.ts
  • src/state/openclaw-database-preflight-contexts.ts
  • test/vitest/vitest.database-worker-core-paths.mjs

@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 blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here.

Automatic review is on hold, including after source changes. Request a fresh re-review after resolving the failure; maintainers can also release the hold through an intentional scanner-policy update.

Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes commands Command implementations size: XL labels Oct 16, 2026
@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Oct 16, 2026
@steipete
steipete marked this pull request as ready for review October 16, 2026 16:23
@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-16T23:58:01.915880Z 8b0b371 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: 9b969d25c3

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

const plan =
preparedPlan ?? (await resolveBackupPlanFromDisk({ includeWorkspace, onlyConfig, nowMs }));
const selection = plan.databaseSelection;
if (!preparedPlan && !opts.dryRun && selection?.postgres && plan.databaseConfig) {

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 Require offline custody only for physical PostgreSQL stores

When a family is configured for PostgreSQL but has no store yet, resolveDatabaseEngineSelection() still populates selection.postgres, so this condition sends an otherwise SQLite-only archive through runOfflineDatabaseBackup() and refuses whenever the Gateway is running. This contradicts the documented physical-store behavior and unnecessarily prevents normal online backups for installations that preconfigure a future PostgreSQL family; base the custody decision on the discovered stores' physical engines instead.

AGENTS.md reference: AGENTS.md:L84-L84

Useful? React with 👍 / 👎.

Comment on lines +113 to +114
} catch {
result.stateInspectionFailed = true;

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 Preserve the actual family when engine discovery fails

If selection or provider discovery fails for a non-state family—for example, a PostgreSQL Workboard selection has an unavailable connection while shared state remains readable SQLite—this catch labels the failure as stateInspectionFailed and aborts all remaining family inspection. Doctor consequently reports “Shared state roots could not be inspected” instead of identifying the family whose discovery failed, while also losing other physical-engine diagnostics; record the failing family or use a separate general discovery failure rather than attributing every exception to shared state.

AGENTS.md reference: AGENTS.md:L81-L81

Useful? React with 👍 / 👎.

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label 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: 7d4f42bfb4

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

);
// Preserve the SQLite path: a PostgreSQL-capable target needs no source copies.
if (supportsPostgres && required.size === 0) {
if (supportsPostgres && required.size === 0 && !context.config.database?.families) {

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 Carry the context selection into family inspection

When an inspected managed-service context resolves database.postgres.connection from an environment that differs from the updater process, allowing its database.families map past this condition eventually calls readPostgresBackupFamily(pathname, context.config) without context.env or a prepared engine selection. That helper therefore resolves the connection from process.env, causing a valid PostgreSQL store to be reported as uncapturable and blocking an otherwise compatible update. Preserve each context's resolved selection through the physical-family inspection.

AGENTS.md reference: AGENTS.md:L74-L74

Useful? React with 👍 / 👎.

steipete added a commit that referenced this pull request Oct 16, 2026
PR #174399 intentionally requires pending SQLite migrations to finish
before port, including retained roots belonging to disabled plugins.
Its stated contract is: "The port preflight also inspects retained
migrations belonging to disabled plugins and names the plugin if repair
requires enabling it."

The Matrix fixture created three retained account/token roots without
the one-time inbound-dedupe scan receipt. Verify the real port refusal,
enable Matrix for the registered Doctor migration, confirm completion
and unchanged retained payloads, then restore the disabled configuration
before the existing port, backup, resume and rollback assertions.

Update/migration behavior is unchanged: operators complete Doctor repair
while the stores use SQLite, enabling a named disabled plugin for repair,
then port. No production guard, timeout or assertion is relaxed.

Validation: reproduced all three cases on main 7d636d9. Final
native PostgreSQL conformance run passed 27 tests across the Matrix port,
port-preflight, Matrix Doctor and account-state suites, maxWorkers=1
(309.84s; Matrix file 248.40s). Uses CI's pinned PostgreSQL 17.11/pgvector
image. Infra-test types, targeted lint, full architecture checks and
independent P2 review passed. No CI dispatch or rerun.

Related: #174387 includes the same prerequisite in its broader 65-file
mixed-engine feature; this narrow correction independently repairs main.
steipete added a commit that referenced this pull request Oct 16, 2026
The transcript-worker import reduction in #174414 intentionally changed
session path lookup to consume the published runtime snapshot. The standalone
shutdown fixture mocked the legacy IO getter but seeded sessions before
preparing the real snapshot.

Await the same async snapshot owner as Gateway startup before persistence;
keep all physical/logical cleanup and cancellation assertions unchanged.
Production already publishes before listeners and retires config after drains.

Proof: current main reproduced all three shutdown cases. The repaired four-file
focused run passed 75 cases, including those three. Targeted typecheck, lint,
format, and P2 review passed. Other cluster fixes are covered by #174387,
#174462, and landed f527f20; no competing edits are included.
steipete added a commit that referenced this pull request Oct 16, 2026
Prepare the canonical runtime-config snapshot inside the tools-invoke state
fixture before seeding sessions. Keep all HTTP, WebSocket, revocation and
result-publication assertions unchanged while preserving the narrow snapshot
reader introduced by #174414.

Extract the fixture-only repair from still-open #174387 after the CI repair
checkpoint. The shared fixture keeps the existing HTTP test from growing past
its line cap; both of its importers are covered by the focused proof.

Native focused proof (--maxWorkers=1): tools-invoke-http 40/40, 203.92s wall;
tools-invoke-authorization 23/23, 258.42s wall. Before: 4 and 5 failures.
P2 autoreview: no actionable findings. Targeted test types passed.
Typed lint and focused boundary guards passed for all three changed files.
Additional broad guards reported existing UI max-lines suppressions and
legacy delivery API references outside this repair's scope.
@steipete
steipete force-pushed the pgprep/mixed-mode-pr2 branch from 41db6f6 to 6a9720b Compare October 16, 2026 20:45
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 16, 2026
@steipete
steipete force-pushed the pgprep/mixed-mode-pr2 branch from 6a9720b to d9e1fd5 Compare October 16, 2026 20:57
@openclaw-barnacle openclaw-barnacle Bot removed the gateway Gateway runtime label 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

if (options.dryRun || facts.from === facts.to || !facts.stores.length) {

P2 Badge Apply the family selection when no stores exist

When a scoped family has no current physical store, such as Workboard before first use, !facts.stores.length returns a successful complete result before captureOriginals() and switchConfig() run. The family override therefore remains on facts.from, so its next store is still created with the old engine even though the command reports to: facts.to; either update the selection for this zero-store case or refuse instead of reporting success.

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

@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: c10467f748

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

message: `${family.label}: configured ${family.effective}, observed ${observed[family.id]!.join(" and ")}. Changing configuration does not migrate existing data.`,
fixHint: family.fixedLocal
? "Restore the local SQLite safety store from its verified backup."
: `Keep the Gateway stopped and use openclaw database port --family ${family.id} to migrate this family, or restore its matching engine selection.`,

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 Include the destination in Doctor's port command

When Doctor detects a configured-versus-physical mismatch for a non-state family, this fix hint emits openclaw database port --family <family> without a destination. The command's preAction in src/cli/program/register.database.ts rejects invocations lacking --to, --resume, or --rollback, so following the suggested repair always fails; append --to ${family.effective}.

AGENTS.md reference: AGENTS.md:L81-L81

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the pgprep/mixed-mode-pr2 branch from c10467f to 2d2985e Compare October 16, 2026 22:02
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label 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: 2d2985e832

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

@@ -52,7 +36,7 @@ export async function assertUpdateDatabaseEngineContexts(
.map((store) => store.id),
);
// Preserve the SQLite path: a PostgreSQL-capable target needs no source copies.
if (supportsPostgres && required.size === 0) {
if (supportsPostgres && required.size === 0 && !context.config.database?.families) {

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 Inspect retained stores before admitting family-map updates

When an installation has an explicit family map, a discoverable PostgreSQL plugin anchor, and a retained PostgreSQL agent known only through the shared-state registry, this newly enabled path misses the agent: agentRegistry: [] excludes it from the initial discovery, while the existing plugin anchor makes postgres.length !== 0 and suppresses readUpdateStateDatabaseInventory(). A candidate declaring support for only the plugin family can therefore pass admission and strand the retained agent after the update; merge the raw registry inventory whenever shared state exists, rather than only when the first scan finds no PostgreSQL files.

AGENTS.md reference: AGENTS.md:L82-L82

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: fe52878bbb

ℹ️ 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 thread docs/cli/index.md
Comment on lines +525 to +526
selections require a family. A scoped agent port cannot put agents on a different
engine from shared state until PR3 mixed-pair conformance. `--dry-run` checks

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 Remove the obsolete agent-port restriction

This warns operators that a scoped agent port cannot use a different engine from shared state, but the same change explicitly documents SQLite state with PostgreSQL agents as supporting scoped ports in docs/reference/database-engines.md:276, and port-command.mixed.integration.test.ts:140-177 exercises that exact round trip. An operator following this CLI reference may therefore avoid a supported migration or wait for nonexistent follow-up work; document the mixed-agent flow consistently.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the pgprep/mixed-mode-pr2 branch from fe52878 to 00a7e04 Compare October 16, 2026 23:11

@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: 00a7e04806

ℹ️ 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 +39 to 40
if (supportsPostgres && required.size === 0 && !context.config.database?.families) {
continue;

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 Inspect retained stores before taking the SQLite fast path

When the config has no database.families map and selects only SQLite, this returns before inspecting physical stores whenever the candidate advertises generic PostgreSQL support. A disabled plugin can still have a retained PostgreSQL anchor, and a candidate whose postgresFamilies omits that anchor's family will therefore be admitted even though the new family-capability check would reject it after discovery, potentially leaving the retained store unreadable after activation. Run physical discovery before this fast path, or restrict the shortcut to installations proven not to contain PostgreSQL anchors.

AGENTS.md reference: AGENTS.md:L81-L82

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the pgprep/mixed-mode-pr2 branch from 00a7e04 to 8b0b371 Compare October 16, 2026 23:54
@steipete
steipete merged commit 8a2935f into main Oct 17, 2026
198 of 200 checks passed
@steipete
steipete deleted the pgprep/mixed-mode-pr2 branch October 17, 2026 00:21
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
PR openclaw#174399 intentionally requires pending SQLite migrations to finish
before port, including retained roots belonging to disabled plugins.
Its stated contract is: "The port preflight also inspects retained
migrations belonging to disabled plugins and names the plugin if repair
requires enabling it."

The Matrix fixture created three retained account/token roots without
the one-time inbound-dedupe scan receipt. Verify the real port refusal,
enable Matrix for the registered Doctor migration, confirm completion
and unchanged retained payloads, then restore the disabled configuration
before the existing port, backup, resume and rollback assertions.

Update/migration behavior is unchanged: operators complete Doctor repair
while the stores use SQLite, enabling a named disabled plugin for repair,
then port. No production guard, timeout or assertion is relaxed.

Validation: reproduced all three cases on main b0c8a0b. Final
native PostgreSQL conformance run passed 27 tests across the Matrix port,
port-preflight, Matrix Doctor and account-state suites, maxWorkers=1
(309.84s; Matrix file 248.40s). Uses CI's pinned PostgreSQL 17.11/pgvector
image. Infra-test types, targeted lint, full architecture checks and
independent P2 review passed. No CI dispatch or rerun.

Related: openclaw#174387 includes the same prerequisite in its broader 65-file
mixed-engine feature; this narrow correction independently repairs main.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
The transcript-worker import reduction in openclaw#174414 intentionally changed
session path lookup to consume the published runtime snapshot. The standalone
shutdown fixture mocked the legacy IO getter but seeded sessions before
preparing the real snapshot.

Await the same async snapshot owner as Gateway startup before persistence;
keep all physical/logical cleanup and cancellation assertions unchanged.
Production already publishes before listeners and retires config after drains.

Proof: current main reproduced all three shutdown cases. The repaired four-file
focused run passed 75 cases, including those three. Targeted typecheck, lint,
format, and P2 review passed. Other cluster fixes are covered by openclaw#174387,
openclaw#174462, and landed a223499; no competing edits are included.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
Prepare the canonical runtime-config snapshot inside the tools-invoke state
fixture before seeding sessions. Keep all HTTP, WebSocket, revocation and
result-publication assertions unchanged while preserving the narrow snapshot
reader introduced by openclaw#174414.

Extract the fixture-only repair from still-open openclaw#174387 after the CI repair
checkpoint. The shared fixture keeps the existing HTTP test from growing past
its line cap; both of its importers are covered by the focused proof.

Native focused proof (--maxWorkers=1): tools-invoke-http 40/40, 203.92s wall;
tools-invoke-authorization 23/23, 258.42s wall. Before: 4 and 5 failures.
P2 autoreview: no actionable findings. Targeted test types passed.
Typed lint and focused boundary guards passed for all three changed files.
Additional broad guards reported existing UI max-lines suppressions and
legacy delivery API references outside this repair's scope.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…es (openclaw#174387)

* feat(database): support family-scoped mixed-engine operations

* fix(database): align mixed-engine CLI metadata and test contracts

Keep root help consistent with the registered database command, place physical observation types with their inspection owner, and preserve the concrete database fixture type for strict test checks.

* test(database): migrate Matrix fixtures before porting

* fix(database): reconcile mixed-engine operations with current admission

* fix(database): prepare cold PostgreSQL metadata before scoped port

* fix(database): preserve online snapshots and remove doctor import cycle

* fix(database): compose scoped lifecycle with mixed-agent admission

* test(database): arrange mixed port fixtures in suite hooks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:feature Preliminary submission classification; full source review pending. cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant