Skip to content

feat(templates): open durable chat before verified setup - #196392

Merged
Patrick-Erichsen merged 16 commits into
mainfrom
template-chat-first-backend
Nov 10, 2026
Merged

Patrick-Erichsen merged 16 commits into
mainfrom
template-chat-first-backend

Conversation

@Patrick-Erichsen

@Patrick-Erichsen Patrick-Erichsen commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Template Add waits for remote setup before creating the ordinary agent and conversation. Users have no durable place to draft or recover, and later failure can encourage duplicate Add.

User Impact

Admit the ordinary agent and canonical chat first. Model work stays blocked until verified instructions and active runtime are ready. Failures retain that exact agent/chat for explicit retry. Source, incarnation, reviewed plan, consent and final requester authority remain binding. The opening is a personality-loaded model turn, not canned assistant text or a synthetic user message.

This reuses agent/session/workspace owners and the installer, not a parallel lifecycle ledger. Ordinary agents.create preserves its immediate greeting. Pending Template chats, secondary sessions and offline CLI cannot run prematurely. Nullable bootstrap deferral is installed by the existing workspace-state writer, preserving historical read-only opening and completed workspace attestation semantics.

Dependent UI: #196395. Landing is authorized backend first, then UI after review/CI qualification. Manual deployment/release is excluded. Related catalog entry point: #193117.

Evidence

Interrupted initialization: before and after

Before: interrupt the configured-session checkpoint after instruction/config effects, reopen state and issue a fresh apply; the retained initialization remains blocked.

After: the canonical pending session records verified initialization intent before effects. Fresh retry reconciles only intended config and exact instruction bytes, preserves the original workspace incarnation, and resumes the same session with two total config writes and one eventual greeting. Unrelated user edits refuse retry without being overwritten. Intent-write refusal and partial instruction interruption are also covered.

  • Recovery request-owner/stateless/pending batch: 58 passed in three files; five changed cases passed again after checkpoint-adapter extraction. Real persistent session/config/runtime owners; synthetic registry/model I/O, not a full product journey.
  • Structured runtime diagnostics now use string-or-JSON formatting instead of implicit object stringification. All 28 Template handler tests passed. Removed the redundant CLI mock-wiring case and exactly 43 allocation lines; three retained silent/error/lost-authority tests passed.
  • Main conflict reconciliation at 349167a incorporates pinned main 3c49dfc. Retains reviewed diagnostics while accepting main's Template provenance/rollback-owner changes; removes one newly unused test import. The two affected handler/stateless suites passed, both Gateway-methods and Templates type graphs passed, and five-file type-aware lint, formatting and diff checks passed.
  • Backend-only exact-base ratchet after integration: 6,638,990 LF lines / 6,639,003 ceiling / 13 slack. Combined UI integration: 6,639,890 / 6,639,891 / 1 slack. Admission allocation 2,585, bootstrap 85 and UI 888 remain unchanged; shared scalar unchanged. Redundant overlapping plan assertions were consolidated, not replaced with larger budgets.

Earlier migration/instruction/runtime evidence remains applicable. Historical migration checks passed four resource-receipt and eight cutover cases. An earlier workspace/bootstrap batch had 111 passed/1 failed under ambient profile work; its selected profile-unset replay passed without relabeling that original batch green.

The isolated real-Gateway greeting/authority fixture passed in CI (18.897s, job 129645083790) despite a failing clone-identity sibling. Existing UI screenshots/performance proof are retained, not rerun. Full real-Gateway multi-chat recovery remains unproved. No live Add/provider, Gateway restart, provisioning, installation or new performance claim.

Populated latest-stable upgrade

Offline released-schema/state upgrade, not a packaged Gateway journey. Stable 2026.11.3 tag commit 847611d; released shared SQL SHA-256 157b5c0f476812b414d6f324b6527e4fb4faf6ccec221414a7056293704bfc7a and agent SQL 227fcd299f5dfd3012abd0f110cd028ba6add9155bc74e2e558aadeae2761349.

Synthetic populated shared schema 22 / agent schema 27 contained an existing session/window, completed setup, attestation and SOUL.md. Real backed-up Doctor maintenance migrated agent schema to 41; direct old-schema opening refused first. Protected setup/attestation rows, session entry and workspace bytes compared equal—not a bytewise session-window table comparison. Public reads preserved session ID/display name, setup timestamps and attested hash, without initializationPending/bootstrap deferral. bootstrap_deferred was SQL NULL; shared foreign-key checks were empty. SOUL.md SHA-256 remained 06723ca483c00a05a8ea2aa3012d74a41cc3409749199c7be107d65a3d7ce535. Receipt originated at fa5ef8e79e6 with file-identical backend propagation.

Landing qualification

Backend head: 349167a661922394506aa7e20ea10cd5d0beb98c. Native exact-head review artifacts and GitHub-pending preparation are complete. Integration of conflicting main changes preserved the existing package provenance/rollback owners and structured diagnostics. The affected handler/stateless suites passed 60 tests; both affected test-type graphs, scoped lint, format and the line budget passed.

Current CI run 42902917377, attempt 1, tests merge 47097b5a15b0962bc9bf9cc704e48c439e2ebcfc (main parent a4ed3ed32733bfe5f8bc4584481259feb757a44f, PR parent above). It remains in progress. The failed test leaves have inherited-failure evidence:

  • Fallback thinking off/adaptive: PR job 130134424613 matches the exact scheduled-main annotation in run 42895156317, job 130106894454.
  • Visible-worktree-spawn missing failed status: 130134425227 matches main 130106894508.
  • sessions.fork participation error code: 130134425252 matches main 130106894597.
  • Clone-identity allowed-path assertion: 130134424867 matches the retained paired baseline reproduction at main 9ccdad09a9dfb6a68d32aae18a1014b753ba1704; the failing test and identity/clone/Git transport owners are unchanged in the tested merge. The exact underlying authorization-negotiation cause remains unclaimed.

The first three titles/messages compare byte-for-byte equal with scheduled main. Their failure tests and scoped model/spawn/fork authorization owners are also unchanged in the CI merge. The clone baseline is an ancestor of the captured main parent. Historical failure and attribution logs are retained for the repository's native inherited-failure route; failed CI is not called green. Every eventual failed job, final security clearance, review requirements and live execution capability must still qualify before merging.

ClawSweeper is review-only; its completed prior review found no correctness/security defect. The requested review of this integrated head is being reconciled. The UI dependency is being repaired separately and will land after this backend. Existing screenshots and scoped behavioral/upgrade evidence remain in the sections above; no live Gateway or manual deployment changes are part of this task.

@clawsweeper

clawsweeper Bot commented Nov 10, 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 gateway Gateway runtime cli CLI command changes commands Command implementations agents Agent runtime and tooling size: XL labels Nov 10, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

@clawsweeper autofix

@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

@clawsweeper autofix is retired; ClawSweeper now only reviews.

@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR creates a durable Template agent and chat before remote setup, then enables conversation after verified instructions and runtime activation.

Example: Adding a Template as agent scout encounters a registry download failure.

  • Before: Setup runs before the ordinary agent and conversation become available.
  • After: The pending scout agent and canonical chat remain available for retry without creating another copy.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful owner-approved implementation with no new actionable finding; proof remains strongest at the production-owner harness boundary.
Proof confidence 🦐 gold shrimp (3/6) ✨ media proof bonus Sufficient (linked_artifact): For this maintainer-authored PR, the reported real-Gateway RPC fixture and production-owner harnesses cover greeting, permitted installation, read-only denial and revoked-device rejection before plugin publication; retained setup recovery is exercised with real persistence owners rather than a complete Gateway journey.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Users waiting on Template setup lack a durable conversation for drafting and recovery, and failure can encourage duplicate Add attempts.
Reason: Direction is already owner-approved, and the backend provides a coherent admission boundary for the separately reviewed UI.

Merge readiness

✅ Ready for maintainer review

Keep open: this owner-approved backend change remains necessary, and no new actionable correctness or security defect was found. Exact-head CI qualification remains incomplete.

Priority: P2
Reviewed head: 349167a661922394506aa7e20ea10cd5d0beb98c

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A full running-Gateway retained-failure, reopen and same-session retry journey with the visible greeting remains unshown; the discussion explicitly records this limitation.
Agent review details

How this fits together

Template Add accepts a package coordinate and reviewed consent, coordinates existing agent, session, workspace, plugin and scheduler owners, and returns installation results with a durable conversation.

flowchart TD
  A[Template Add request] --> B[Ordinary agent and pending chat]
  B --> C[Verify source and instructions]
  C --> D[Confirm active runtime]
  D --> E[Enable chat and greeting]
  E --> F[Install shared requirements and routines]
  C --> G[Retain same agent for retry]
Loading

Technical review

Best possible solution:

Land the backend through its existing agent, session, workspace and installer owners after CI qualification, then qualify the dependent UI.

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

Current-main source confirms that shared requirements precede agent publication; this read-only review performed no runtime reproduction.

Is this the best way to solve the issue?

The implementation uses existing durable owners and replaces the old staging path; its recovery checkpoints address real interruptions without introducing a parallel lifecycle ledger.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Template Add ordering and rollback changes intended behavior with a stated reason (81662c5: Create ordinary agents and resources without an installed-Template lifecycle, then hand off to chat.)
  • Ordinary agent onboarding keeps the original intent (413d2fc: Save an immediate greeting and continue onboarding in the ordinary conversation.)
  • Bootstrap rollback preservation keeps the original intent (05b88c6: Clear only an eligible rolled-back seed while preserving completed setup and workspace attestation.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

PR surface statistics unavailable: the file list is incomplete.

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Public reply option 1 optional SDK-visible field GetReplyOptions gains deferWorkspaceBootstrap; existing callers retain their default behavior.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This improves Template setup and recovery within a limited feature surface.
  • merge-risk: 🚨 compatibility: The optional deferWorkspaceBootstrap field reaches the exported GetReplyOptions contract; existing call shapes remain compatible.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Optionally demonstrate retained setup failure and same-session retry through a running Gateway, including reopen and the visible greeting.

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.

History

Review history (5 earlier review cycles)
  • reviewed 2026-11-10T02:45:13.748Z sha 6e1762f :: needs real behavior proof before merge. :: [P1] Provide recovery for retained initialization failures | [P1] Preserve bootstrap custody during normal early chat turns | [P2] Gate other sessions of an admitted but uninitialized agent | [P2] Update the remaining batch-helper consumer | [P2] Remove the test-only custody-transfer method
  • reviewed 2026-11-10T05:03:31.593Z sha 9e4ba74 :: blocked before merge. :: [P1] Use existing runtime facts when resuming a retained agent | [P1] Reconcile instruction writes before retaining a failed admission | [P2] Retain bootstrap deferral across Gateway restarts | [P2] Preserve the immediate greeting for ordinary agent creation | [P2] Derive the checkpoint test type from the exported options
  • reviewed 2026-11-10T19:38:34.975Z sha 1b8ac2e :: needs changes before merge. :: [P2] Update migration preservation tests for the new startup column
  • reviewed 2026-11-10T20:12:27.409Z sha 271cbc3 :: needs changes before merge. :: [P1] Persist recoverable continuation facts before retaining modified state
  • reviewed 2026-11-10T20:48:20.969Z sha eb69ec0 :: needs maintainer review before merge. :: none

Reviewed November 10, 2026, 4:26 PM ET / 21:26 UTC (Revision 6).

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

CI repair at cf19f00288740f9e769e11af9dd14dfa18d332e6 changes tests only: use canonical automations fixture data, pass plugin IDs (not a count) to the shared runtime, and explain isolated adapter mock boundaries. Production source is unchanged from the initial published head.

  • Affected Templates and Plugins-platform test-type groups: passed.
  • Mock-export ratchet, scoped lint/format, and exact staged test-line budget: passed (32 lines slack; +4 explicit mock-boundary comment lines, exact admission allocation 1347).
  • Plugin batch suite: 13 passed; corrected routine cases: 2 passed.

Remaining server.sessions.create-worktree-spawn.test.ts failure is baseline-reproduced, not declared green: required visible spawn selects github project (managed worktree: false) expects status: failed but receives an entry without that field. The focused pair produced the identical one-fail/one-pass assertion both on the integrated candidate and on exact main baseline 54e0bc0c213234dd3a616cd83610e0ccb709b227, after qualifying the existing dependency links (unchanged manifests; no installation). Initial baseline setup failures executed no tests and are not attribution evidence. Baseline and candidate logs are retained for native inherited-failure qualification.

The UI dependency has the same backend repair propagated at f57aa6fadf69136d8159cba981ba8ffc62d558aa, with its UI source unchanged. No Add proof was replayed, timing work resumed, or live state changed.

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 10, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

Follow-up at cce79791e2df3ce299743c94f2d4a598691a3ad9 (propagated UI tip 58c010a002b2f06f7a846d78caeaad11c6c66127): derive the test checkpoint type from StatelessTemplateAddOptions["onAgentConfigured"] instead of importing a now-private production type. No production code or test assertions changed.

  • Before: exact-head Templates test graph failed TS2459, and lint reported the resulting error-type unions. After: the Templates graph typecheck, scoped type-aware lint, formatting, diff checks and staged test-line gate passed locally. Exact net backend allocation is now 2,346 LF lines (85 existing + 2,261 admission); shared scalar unchanged. Local combined stack retains 32 lines slack. Published UI tree equals the tested delivery tree.
  • The repaired real-Gateway greeting/authority fixture DID execute successfully in isolated CI on 9e4ba748996aac8581acd7dc045aa162009aba87: 1 test passed in 17.429s, job log. That job is red because of its separate inherited clone-identity test; the fixture result is not a green-job claim and does not establish retained-retry coverage. Latest head changes only test type wiring/allocation.
  • Every remaining final dead-export finding reproduces on clean baseline 9ccdad09a9dfb6a68d32aae18a1014b753ba1704: candidate-only findings = zero. The newly observed sessions.fork participation-code assertion mismatch also reproduces on that exact clean baseline. Existing visible-spawn/clone-identity evidence is retained; none is relabeled green.
  • Prior backend CI test-line ratchet reported 11 lines over the inherited merge-tree ceiling with the exact +2,343 task growth already allocated. This remains a qualified ratchet failure, not a reason to silently raise the shared scalar.

The latest review still leaves substantive recovery work: runtime-fact validation on retained retry, reconciliation of installer-owned partial instruction writes, restart-persistent bootstrap custody, preserving ordinary agents.create immediate greeting, and populated upgrade proof. UI review also identifies the still-open A-admitted → B-created → A-failed → return-to-A draft/retry access defect. The test-type finding is the only one fixed by this small follow-up. No merge, deploy, live Gateway mutation, or repeated browser/performance proof was performed.

etzelm added a commit to etzelm/openclaw that referenced this pull request Nov 11, 2026
…strap_deferred

PostgreSQL stores bootstrapped from the first-use DDL that openclaw#196392
shipped already hold workspace_setup_state.bootstrap_deferred at schema
39. The v40 step now declares that exact shape as a second accepted
source, the migration runner and existing-version inspection select the
stored shape through the schema owner, and the step adds the column only
if it is absent, so stored values are kept. Any other definition of the
column is still refused as drift.

Refs openclaw#196966
ceckert added a commit to ceckert/openclaw that referenced this pull request Nov 11, 2026
…_deferred

openclaw#196392 added workspace_setup_state.bootstrap_deferred
to the eager schema-39 PostgreSQL DDL without a version step, so every
store sealed before it is refused as drift, including update preflight
(openclaw#196966).

Declare the column as a same-version PostgreSQL additive column. A
writable admission verifies the exact predecessor DDL, adds the
generated bigint column and reseals in one transaction. Inspection
accepts either exact shape without writing. Any other difference is
still refused. The workspace worker no longer adds an INTEGER column
on PostgreSQL.

Credit to etzelm, who diagnosed the same failure in
openclaw#197010 (openclaw#197010).
That PR fixes it with a schema-40 step accepting both schema-39 shapes.
This change keeps schema 39 instead. Stores it completes have the
column-present shape that the schema-40 step accepts.

Signed-off-by: Chris Eckert <[email protected]>
daniel-lxs added a commit to daniel-lxs/openclaw that referenced this pull request Nov 13, 2026
…p-provenance

Main's openclaw#196392 and openclaw#196411 already keep a Template Add BOOTSTRAP.md
pending (its hash is recorded as generated), so drop the
bootstrap_supplied column and keep only the cleanups.
Patrick-Erichsen added a commit that referenced this pull request Nov 15, 2026
…199082)

* fix(templates): agent kept by a failed offline Add has no AGENTS.md

When offline Add keeps the agent after a later step fails, the CLI now
writes the default AGENTS.md, IDENTITY.md and USER.md into its
workspace. The package BOOTSTRAP.md stays held, as #196392 intends,
so a completed setup can still seed it.

* fix(templates): kept agent's default files honor bootstrap suppression

Offline Add now applies agents.defaults.skipBootstrap and skipOptionalBootstrapFiles when it gives a kept agent its default files, matching ordinary CLI preparation.

* fix(templates): retain workspace evidence while seeding kept defaults

---------

Co-authored-by: Patrick Erichsen <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 16, 2026
…penclaw#199082)

* fix(templates): agent kept by a failed offline Add has no AGENTS.md

When offline Add keeps the agent after a later step fails, the CLI now
writes the default AGENTS.md, IDENTITY.md and USER.md into its
workspace. The package BOOTSTRAP.md stays held, as openclaw#196392 intends,
so a completed setup can still seed it.

* fix(templates): kept agent's default files honor bootstrap suppression

Offline Add now applies agents.defaults.skipBootstrap and skipOptionalBootstrapFiles when it gives a kept agent its default files, matching ordinary CLI preparation.

* fix(templates): retain workspace evidence while seeding kept defaults

---------

Co-authored-by: Patrick Erichsen <[email protected]>
VACInc added a commit that referenced this pull request Nov 18, 2026
…al is refused as schema drift (#197425)

* fix(state): admit PostgreSQL schema-39 stores sealed before bootstrap_deferred

#196392 added workspace_setup_state.bootstrap_deferred
to the eager schema-39 PostgreSQL DDL without a version step, so every
store sealed before it is refused as drift, including update preflight
(#196966).

Declare the column as a same-version PostgreSQL additive column. A
writable admission verifies the exact predecessor DDL, adds the
generated bigint column and reseals in one transaction. Inspection
accepts either exact shape without writing. Any other difference is
still refused. The workspace worker no longer adds an INTEGER column
on PostgreSQL.

Credit to etzelm, who diagnosed the same failure in
#197010 (#197010).
That PR fixes it with a schema-40 step accepting both schema-39 shapes.
This change keeps schema 39 instead. Stores it completes have the
column-present shape that the schema-40 step accepts.

Signed-off-by: Chris Eckert <[email protected]>

* fix(state): complete retained PostgreSQL predecessor facts for writers

An inspection admission retains a schema-39 predecessor's catalog as
found. A writable admission that reused those shared facts skipped the
bootstrap_deferred completion, so its first setup write failed with
column "bootstrap_deferred" does not exist. A writer now completes the
predecessor before using retained facts that lack a declared additive
column.

Read the additive column name through a type guard instead of an
unchecked cast.

Signed-off-by: Chris Eckert <[email protected]>

* docs(state): separate PostgreSQL downgrade refusal from SQLite compatibility

Older builds ignore bootstrap_deferred only on SQLite. On PostgreSQL a
build that predates the column refuses a completed store as drift and
needs the matching schema and anchor from before the upgrade.

Signed-off-by: Chris Eckert <[email protected]>

* test(state): rebuild workspace setup table for pre-v39 PostgreSQL fixtures

---------

Signed-off-by: Chris Eckert <[email protected]>
Co-authored-by: VACInc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 19, 2026
…al is refused as schema drift (openclaw#197425)

* fix(state): admit PostgreSQL schema-39 stores sealed before bootstrap_deferred

openclaw#196392 added workspace_setup_state.bootstrap_deferred
to the eager schema-39 PostgreSQL DDL without a version step, so every
store sealed before it is refused as drift, including update preflight
(openclaw#196966).

Declare the column as a same-version PostgreSQL additive column. A
writable admission verifies the exact predecessor DDL, adds the
generated bigint column and reseals in one transaction. Inspection
accepts either exact shape without writing. Any other difference is
still refused. The workspace worker no longer adds an INTEGER column
on PostgreSQL.

Credit to etzelm, who diagnosed the same failure in
openclaw#197010 (openclaw#197010).
That PR fixes it with a schema-40 step accepting both schema-39 shapes.
This change keeps schema 39 instead. Stores it completes have the
column-present shape that the schema-40 step accepts.

Signed-off-by: Chris Eckert <[email protected]>

* fix(state): complete retained PostgreSQL predecessor facts for writers

An inspection admission retains a schema-39 predecessor's catalog as
found. A writable admission that reused those shared facts skipped the
bootstrap_deferred completion, so its first setup write failed with
column "bootstrap_deferred" does not exist. A writer now completes the
predecessor before using retained facts that lack a declared additive
column.

Read the additive column name through a type guard instead of an
unchecked cast.

Signed-off-by: Chris Eckert <[email protected]>

* docs(state): separate PostgreSQL downgrade refusal from SQLite compatibility

Older builds ignore bootstrap_deferred only on SQLite. On PostgreSQL a
build that predates the column refuses a completed store as drift and
needs the matching schema and anchor from before the upgrade.

Signed-off-by: Chris Eckert <[email protected]>

* test(state): rebuild workspace setup table for pre-v39 PostgreSQL fixtures

---------

Signed-off-by: Chris Eckert <[email protected]>
Co-authored-by: VACInc <[email protected]>
RomneyDa pushed a commit that referenced this pull request Nov 19, 2026
…al is refused as schema drift (#197425)

* fix(state): admit PostgreSQL schema-39 stores sealed before bootstrap_deferred

#196392 added workspace_setup_state.bootstrap_deferred
to the eager schema-39 PostgreSQL DDL without a version step, so every
store sealed before it is refused as drift, including update preflight
(#196966).

Declare the column as a same-version PostgreSQL additive column. A
writable admission verifies the exact predecessor DDL, adds the
generated bigint column and reseals in one transaction. Inspection
accepts either exact shape without writing. Any other difference is
still refused. The workspace worker no longer adds an INTEGER column
on PostgreSQL.

Credit to etzelm, who diagnosed the same failure in
#197010 (#197010).
That PR fixes it with a schema-40 step accepting both schema-39 shapes.
This change keeps schema 39 instead. Stores it completes have the
column-present shape that the schema-40 step accepts.

Signed-off-by: Chris Eckert <[email protected]>

* fix(state): complete retained PostgreSQL predecessor facts for writers

An inspection admission retains a schema-39 predecessor's catalog as
found. A writable admission that reused those shared facts skipped the
bootstrap_deferred completion, so its first setup write failed with
column "bootstrap_deferred" does not exist. A writer now completes the
predecessor before using retained facts that lack a declared additive
column.

Read the additive column name through a type guard instead of an
unchecked cast.

Signed-off-by: Chris Eckert <[email protected]>

* docs(state): separate PostgreSQL downgrade refusal from SQLite compatibility

Older builds ignore bootstrap_deferred only on SQLite. On PostgreSQL a
build that predates the column refuses a completed store as drift and
needs the matching schema and anchor from before the upgrade.

Signed-off-by: Chris Eckert <[email protected]>

* test(state): rebuild workspace setup table for pre-v39 PostgreSQL fixtures

---------

Signed-off-by: Chris Eckert <[email protected]>
Co-authored-by: VACInc <[email protected]>
(cherry picked from commit 17c5fb0)

Companion review: no later PR-number references through pinned main. Baseline schema-40 migration already owns completion; add the missing bootstrap-deferred historical layouts and column to that owner.
Co-authored-by: RomneyDa <[email protected]>

(cherry picked from commit d7583be40016d304ddbafe20cc36dc238205e154)
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
)

* fix(plugins): portable plugin-state keys for PostgreSQL

Use an exclusive SQL lower bound for Doctor pagination instead of a NUL-suffixed cursor. Reject new NUL keys in test-only plugin-state fixtures while retaining legacy SQLite adoption reads.

Add real PostgreSQL Doctor regression coverage and register it in conformance and database-worker lanes. Refs openclaw#184862 openclaw#188642.

* test: account for rebased plugin-state coverage

* test(clickclack): import legacy revocations before adoption

(cherry picked from commit 395cac7)

Release adaptation: Only exclusive SQL lower bound in kernel and Doctor pagination; preserve legacy SQLite keys and public validation. Regression exercises real Doctor paging and inspected executed SQL bindings; no NUL-key fixture policy, schema or unrelated tests.

Follow-up dispositions: 8253356 fix: preserve child results after source lifecycle changes (openclaw#202708); f3f89c7 fix: show saved child results when completion delivery fails (openclaw#202664); c45faa8 fix: align CI tests with admitted tool calls (openclaw#202655); 5c9389a fix: make channels add report required plugin install failures (openclaw#202091); 52b9188 fix: show hosted model details in `models list` without a Gateway (openclaw#202490); d248a76 fix: show an outcome when kept child chats return no answer (openclaw#202423); 5148804 fix(discord): check a queued message's access again when its turn starts (openclaw#202330); 2470d62 fix: let setup use account models with a fresh catalog (openclaw#202019); 9fa0b92 fix: let PostgreSQL Gateways start with plugin-backed secrets (openclaw#201063); c180824 fix(plugins): Talk and plugin-loading requests fail on PostgreSQL Gateways (openclaw#201976); cb5cfb2 fix: keep a doubtful killed-update recovery on the repair path (openclaw#201361); 17c5fb0 fix(state): PostgreSQL state created before Template bootstrap deferral is refused as schema drift (openclaw#197425); b5c1277 fix: let resumed parents collect children stopped by restart (openclaw#201460); f920a7e chore(postgres): qualify cron completion during graceful shutdown (openclaw#201246); 1680f54 fix(openai): new ChatGPT subscription models missing until an OpenClaw release (openclaw#201130); 0d8820a fix(media): image descriptions use the ChatGPT OAuth route when OpenAI has no API key (openclaw#199299); ee3e16e test(agents): trim and fold low-value regression suites (openclaw#198916); b8029b4 test(agents): qualify PostgreSQL simple-completion acquisition (openclaw#200956); 703c82d fix(sessions): record queued input end causes and recover them across crashes (openclaw#200533); 23fca1a fix: let the next update continue after a killed update when nothing is left to repair (openclaw#200680); d565e17 fix(ci): retire deleted session fork test from inventory (openclaw#200611); 4cf12c6 chore(postgres): qualify prompt refresh and rebalance CI (openclaw#200488); d460273 fix(templates): release earlier Template-managed agents (openclaw#200303); ff75829 fix(update): --no-restart update fails when the Gateway restarts itself during Doctor's stop (openclaw#200181); 0b2ad60 chore(postgres): cover compaction watched-session prompts (openclaw#200117); b90c573 test: consolidate redundant coverage (198795 recut) (openclaw#198943); a042363 test: consolidate redundant coverage (198793, part 2) (openclaw#198936); 9bfad2b test: consolidate suites while retaining recovery owners (openclaw#198933); 4e9812c test: consolidate redundant coverage (198789, part 2) (openclaw#198932); 90814f5 fix(subagents): stops a finished sub-agent's chat being deleted before its parent reads the result; 799bc0b fix(ci): stabilize hourly fixtures and retire unused exports (openclaw#199851); e4a3093 perf(update): replace the candidate canary with a runtime contract check (openclaw#198268); a4cc2ad fix: undo cold-session compaction CPU and latency regressions (openclaw#199561); 55fec79 fix(agents): stop divergent mid-turn overflow recovery (openclaw#199636); 2c4413a fix: reduce Gateway stalls under filesystem pressure (openclaw#197510); 37d977f fix: output reducers are skipped in headless and Code Mode runs (openclaw#199434); c9ee264 fix(compaction): concurrent sessions wait for each other's summaries during compaction (openclaw#196550); 2471ddc feat: let agents review generated images before delivery (openclaw#198227); 21f7dc6 fix(github): publication fails with PostgreSQL session or state stores (openclaw#193749); 63d9e57 fix(ci): new PostgreSQL suites are omitted from conformance (openclaw#198390); 466a4b6 fix(telegram): steered answers quote the wrong input (openclaw#178124); 87b6f52 fix(delivery): resend routed Telegram finals after an ambiguous network failure (openclaw#192779); 68a839b fix: isolate held agent databases until explicit restoration (openclaw#198180); cff99b2 fix(agents): keep provider history append-only across runs (openclaw#197874); 8a328bf feat: add an opt-in usage-ranked tool index (openclaw#197128); 097e648 fix(ci): plan only executable infra tests (openclaw#197911); 76385fd fix(models): discovered models become "Unknown model" after restart or an ended sign-in (openclaw#197784); 89d4177 fix(plugin-state): guarded calls fail until Gateway restart after an unknown write outcome (openclaw#197790); baca36e fix(sessions): commit selected invitations with original messages (openclaw#184512); 699e538 fix(sessions): drain passive notices on sessions_send resumes; d6ded18 chore(ci): drop retired test-lines allocation records (2/3) (openclaw#197656); e0dd020 fix(agents): collect process results at suspended-run capacity; 4897740 feat(auth): preserve delegated OCE user profiles and permissions (openclaw#196856); 7197ce1 feat(templates): install bundled plugins through native management (openclaw#196349); 9c6ee9b feat: let Template automations start paused for onboarding (openclaw#196323); 79a6214 fix(message): retain local final replies in conversation history (openclaw#187795); caa978c feat(templates): open durable chat before verified setup (openclaw#196392); 78e73aa fix(sessions): cold PostgreSQL conversations fail after idle readers close (openclaw#189991); b6ed907 perf(sessions): persist active transcript facts for hydration (openclaw#193682); 1595dd2 feat(plugins): reauthorize accepted session work (openclaw#176886); b43ad0a fix(models): avoid reloading plugins on catalog refresh (openclaw#193903); 0947d02 fix(ci): avoid unrelated PostgreSQL runs and admit owned tests (openclaw#193870); 428ca7d feat(openclaw-id): add Gateway membership authority and publication behind the Labs flag (openclaw#192335); c718583 fix(update): repair refuses forever after a verified update fails a later step (openclaw#193132); 3f64174 fix: deliver background replies after a reload retires the turn registry (openclaw#193130); 982f3b1 fix(imessage): report Automation failures after Gateway updates (openclaw#186117); 31b28e9 fix(agents): wait for a peer OAuth refresh before failing request auth (openclaw#192906); cf50d4a feat(storage): support read-only PostgreSQL standby inspection (openclaw#192645); 82fd4e6 fix(agents): retain stale session target refusal reasons (openclaw#192681); 8ac4e19 fix(worktrees): reserve capacity on PostgreSQL (openclaw#192537); 718b349 fix: reduce session startup stalls under storage contention; 08f4a19 refactor(skills): move Skill Workshop into its bundled plugin (openclaw#192471); 837402a fix(clawrouter): keep upstream credit failures off the shared key (openclaw#192575); f38495f fix(plugins): reject late routing from canceled runs (openclaw#192492); dc5d61a improve(sessions): reduce unnecessary maintenance query rows (openclaw#192023); c4bf0dc fix(sessions): avoid extra maintenance scans for embedded archives (openclaw#184507); e44b3d6 fix(team-reports): recover after database connection loss (openclaw#192020); 991fb33 fix(logbook): recover after database connection loss (openclaw#192011); e6d0d2e fix(test): include omitted PostgreSQL conformance suites (openclaw#191962); da5ff0f fix(codex): reject native hooks from a previous run (openclaw#191788); 09f0b0b feat(plugins): add skill usage runtime for plugins (openclaw#191661); 00b2ff4 fix: parent sessions miss child approvals with a custom session store (openclaw#189827); be44b10 fix: stop completed session writes retaining request data (openclaw#191197); d40aa7c fix(sessions): replay creation requests across Gateway restarts (openclaw#190862); d894035 fix: await Doctor shared-state repair preparation (openclaw#190875); b515cc7 feat: fork threaded conversations with Telegram support (openclaw#190783); def6349 feat(plugins): plugins can run a hidden forked turn of a session with their own tools (openclaw#190950); d983e34 feat(plugins): plugin commands can continue the agent with a replacement prompt, on every channel (openclaw#190908); ea3f0b8 fix(ci): provision Node test prerequisites and retain Baseten routing (openclaw#191050); 29503e1 fix(update): Gateway stays stopped after the updater process dies mid-update (openclaw#188497); fc8c2d0 fix(update): preserve unfinished handoff artifacts (openclaw#190571); 7c26e8c fix(ci): cover PostgreSQL managed update handoffs (openclaw#190336); 4913d41 fix(ci): prevent truncated PostgreSQL target listings (openclaw#189509); 8925f62 fix(gateway): start restored PostgreSQL homes on the first attempt (openclaw#190291); 177fe32 feat(models): preserve inference capabilities in opt-in catalog v3 (openclaw#189678); 7faf32d feat: retain repository disk authority through recovery (openclaw#189106); a658df3 feat(database): capture externally quiesced SQLite migrations; 0f9e7f7 feat(database): capture exact SQLite migration capsules; 4fb684e feat(backup): add PostgreSQL local companion checkpoints; c89a101 fix(doctor): migrate auth profiles on PostgreSQL stores (openclaw#189639); 799de09 fix(ci): split oversized workspace and setup files (openclaw#189356); 21ee847 fix(acp): keep completed run conversations resumable (openclaw#189273); fce0e56 perf(sessions): open cold history without restoring archives (schema 39) (openclaw#188397)

Validation: Baseline1 NUL-binding assertion failure/21passing; candidate22/22passes (188693-green.log). Real SQLite Doctor path and generated SQL proved; no native PostgreSQL server execution claimed.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 0895146d8c1493146f5c6461eee0b10c329bdd1e)
(cherry picked from commit f8ccaa70bc9773d6bbb569bc0e275eee0c544ead)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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.

1 participant