Skip to content

fix(state): copy-safe agent database registry via state-relative paths (schema v9) - #124728

Merged
steipete merged 5 commits into
mainfrom
steipete/affectionate-jemison-8d4971
Aug 16, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/affectionate-jemison-8d4971

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The agent_databases registry in the shared state DB (state/openclaw.sqlite) stores absolute paths. Copying a state dir (observed live: /tmp/autoqa-state -> /tmp/autoqa-state2) keeps registry rows pointing into the old root. The gateway combined session store then merges the old and new copies of the same agent database, sees the same canonical session key twice, and every sessions.list fails with SessionCanonicalKeyMigrationRequiredError until the row is deleted by hand. The error text tells the operator to run openclaw doctor --fix, which had no repair for this state — a dead-end remedy.

Why This Change Was Made

Root-cause repair instead of a downstream guard: state schema v9 stores in-root registry paths relative to the state dir, so a copied state dir is intrinsically self-contained — its registry resolves agent databases beneath the copied root. Explicit external database paths stay absolute. The v8->v9 migration rewrites in-root rows to relative form, deletes copied foreign default-layout rows (.../agents/<agent_id>/agent/openclaw-agent.sqlite outside the current root — discovery metadata that self-heals on next open), and preserves genuine external registrations untouched. Maintainer explicitly approved the schema-version bump and the relative-path design.

Registry reads (listOpenClawRegisteredAgentDatabases, deletion journal, updater preflight) resolve stored rows back to absolute paths, so every consumer is unchanged. Native Swift schema support, package.json schema metadata, doctor migration descriptions, and the schema docs (including v9->v8 manual downgrade guidance) are updated in step.

User Impact

Copying or moving a state dir (documented testing flow, backup/restore, autoqa) no longer poisons the gateway session list. Existing state DBs migrate forward automatically on first open or via openclaw doctor --fix.

Evidence

  • Regression test reproduces the exact reported failure and fails on pre-fix code: keeps copied state directories self-contained for combined gateway reads (src/config/sessions/startup-migration.registry-recovery.test.ts) — verified failing with SessionCanonicalKeyMigrationRequiredError at mergeSessionEntryIntoCombined with production changes stashed, passing with the fix.
  • v8->v9 migration test covers all three row classes (in-root rewrite, foreign default-layout delete, external preserve) in src/state/openclaw-state-db.test.ts.
  • Registry round-trip test (relative storage, absolute listing, unregister of mixed-form rows) in src/state/openclaw-agent-db.test.ts.
  • Focused suites: pnpm test src/state/openclaw-state-db.test.ts src/state/openclaw-agent-db.test.ts src/config/sessions/startup-migration.registry-recovery.test.ts — 253 passed, 5 skipped locally; 300 passed on Testbox.
  • pnpm build green; native schema drift guard updated (Swift pin 9 == TS 9).
  • Codex autoreview (gpt-5.6-sol, high): clean, no accepted findings.
  • LOC: production +148/−14, tests +150/−11, docs/metadata +13/−1 — positive production delta owned by the new relative/resolve path pair and the v9 migration (named capability: copy-safe state dirs; schema migrations are inherently additive).

…he state dir (schema v9)

Copied state directories retained stale absolute agent database registry rows. The combined gateway store then merged old and new copies, causing every sessions.list request to fail with SessionCanonicalKeyMigrationRequiredError.

Schema v9 stores in-root registry paths relative to the state directory; migration rewrites eligible rows, deletes stale duplicates, and preserves external paths.
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 16, 2026 18:10
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M maintainer Maintainer-authored PR labels Aug 16, 2026
@openclaw-barnacle openclaw-barnacle Bot added the channel: voice-call Channel integration: voice-call label Aug 16, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 16, 2026, 4:06 PM ET / 20:06 UTC.

ClawSweeper review

What this changes

The PR stores agent database registrations inside a state directory as relative paths, migrates existing schema-8 registries to schema 9, and resolves those paths for gateway and maintenance consumers.

Merge readiness

⛔ Blocked by patch quality or review findings - 7 items remain

Keep open: the schema-9 direction is sound for future registrations, but the current migration still rewrites an ambiguous, supported external default-layout registration when a same-ID in-root file exists. That repeats the prior P1 compatibility concern and can remove an external session store from discovery after upgrade.

Priority: P1
Reviewed head: 27089e571afa076988e93ba1f9568ec1ac54792e
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The regression direction is useful, but the unresolved P1 migration behavior makes the patch not ready to merge.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its reported focused and Testbox runs remain supplemental to the unresolved compatibility finding.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its reported focused and Testbox runs remain supplemental to the unresolved compatibility finding.
Evidence reviewed 6 items Current main contract: Current main stores the caller-provided path, while the existing registry migration documents that the composite agent-and-path key preserves explicit relocated databases.
Ambiguous external path is rewritten: When no in-root registry row exists but a same-agent in-root file exists, the migration re-anchors the foreign default-layout row rather than preserving it; filesystem layout alone does not establish copy provenance.
Missing regression case: The migration test preserves a foreign default-layout path only when its in-root counterpart is absent; it does not cover a legitimate external registration with an unregistered same-ID in-root database file.
Findings 1 actionable finding [P1] Preserve ambiguous external registrations
Security None None.

How this fits together

The shared state database records agent SQLite locations for gateway session aggregation and maintenance tools. A copied state directory must point at its copied agent databases without losing intentionally external registrations.

flowchart LR
  A[Agent database registration] --> B[Shared state registry]
  B --> C[Schema 9 migration]
  C --> D[Resolved database paths]
  D --> E[Gateway session aggregation]
  D --> F[Maintenance tools]
  E --> G[Session list result]
Loading

Decision needed

Question Recommendation
Should schema 9 preserve ambiguous foreign default-layout registrations, even if that means legacy copied state directories need a separately provable repair path? Preserve ambiguous external rows: Only normalize known in-root registrations and retain ambiguous foreign rows, adding coverage for the same-ID in-root-file case.

Why: The current migration cannot distinguish a copied registry row from a legitimate external registration solely from matching agent IDs and filesystem layout; choosing re-anchoring can silently change an existing setup.

Before merge

  • Preserve ambiguous external registrations (P1) - When a foreign default-layout path has no in-root registry counterpart but a same-ID in-root file exists, this rewrites the valid external registration to that local file. The existing composite key explicitly supports relocated paths, so require actual copy provenance or preserve the foreign row; add that counterpart case to the migration test.
  • Resolve merge risk (P1) - An automatic upgrade can silently redirect a legitimate external agent database registration to an unrelated in-root database, removing that external store from session discovery.
  • Resolve merge risk (P1) - The bug-fix diff adds production +191/−15; that growth is warranted only if the migration preserves the existing external-registration contract rather than encoding an ambiguous heuristic.
  • Complete next step (P2) - The maintainer-labelled PR needs an explicit compatibility choice because the safe migration behavior conflicts with automatic repair of indistinguishable legacy copied directories.
  • Improve patch quality - Preserve the ambiguous external row or establish authoritative copy provenance.
  • Improve patch quality - Add the schema-8 regression where an external default-layout registration coexists with an unregistered same-ID in-root file.

Findings

  • [P1] Preserve ambiguous external registrations — src/state/openclaw-state-db-schema-repair.ts:530-534
Agent review details

Security

None.

PR surface

Source +176, Tests +180, Docs +12, Config 0, Other 0. Total +368 across 20 files.

View PR surface stats
Area Files Added Removed Net
Source 11 189 13 +176
Tests 5 191 11 +180
Docs 1 12 0 +12
Config 1 1 1 0
Generated 0 0 0 0
Other 2 3 3 0
Total 20 396 28 +368

Review metrics

Metric Value Why it matters
Production versus test LOC production +191/−15; tests +193/−13; docs +12/−0 The added migration and path-resolution contract are substantial bug-fix growth and need a safe upgrade invariant.
Persisted registry contract state schema 8 → 9; 3 direct registry consumers updated The automatic migration changes durable path representation used by listing, deletion, and database preflight.

Stored data model

Persistent data-model change detected: serialized state: src/config/sessions/startup-migration.registry-recovery.test.ts, serialized state: src/infra/state-migrations.doctor.ts, serialized state: src/state/agent-deletion-journal.ts, serialized state: src/state/openclaw-agent-db-registry-listing.ts, serialized state: src/state/openclaw-agent-db-registry.ts, serialized state: src/state/openclaw-agent-db.test.ts, and 11 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Preserve ambiguous registrations (recommended)
    Revise the migration to retain foreign default-layout rows unless copy provenance is authoritative, and add the omitted external-registration regression case.
  2. Accept the upgrade tradeoff
    Land the heuristic only after a maintainer explicitly accepts that some valid external registrations may be re-anchored during schema migration.

Technical review

Best possible solution:

Keep state-relative storage for new and clearly in-root registrations, but preserve every ambiguous schema-8 external row until copy provenance can be established by an explicit safe migration path.

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

Yes, source-reproducible: seed a schema-8 registry with only a foreign default-layout row, create a same-ID in-root database file without an in-root registry row, then migrate; the row is re-anchored. The read-only review did not execute the test suite.

Is this the best way to solve the issue?

No. Relative storage is the right canonical representation, but re-anchoring an ambiguous external row is not a safe upgrade repair because the registry explicitly supports relocated paths per agent.

Full review comments:

  • [P1] Preserve ambiguous external registrations — src/state/openclaw-state-db-schema-repair.ts:530-534
    When a foreign default-layout path has no in-root registry counterpart but a same-ID in-root file exists, this rewrites the valid external registration to that local file. The existing composite key explicitly supports relocated paths, so require actual copy provenance or preserve the foreign row; add that counterpart case to the migration test.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a0f4d5462a4e.

Labels

Label justifications:

  • P1: A schema upgrade can make an existing external session store disappear from gateway discovery.
  • merge-risk: 🚨 compatibility: Schema 9 rewrites persisted registry paths and can change valid external registrations.
  • merge-risk: 🚨 session-state: Registry paths select the SQLite stores whose session rows are combined by the gateway.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its reported focused and Testbox runs remain supplemental to the unresolved compatibility finding.

Evidence

What I checked:

  • Current main contract: Current main stores the caller-provided path, while the existing registry migration documents that the composite agent-and-path key preserves explicit relocated databases. (src/state/openclaw-agent-db-registry.ts:630, a0f4d5462a4e)
  • Ambiguous external path is rewritten: When no in-root registry row exists but a same-agent in-root file exists, the migration re-anchors the foreign default-layout row rather than preserving it; filesystem layout alone does not establish copy provenance. (src/state/openclaw-state-db-schema-repair.ts:530, 27089e571afa)
  • Missing regression case: The migration test preserves a foreign default-layout path only when its in-root counterpart is absent; it does not cover a legitimate external registration with an unregistered same-ID in-root database file. (src/state/openclaw-state-db.test.ts:1616, 27089e571afa)
  • User-visible failure owner: Gateway aggregation throws when two stores resolve to the same canonical session key, which explains why incorrect registry migration directly affects sessions.list. (src/config/sessions/combined-store-gateway.ts:142, a0f4d5462a4e)
  • Current-main and release check: The reviewed head is not contained by current main and no local release tag contains it, so this work is neither implemented on main nor shipped. (27089e571afa)
  • Area history: Recent state and session registry history is dominated by Peter Steinberger, including the multi-agent ownership refactor that touched this area. (src/state/openclaw-agent-db-registry.ts:601, 1ca60fbc3a3f)

Likely related people:

  • steipete: Recent history for the registry and combined-session surfaces is predominantly authored by Peter Steinberger, and this PR continues that work. (role: frequent state and session-area contributor; confidence: high; commits: 1ca60fbc3a3f, cd8a96491e26, e8566596e032; files: src/state/openclaw-agent-db-registry.ts, src/state/openclaw-agent-db-registry-listing.ts, src/config/sessions/combined-store-gateway.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-08-16T18:20:00.154Z sha bdba034 :: found issues before merge. :: [P1] Preserve explicit external default-layout registrations
  • reviewed 2026-08-16T18:36:26.238Z sha b0a3567 :: found issues before merge. :: [P1] Preserve foreign default-layout registry rows
  • reviewed 2026-08-16T18:59:56.055Z sha 2b79cf9 :: needs changes before merge. :: [P1] Preserve foreign default-layout registry rows
  • reviewed 2026-08-16T19:38:30.274Z sha 27089e5 :: found issues before merge. :: [P1] Preserve ambiguous external registrations

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 16, 2026
The store opens any state database up to maximumSupportedSchemaVersion,
which the schema v9 bump moved from 8 to 9. Shift the supported/newer
partition in the boundary test accordingly.
@openclaw-barnacle openclaw-barnacle Bot added the app: macos App: macos label Aug 16, 2026
…deleting them

Resolve the ClawSweeper P1 by preserving genuine external default-layout registrations, re-anchoring copied rows when an in-root counterpart exists, and deleting only dual default-layout conflicts.
@steipete steipete self-assigned this Aug 16, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Resolved the ClawSweeper P1 at exact head 27089e571afa076988e93ba1f9568ec1ac54792e.

The v8→v9 migration now applies the approved three-way rule in two passes: it first rewrites every in-root absolute row to its relative canonical form, then classifies foreign default-layout rows against the live table. A foreign row is deleted only when the same agent already owns the in-root canonical registration, because that dual registration guarantees duplicate canonical session keys. Otherwise it is re-anchored when the copied in-root database file exists, or preserved as an absolute external registration when no counterpart exists.

The migration regression now covers the in-root rewrite, dual-registration deletion, copied-file re-anchor, foreign default-layout preservation, and ordinary external-path preservation. The unchanged copied-state combined-session regression also remains green.

Validation: focused state/session suites passed (255 tests, 5 skipped); Codex autoreview reported no actionable findings; exact-head CI is green after one unrelated Control UI anchoring flake passed on retry.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer disposition of the exact-head ClawSweeper P1 (“Preserve ambiguous external registrations”, src/state/openclaw-state-db-schema-repair.ts:530-534): rejected with rationale, landing past it.

The protected scenario — a deliberate external default-layout registration for agent X while a same-agent in-root default database file exists on disk without an in-root registry row — is not a working configuration under either the pre-v9 or post-v9 reader. The in-root default path is a config-derived session-store target independent of the registry (resolvePreparedConfiguredSessionStoreTargets merges configured targets with registry rows), so preserving the foreign row makes the combined gateway store load both databases and fail every sessions.list with SessionCanonicalKeyMigrationRequiredError — the exact defect this PR repairs. Re-anchoring is the only migration outcome that keeps a live registration without a structurally broken dual surface; the external database file itself is never modified or deleted, so recovery (re-registering it explicitly) remains a plain re-open.

The genuinely ambiguous case — foreign default-layout row with no in-root counterpart file — is preserved absolute, with a regression test asserting that preservation. Deletion only occurs for dual default-layout registrations of the same agent, which guarantee duplicate canonical session keys.

@steipete
steipete merged commit 4bc37cd into main Aug 16, 2026
405 of 407 checks passed
@steipete
steipete deleted the steipete/affectionate-jemison-8d4971 branch August 16, 2026 20:31
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 17, 2026
…s (schema v9) (openclaw#124728)

* fix(state): store in-root agent database registry paths relative to the state dir (schema v9)

Copied state directories retained stale absolute agent database registry rows. The combined gateway store then merged old and new copies, causing every sessions.list request to fail with SessionCanonicalKeyMigrationRequiredError.

Schema v9 stores in-root registry paths relative to the state directory; migration rewrites eligible rows, deletes stale duplicates, and preserves external paths.

* fix(voice-call): describe state-relative registry migration

* fix(state): preserve registry locator traversal

* test(macos): move PortGuardian schema-version boundary to v9

The store opens any state database up to maximumSupportedSchemaVersion,
which the schema v9 bump moved from 8 to 9. Shift the supported/newer
partition in the boundary test accordingly.

* fix(state): re-anchor copied default-layout registry rows instead of deleting them

Resolve the ClawSweeper P1 by preserving genuine external default-layout registrations, re-anchoring copied rows when an in-root counterpart exists, and deleting only dual default-layout conflicts.
steipete added a commit that referenced this pull request Aug 17, 2026
* fix: keep device identity reads lock-free

Amp-Thread-ID: https://ampcode.com/threads/T-01a00ae0-190d-718b-8a76-b75f3e8d1fae

* feat(lint): enforce import ordering and deduplication (#124730)

* refactor(imports): dedupe and hoist imports

* feat(lint): enforce import/no-duplicates and import/first

* feat(voice-call): sessionScope "main" routes calls into the agent main session (#124708)

* feat(voice-call): add sessionScope "main" for main-session call routing

Inbound and outbound calls can now share the configured agent's main
session instead of a dedicated voice session. The new scope resolves
through the existing explicit-key canonicalization path, honoring core
session.mainKey and global-scope aliasing. The inbound webhook path now
forwards coreSession like every other resolver call site.

* style: format events.test.ts

* test(voice-call): split events.test.ts under the max-lines cap

* fix(cli): forward agent name through setup (#124740)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

Co-authored-by: Amp <[email protected]>

* refactor(mcp): centralize tool filter policy (#124739)

* fix(agents): preserve restart-unsafe delivery evidence (#124737)

* fix(ci): snapshot synced Testbox candidates (#124743)

Co-authored-by: Amp <[email protected]>

* fix(ci): keep QA evidence output repo-relative (#124760)

* fix(cli): allow hook toggles to select an agent (#124761)

* test(upgrade): drop retired agent context assertion (#124765)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00a6a-b64e-74a5-8b15-2d3b966a468d

Co-authored-by: Amp <[email protected]>

* fix(skills): report missing ClawHub skills as not found (#124764)

* feat(codex): show sessions from additional homes (#124660)

* feat(codex): register additional session homes

* fix(codex): preserve automatic session homes

* docs(codex): explain automatic home discovery around sessionCatalog.homes

---------

Co-authored-by: IWhatsskill <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>

* fix(qa): preserve effective fast mode (#124762)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

Co-authored-by: Amp <[email protected]>

* fix(ui): keep Control UI device identity working on plain-HTTP origins (#124724)

* fix(ui): keep Control UI device identity working on plain-HTTP origins

@noble/ed25519 defaults its SHA-512 provider to crypto.subtle, which
browsers gate to secure contexts, so device identity silently vanished
on http:// LAN dashboards and connects fell back to shared-credential
auth with no pairing. Wire a lazy pure-JS @noble/hashes fallback for
SHA-512 and the fingerprint SHA-256, and drop the isSecureContext gate
in the connect path. Secure contexts keep the platform digests and pay
no startup bytes: the fallback loads as its own lazy chunk, kept out of
the gateway-runtime startup chunk on purpose.

* test(ui): cover device identity minting and signing without crypto.subtle

New jsdom regression suite fails on pre-fix code (subtle-less crypto stub
with getRandomValues, which real insecure contexts keep). Rewrites the
gateway connect tests that previously asserted the device-less insecure
fallback: an insecure context now attaches a device identity.

* docs(web): plain-HTTP dashboards now pair with a device identity

The signing key never crosses the wire, so HTTP+pairing is strictly
stronger than the old HTTP token-only fallback; HTTPS (Tailscale Serve)
stays the recommendation for transport privacy.

* fix(ui): drop unnecessary boolean literal compare in secure-context timing meta

* test(ui): declare device.id on the connect-frame test shape

* test(ui): split the subtle-less scope-upgrade e2e into the two real invariants

Without crypto.subtle the browser can now sign, so the banner offers the
explicit admin upgrade; manual-only guidance is reserved for browsers that
cannot mint an identity at all (no WebCrypto RNG). Also corrects the
connect-path comment: blocked storage yields an ephemeral identity, only a
failed mint degrades device-less.

* fix(ui): address review findings on the HTTP device-identity path

- Storage-blocked pages keep one stable in-memory identity per page
  lifetime instead of minting a fresh unpaired key on every reconnect,
  and a write-rejecting store no longer fails the mint (regression tests
  bite pre-fix).
- Connect timing now reports the real browser secure-context fact via a
  shared browserSecureContext() helper instead of inferring it from
  device-identity presence.
- Docs state the accepted trusted-proxy contract: browsers attach a
  device identity on every origin, so first connects follow the standard
  pairing flow (deviceAutoApprove or a one-time approval); device-less
  admission remains only for browsers that cannot mint an identity.

* refactor(ui): trim the connect-path additions under the max-lines cap

* fix(line): retry lost pushes without duplicating an accepted send (#124464)

A LINE push made exactly one attempt, so a transient provider or transport
failure dropped the reply even though retrying was safe to do. Retrying alone
would have duplicated a send LINE already accepted, so every push now carries an
X-Line-Retry-Key and reuses it across attempts: LINE answers a replayed key with
409 and the accepted request's sent messages, which resolves to the original
delivery instead of a second message.

Retries follow LINE's documented policy - server errors and transport failures
only, never 2xx, 409 or any 4xx - and run through the shared channel API retry
runner in strict mode. Replies stay single-attempt because LINE offers no retry
key for them.

* fix(outbound): record queue-write loss and fail every payload on prep abort (#124756)

* fix(outbound): record queue-write loss and fail every payload on prep abort

Two silent-observer gaps in the outbound queue admission path:

1. Best-effort staging/queue-write failures were swallowed with a bare
   'return null'. The send proceeded live-only, so a crash mid-send lost
   the message with zero forensic trace of why the write-ahead row was
   missing. Every sibling degradation on this boundary logs
   (persistQueuedPreSendState, the dispatch-refresh fallback); this one
   now warns with channel/target and the error.

2. Batch preparation failure emitted message_sent for only the first
   payload while audit emitted per-payload terminals, so plugins with
   message_sent hooks saw 1 failure for an N-payload batch. The failure
   path now emits one hook failure per logical payload, matching the
   audit terminals and the recovery sibling's
   queuedTerminalFailureEvents. The unused error.payload pick and its
   OutboundPayloadPreparationError import went with it.

Regressions: queue-write warn asserted in the existing best-effort
fallback test; new multi-payload prep-failure test asserts 2 hook
failures. Both fail pre-fix.

* chore(outbound): keep OutboundPayloadPreparationError module-local

Last external consumer went away with the per-payload emit; the
deadcode:exports gate rejects unused exports.

* refactor(gateway): drop dead session-subscriber registry surface (#124754)

* refactor(gateway): drop dead session-subscriber registry surface

getForConnection and both registry clear() methods had no production
callers — only server-chat-state.test.ts consumed them (verified by
repo-wide grep incl. plugin-sdk). The recency-sorted connToSessionKeys
index existed solely so getForConnection returned keys in subscription
order, an ordering nothing read, rebuilt via toSorted() on every
subscribe/unsubscribe/settle — including the provisional-replay settle
path.

unsubscribeAll now reads the reverse index directly from
connToSessionRecency's keys (same contents, no ordering), removing the
per-call O(k log k) rebuild and the duplicate map. Tests assert through
get()/getApprovals(), the production read paths, per test-audit norms.

Behavior-neutral: subscription state transitions and event-visible
delivery unchanged; chat-state, broadcast, node-subscription,
instance-runtime, agent-events, session-events suites pass.

* test(gateway): fix ETXTBSY flake in workspace-sync candidate bounding

The test rewrote its mock git script between two createGitTransferList
calls. On Linux CI the second spawn can race a lingering fork of the
first child still holding the script's write fd, failing exec with
ETXTBSY. Write the script once; vary the entry count through a data file
the script reads instead.

* fix(config): preserve migration notice paths (#124719)

* fix(runners): preserve device sessions through lifecycle faults (#124744)

* test(runners): cover paired-node lifecycle wire

* fix(runners): preserve retryable device lifecycle

* test(runners): keep wire fixture internals local

* fix(runners): stop fallback on device capacity

* fix(doctor): keep identity probe within typed storage APIs

Amp-Thread-ID: https://ampcode.com/threads/T-01a00ae0-190d-718b-8a76-b75f3e8d1fae

* fix(openai): keep setup auth choices consistent (#124729)

* fix(openai): centralize setup auth metadata

* refactor(openai): overlay auth hooks in place

* fix(tasks): cancel subagents through gateway (#124752)

* fix: honor context caps on Codex-routed models (#124735)

* fix(codex): forward authored context caps

* test(codex): keep binding fixtures uncapped

* fix(agent-harness): separate authored context cap

* fix(config): render actionable validation errors (#124763)

* fix(config): render actionable validation errors

* fix(config): cover service and gateway validation

* docs: remove agent-hierarchy guardrail from VISION roadmap

Agent-created agents (durable roster entries with provenance) are now
planned work, so the blanket VISION.md guardrail against agent-hierarchy
frameworks no longer reflects direction. The adjacent guardrail against
heavy duplicative orchestration layers stays.

* fix(gateway): preserve worker lifecycle failure reasons (#124774)

* fix(cli): explain empty directory lookups (#124753)

* fix(cli): explain empty directory lookups instead of printing nothing

* fix(cli): distinguish unsupported self lookups

* fix(codex): honor session node exec host (#124777)

* refactor(line): replace nine-marker prompt DSL with typed rich messages (#124755)

* refactor(line): replace nine-marker prompt DSL with typed rich messages

Delete the LINE plugin's double-bracket marker language (quick_replies,
location, confirm, buttons, media_player, event, agenda, device,
appletv_remote) and its parser. Portable interactions now flow through the
existing presentation-block seam (renderPresentation, matching Discord and
Feishu); LINE-specific cards ride closed channelData.line schemas mapped to
the existing Flex renderers. Prompt section shrinks to four capability
lines and explicitly de-fangs marker text. Removes the stale
assertion-safety baseline entry for the deleted parser.

Production LOC net -69, tests net -433. Suite: 510/510 green.

* fix(line): declare rich message schema dependency

* fix(line): satisfy rich message type checks

* docs(line): mark card fragments as partial

* feat(ui): surface approvals passively and redesign the approval card (#124767)

* feat(ui): surface approvals passively and redesign the approval card

Approvals no longer auto-open the centered modal: the queue is reachable
only through the sidebar attention chip, while the owning session shows
the inline card and other sessions surface via the session-row shield
icon, agent badges, and the chip. Deletes the inline-vs-modal exclusion
machinery (modalApprovalQueue, inlineApprovalId, forceShowAll) and makes
modal dismissal close the view instead of denying the active request.

Card: severity now drives the accent color instead of a table row,
plugin/agent render as header chips, the session key moves behind a
collapsed Details disclosure (modal only), and low-value exec rows
(Resolved/Security/Ask) collapse into the same disclosure. The codex
app-server bridge stops duplicating the session key into description
text; the envelope already carries it.

* fix(ui): gate settings Escape on the approval dialog's recorded open state

ClawSweeper caught that shouldIgnoreSettingsEscape still inferred an open
approval dialog from queue non-emptiness; with passive approvals a pending
queue no longer implies a visible dialog, so settings would swallow Escape.
The exec-approval element now records dialogOpen as a fact and the guard
reads it.

* refactor(channels): carry typed approval-prompt bindings through signal/imessage send seams (#124742)

The Signal and iMessage channel plugins inferred approval prompts by
regex-sniffing rendered message text (header matching like 'Exec approval
required', /approve command parsing), violating the transport-only channel
doctrine: approval actions must stay typed until channel encoding.

The typed envelope already existed (channelData.execApproval with
approvalId/approvalKind/allowedDecisions) and every payload-level delivery
path consumed it; the regex paths were redundant re-derivation at the raw
send seam plus restart recovery for in-memory iMessage poll state.

- Signal: delete send-level prompt sniffing entirely; all approval sends
  already flow through typed structured-payload or native-handler paths.
- iMessage: sendMessageIMessage takes a typed approvalPrompt binding
  (id/kind/decisions) from the native approval handler instead of an
  approvalKind flag plus text re-parsing.
- iMessage poller: persist pending poll targets in the plugin keyed store
  so restart recovery no longer regex-scans chat history; typed recent-chat
  discovery for handle-only DM targets stays. Split poll-target ownership
  into approval-reaction-poll-targets.ts (max-lines).
- Plugin SDK: remove extractApprovalReactionPromptBinding — beta-only
  surface, never in a stable release, so no deprecation window applies;
  AGENTS.md now records that rule.

Accepted tradeoff: approval prompts delivered by a pre-upgrade process are
not rediscovered from chat text after restart (<=24h transient state;
persisted reaction bindings and event-driven tapbacks still work).

* fix(ci): select aggregate QA evidence by manifest (#124802)

* docs: correct code mode runtime contract (#124792)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b7c-b9f0-73d5-8fb7-e619e8e458e1

Co-authored-by: Amp <[email protected]>

* fix(ci): invalidate extension boundary cache for attempt types (#124800)

* refactor(plugin-sdk): consolidate session catalog families (#124801)

* fix(memory): fail corrupted index commands (#124770)

* fix(memory): fail corrupted index commands

* fix(memory): preserve promotion output limit

* fix(memory): keep ranked promotion output

* feat(codex): name additional session-catalog homes (#124807)

* fix(state): copy-safe agent database registry via state-relative paths (schema v9) (#124728)

* fix(state): store in-root agent database registry paths relative to the state dir (schema v9)

Copied state directories retained stale absolute agent database registry rows. The combined gateway store then merged old and new copies, causing every sessions.list request to fail with SessionCanonicalKeyMigrationRequiredError.

Schema v9 stores in-root registry paths relative to the state directory; migration rewrites eligible rows, deletes stale duplicates, and preserves external paths.

* fix(voice-call): describe state-relative registry migration

* fix(state): preserve registry locator traversal

* test(macos): move PortGuardian schema-version boundary to v9

The store opens any state database up to maximumSupportedSchemaVersion,
which the schema v9 bump moved from 8 to 9. Shift the supported/newer
partition in the boundary test accordingly.

* fix(state): re-anchor copied default-layout registry rows instead of deleting them

Resolve the ClawSweeper P1 by preserving genuine external default-layout registrations, re-anchoring copied rows when an in-root counterpart exists, and deleting only dual default-layout conflicts.

* fix(upgrade): retain owners in legacy cron stores (#124809)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00a6a-b64e-74a5-8b15-2d3b966a468d

Co-authored-by: Amp <[email protected]>

* feat(tools): prompt proactive widget use (#124810)

* fix(ui): stop stale clients from acting connected (#124772)

* fix(ui): stop stale clients from acting connected

Carry reload metadata on terminal Control UI build rejections, render an explicit refresh-required recovery state, fence reconnect-only actions, and surface disconnected approval failures with accessible modal controls.

* fix(ui): preserve reconnecting session drafts

* fix(ui): preserve offline preference intent

* fix(ui): return owned fallback digest bytes

* test(ui): follow passive approval presentation

* fix(ui): distinguish stale builds from protocol mismatches

* style(ui): format gateway recovery phase

* refactor(validation): type producers and drop internal re-validation — pilot lane C (#124808)

* fix(cli): restart disabled installed services (#124786)

* refactor(agents): persist directive facts at the assistant write boundary (#124793)

* refactor(agents): persist directive facts at the assistant write boundary

Assistant final text is now stripped of inline delivery directives once, at
the SessionManager append boundary, with the parsed facts persisted as a
typed openclawDelivery field on the assistant message (openclawDeliveryMirror
precedent, inside event_json — no schema change). Live session state is
replaced with the persisted canonical bytes so same-run continuations and
next-turn store rebuilds never diverge (prompt-cache invariant).

Delivery and restart recovery consume the stored facts instead of re-parsing
persisted text; pre-upgrade in-flight messages without facts intentionally get
no text-parse fallback (commented tradeoff at the read site). Directive
parsing is now code-region aware, so markers quoted in inline code or fences
neither parse nor strip — fixes the empty-code-pill display bug.

The undocumented reaction marker DSL ([[react:]], [[react_to_current:]]) is
deleted; structured message-tool reactions remain the canonical path. Stale
assertion-safety baseline entry removed with the parser.

Production net -10, tests net +38. Focused suites: 9,068 passed; pre-fix
regressions fail for the intended reasons. Codex autoreview clean.

* fix(agents): satisfy directive persistence gates

* fix(config): drop unused directive export

* fix(agents): preserve indented directive examples

* perf(test): remove ClickClack scheduler waits (#124819)

* refactor: split max-lines pilot files and retire suppressions (#124813)

* fix(runners): align reclaim results with runtime (#124791)

* refactor(runners): prepare placement move targets

* fix(runners): preserve normalized dispatch targets

* style(protocol): format reclaim result type

* fix(ui): make light-theme diff syntax readable (#124814)

Co-authored-by: RoboClaw <[email protected]>

* fix(ci): render only aggregate QA evidence (#124823)

* fix(ui): show session changes in review panel (#124824)

* fix(gateway): stop closed clients from restoring session subscriptions (#124771)

* fix(gateway): reject closed session subscribers

* test(gateway): type subscription race params

* test(gateway): use public subscription assertion

* fix(ci): invalidate SDK declarations on attempt types

* chore(ci): align boundary cache comment with main

* fix(gateway): surface failed node event delivery (#124798)

* fix(gateway): surface failed node event delivery

* fix(plugin-sdk): preserve authored context cap

* fix(mcp): make Codex approval dead ends actionable (#124766)

* fix(mcp): make Codex approval dead ends actionable

* fix(mcp): preserve native approval fallback

* fix(mcp): configure saved approval modes

* fix(mcp): preserve saved Codex metadata

* style(mcp): simplify saved metadata spread

* improve(ui): one primary composer button, Enter-steer, Esc-stop, quiet mic, no transcript focus ring (#124799)

* fix(ui): drop the transcript keyboard-focus ring

The .chat-thread:focus-visible 2px inset outline (added in #120693) boxed
the entire main content whenever the transcript took keyboard focus
(Shift+Tab, closing transcript search) and read as a broken border that
stopped above the composer. The transcript stays keyboard-focusable for
scroll keys; it just paints no focus box. Accepted tradeoff: no visible
focus indicator on the scroll container.

* feat(ui): single primary composer button with Enter-steer and Esc-stop

The composer now renders exactly one primary action, always rightmost:
- draft or attachments present: one send-shaped button whose label follows
  the session follow-up mode (Send / Queue / Steer); the stop button no
  longer renders beside it
- empty while a run is active: Stop (tooltip "Stop (Esc)"); Escape in the
  composer aborts the run, deferring to reply-clear and menu precedence
- empty while idle: disabled send labeled "Write a message to send."

Enter on an empty composer while a run is active steers the oldest
steerable queued message — Enter queues, Enter again steers — using the
same eligibility predicate as the queue chip's Steer action (shared
steerableQueuedMessage helper). The mic/dictation control is now always a
compact secondary control left of the primary instead of morphing into
the primary when the composer is empty. Dead ChatRunControlsProps fields
(hasMessages, onExport, onNewSession, showPrimary, showSecondary) and the
composer exportMarkdown wrapper are removed; the assertion-safety
baseline entry for chat-composer.ts shrinks 8 -> 7.

* refactor(ui): quiet the idle composer mic

The idle mic was an accent-tinted two-segment pill (mic + permanently
visible device-picker chevron) that outweighed the primary action. It now
matches the attach button's ghost weight: transparent idle, subtle hover,
and the accent treatment is reserved for the recording and talk-active
states so the idle -> recording escalation reads stronger. The device
picker chevron collapses at idle and reveals on hover/focus-within (kept
always visible on coarse pointers, where dictation matters most; reveal
transition disabled under prefers-reduced-motion). The idle tooltip now
teaches the gesture split — "Tap to talk · Hold to dictate" — while the
aria-label stays "Start voice input".

* refactor(ui): split composer keydown and oversized composer test files

chat-composer.ts crossed the 700-line oxlint budget after the keyboard
additions; the keydown handling (menu routing, history keys, Escape-stop,
Enter steer/send) moves to chat-composer-keydown.ts behind a typed deps
factory. The composer unit tests split their primary-action/keyboard
coverage into chat-composer-actions.test.ts over a shared
chat-composer.test-support.ts, and the catalog/model-discovery e2e cases
move to chat-composer-catalog.e2e.test.ts. Pure moves, no behavior
change; no max-lines suppressions or baseline entries added.

* chore(ui): keep composer test-support ComposerProps internal

The split exported a type nothing imports; the dead-export scan is a
merge gate.

* fix(ui): narrow composer keydown target and adapt keyboard tab-order proof

The keydown split moved two bare textarea assertions into a zero-baseline
file; a single instanceof narrowing at the handler entry replaces both
(the handler only binds to the composer textarea). chat-composer.ts's own
assertion baseline ratchets 7 -> 5. The pointer-activation e2e now walks
the real post-redesign tab order (mic, focus-revealed picker trigger,
then primary send) instead of assuming one Tab.

* fix(ui): gate Enter-steer on the queue chip's visible availability

ClawSweeper P1: the Enter path only required an abortable run, so
offline Enter swallowed the keypress and invoked a steer lifecycle that
returns at !connected with no visible outcome, while the queue chip's
Steer button was correctly hidden behind connected && canCompose. The
keydown path now mirrors the chip's exact boundary (connected, canSend,
abortable, visible queue surface including sessionKey-less pending
rows).

* refactor(ui): align approval page with redesigned approval card (#124816)

* refactor(ui): align approval page with redesigned approval card

Follow up #124767 by carrying severity accents and identity chips onto the standalone approval page.

Remove the unused execApproval.labels severity, plugin, and agent keys.

* refactor(ui): keep approval-page helpers in repo idiom

Reverts drive-by rewrites from the build pass: restore the exhaustive
decisionLabel switch (the ternary lost the never check), the early-return
appliedDecisionMatches, explicit gatewayCode comparisons, and align the
severity mapping shape with the sibling exec-approval-card.ts.

* test(ui): type approval severity fixtures

* test(scripts): wait for a parseable descendant pid in Bun smoke cleanup

The readiness gate only required the descendant pid file to exist, but
existsSync can observe it between open() and write(); a loaded runner
then reads an empty file and the integer assertion flakes (seen on PR
#124816 CI run 31971191374). Readiness now requires parseable content.

* perf(webui): reuse the chat metadata catalog across pages (#124794)

* refactor(webui): centralize chat metadata caching

* test(webui): cover shared chat metadata store

* refactor(webui): move ChatMetadataResult type to its store owner

* fix(webui): let the metadata store own revalidation lifetime

* fix(webui): satisfy no-promise-executor-return in retry delay

* fix(browser): stop local actions when agent turns are cancelled (#124795)

* fix(browser): cancel local actions with agent signal

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

* fix(agent-harness): expose authored context cap

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

* chore(agent-harness): drop redundant context-cap override

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

---------

Co-authored-by: Amp <[email protected]>

* improve(ui): make chat disclosures compact (#124832)

Co-authored-by: RoboClaw <[email protected]>

* fix(gateway): share generated session titles with worktree names and start title work at dispatch (#124787)

Worktree sessions now derive their worktree/branch name from the same
concise generated title the sidebar shows (bounded 8s wait, raw-prompt
slug then crustacean fallback), persisted once as displayName so the
chat-send pass never duplicates the model call. Dashboard title
scheduling moves from the dispatch chain's finally (after the whole
first turn) back to dispatch start, so long or interrupted first turns
no longer leave sessions silently untitled (regression from #122471).
slugifyWorktreeTitle truncates at word boundaries; dead
generatedDisplayName plumbing removed.

* fix(browser): support Chrome Web Store native bootstrap (#124775)

* fix(browser): support Chrome Web Store native bootstrap

* chore: keep browser release note in PR body

* docs(browser): document Store identity trust boundary

* docs(browser): correct Store recovery guidance

* fix(media): bound image-optimize fetch headroom to the image cap (#124838)

When a caller passed an explicit maxBytes with optimizeImages on (the
default), the source-read bound was inflated to max(maxBytes, 100MB
document cap). A channel with a 5MB attachment cap therefore let a
hostile or oversized URL buffer up to 100MB before the final size check
— 20x resource amplification, and the inflation applied before content
classification, so it was not limited to images.

The inflation exists so oversized-but-compressible originals can be
fetched and compressed under the delivery cap. Size that headroom off
the thing that justifies it: 4x the 6MB image cap (24MB), enough for
large phone photos, instead of the document cap.

Accepted tradeoff (named at the constant): originals above 24MB that
would have compressed under the cap now fail; the fetch error names the
bound. Callers without an explicit cap keep per-kind defaults.

Live proof on a real localhost HTTP server (no mocked fetch): an 8.1MB
PNG under a 5MB cap compresses to 3.75MB and delivers; a 30MB-declared
image is rejected at the Content-Length precheck in 7ms with 'content
length 31457280 exceeds maxBytes 25165824'.

Regression: headroom-bound test fails pre-fix (30MB passes the old
100MB bound); companion test proves compression headroom still works.

* fix(channels): route direct DM replies to sender (#124837)

Default direct-message reply context to the authenticated sender address so targetless Reef and Nostr replies do not resolve to the local recipient.

* feat(auto-reply): record message-tool mute outcomes (#124830)

* feat(auto-reply): record message-tool mute outcomes

* fix(auto-reply): require source delivery evidence

* test(infra): preserve historical agent schema fixtures

* fix(agent): preserve implicit roster in configless exec (#124805)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b7c-b9f0-73d5-8fb7-e619e8e458e1

Co-authored-by: Amp <[email protected]>

* fix(delivery): unify terminal settlement ownership (#124825)

* fix(delivery): unify terminal settlement ownership

Treat identityless adapter returns as potentially visible across channel, queue, and cron paths. Let recovery own terminal completion so ambiguity persists as notice debt instead of being double-settled or silently suppressed.

Co-authored-by: ruel225 <[email protected]>

* refactor(delivery): narrow terminal internals

Remove now-unused internal exports after terminal-settlement ownership was consolidated.

* test(tts): preserve message runtime exports

Import and spread the actual message runtime so the focused mock retains every runtime binding while overriding only the durable send core.

---------

Co-authored-by: ruel225 <[email protected]>

* fix(ui): give queued-outbox badges their own outbox icon (#124842)

The sidebar queued-message badge and the composer queue reused the clock
glyph that also marks attached automations, so a session with both showed
two identical clocks distinguishable only by tooltip. Add an outbox tray
icon (Lucide inbox with the roof swapped for a rising arrow) and use it
for queued-to-send surfaces; the clock stays automation/cron-only. The
mock dev fixture now flags one session with hasAutomation so the badge
renders in mocked-dashboard proofs.

* refactor(plugin-sdk): extract stream and SecretRef primitives (#124835)

* refactor(ui): derive cron types from gateway protocol (#124827)

* refactor(ui): derive cron types from gateway protocol

* fix(protocol): preserve cron session target type

* fix(ui): keep sent images visible through history handoff (#124839)

* fix(memory): report indexed SQLite sessions (#124834)

* fix(memory): report indexed SQLite sessions

* refactor(memory): remove unused state path export

* refactor(validation): consolidate boundary guards into schemas (#124820)

* refactor(validation): consolidate boundary guards into schemas — pilot lane B

* fix(meetings): reject non-object browser status

* perf(test): remove Gmail watcher shutdown wait (#124851)

* refactor(types): discriminated unions for internal contracts — pilot lane A (#124845)

* refactor(slack): mark approval headers with typed block ids (#124841)

* feat(ui): add steer-now composer shortcut (#124826)

* fix(slack): drop the tool-call receipt from finished progress cards (#123851)

The Block Kit session card terminalized into a '🛠️ N tool calls · ⏱️ Ns'
footer, leaving a per-turn receipt in the Slack transcript on the default
progress path. PR #122976 deleted the same receipt from the native progress
surface but left this sibling rendering it.

Finished cards now keep only the durable diff stat and the session link;
tool-call and elapsed counters stay live working state. Also corrects the
documented channels.slack.streaming.mode default, stale since #122552.

* fix(agents): keep queued followups from missing post-compaction context (#124850)

* fix(auto-reply): order post-compaction context before followups

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

* test(auto-reply): clean compaction workspace fixture

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

---------

Co-authored-by: Amp <[email protected]>

* fix(test): propagate parent heavy-check ownership (#124859)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b7c-b9f0-73d5-8fb7-e619e8e458e1

Co-authored-by: Amp <[email protected]>

* fix(cli): emit one JSON failure contract for --json invocations (#124849)

* fix(cli): unify JSON failure output

* test(cli): update skills verify failure envelope

* fix(gateway): preserve prepared plugin metadata under load (#124844)

* fix(gateway): preserve prepared plugin metadata under load

* fix(gateway): project metadata before catalog preparation

* test(agents): assert projected startup metadata

* test(gateway): bind load probes to each finalization wave

* docs(ci): record artifact checkout experiment

* perf(test): reuse postpublish file-cap fixture (#124871)

* fix(protocol): model cron run delivery trace (#124856)

* fix(protocol): model cron run delivery trace

* chore(protocol): refresh generated cron run model

* test: replace assertion chains with typed fixture builders — wave 2 (#124865)

* refactor(security): consolidate path containment onto canonical fs-safe guard (#124870)

* refactor(security): expose canonical path containment modes

* refactor(agents): use canonical path containment guard

* refactor(security): consolidate core path containment sites

* refactor(plugins): consolidate path containment sites

* test(security): cover canonical path containment behavior

* fix(gateway): persist agent turns before acknowledgement (#124857)

* fix(gateway): persist agent turns before acknowledgement

* fix(gateway): revalidate exec approval handoffs

* docs(gateway): clarify durable session ownership

* fix(gateway): reject stale transcript admission targets

* fix(ui): show recovery when Control UI does not render (#124861)

* fix(ui): retire bootstrap fallback after render

* test(ui): avoid returning from Promise executor

* fix(qa): recover repeated gateway restarts through channel ingress (#124746)

* fix(qa): repair repeated gateway restart recovery

* test(qa): satisfy restart recovery checks

* fix(audit): rekey repeated recovery identity

* fix(plugin-sdk): expose authored context cap

* test(android): synchronize process tree readiness

* fix(ui): restore task count badge (#124840)

* fix(ui): align update status card spacing (#124878)

* fix(browser): cancel node discovery with tool runs (#124880)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

Co-authored-by: Amp <[email protected]>

* perf(webui): render cached model catalog while the chat pane refreshes (#124868)

* perf(webui): render cached model catalog while the chat pane refreshes

* test(webui): fix seed-test types and shrink assertion baseline

* fix(state): report v9 registry migration row decisions (#124862)

* fix(state): report v9 registry migration row decisions in doctor and logs

* fix(state): consume registry migration summary type

* fix(state): avoid registry path observer import cycle

* fix(workboard): include actual length in bounded-string error

The shared normalizeBoundedString helper in extensions/workboard/src
threw an opaque error like 'comment body must be 2000 characters or
fewer.' whenever an oversize string hit any bounded field. Agents that
posted a long run summary or oversized link URL had no way to tell
how far over the limit they were, so they could not retry with a
trimmed payload.

Include the actual length in the error so the message tells the agent
exactly what to do next:

  comment body must be 2000 characters or fewer (got 3502).

The format applies uniformly to every bounded field routed through
this helper (labels, link URL, link title, link target, comment
body, title, notes, worker log message, session key, run id,
protocol violation detail, etc.) since the helper is the single
canonical owner of the message.

Cover the new format with a focused unit test that pins the regex
for the comment-body repro from #118845 and exercises the six other
bounded fields listed in the issue. Update the existing
gateway.test.ts assertion to allow both the old and new format so
the format change is a forward-compatible improvement.

* test(workboard): align matrix with real normalizeBoundedString consumers

ClawSweeper flagged that the prior matrix at line 31-48 tested
labels/title/notes by manually invoking normalizeBoundedString, even
though those fields use the independent normalizeTitle, normalizeNotes,
and normalizeLabels functions (each with its own generic message).
A regression that drops the (got N) suffix from normalizeBoundedString
would not be caught for those three surfaces — operators would still
see the old opaque error.

This commit narrows the matrix to only the consumers of the shared
helper (comment body, link title, link target, link URL, card id) and
restores the exact labels gateway assertion that should match the
unchanged normalizeLabels error.

Verification: 9/9 inline Node 18 AST harness (node /tmp/verify-pr-118888-v77.mjs);
parent-commit proof-gate (pre-PR helper without the got suffix) fails
4/9 of the post-fix expected messages.

Closes ClawSweeper review on PR #118888 (P2 + P3).

* test: cover Workboard length errors at gateway boundary

* docs: note length-aware Workboard errors (#118888)

* perf(ci): split Windows CI two ways instead of one serial lane

`checks-windows-node-test` ran the whole 222-266s Windows body in a single
Blacksmith lane, so every run that scheduled it finished at 287-334s against a
~180s plateau. Measured across 45 canonical main runs it was the wall in all
seven runs that triggered it (324-519s vs a 210s median elsewhere).

Blacksmith's Windows class admits exactly 2 concurrent jobs (run 31865243804),
which is why the earlier 3-part split failed: its tail queued 211s behind a
finished part. Pin the split width to that measured capacity instead. The two
parts are balanced by measured per-project wall time -- part 1 keeps the old
list 1 plus list 2's non-infra projects (~108s), part 2 takes list 2's infra
project plus the old list 3 (~112s) -- so both land near 113s and the lane
stops setting the wall.

One canonical partition now serves every backend; the github-mode/dispatch
3-part variant and its separate file inventory are gone, along with the
single-lane `task: test` case and the per-row `matrix.runner` the collapsed
lane needed. The complete 65-file Windows inventory is preserved exactly, and
the guards pin the width on both sides (mutation-checked: restoring 3 parts
fails the matrix guard).

* fix: stop forked commands after Gateway timeouts (#124081)

* fix: stop service child trees before timeout completion

* fix: preserve service child root results during cleanup

* test: isolate relay selection from linux spawn wrapping

* refactor: keep service anchor payload internal

* test: validate lifecycle probe pid output

* fix: close service child adversarial races

* fix: preserve service startup failures

* fix(process): flush service output before root result

* fix(process): bound cleanup on held output

* chore(process): satisfy promise executor lint

* fix(process): finish cleanup after lineage loss

* fix(process): retain relay output before subscription

* fix(ci): register service child runtime entries

* fix(ci): expose relay safety invariants

* fix(process): preserve service cancellation grace

* test(process): prove service grace on macOS

* fix: prevent clipped session selections and Code Mode timer crashes (#124879)

* fix(agents): support timers in code mode

* fix(ui): keep selected sessions clear of scrollbars

* fix(agents): propagate timer cancellation after resume

---------

Co-authored-by: RoboClaw <[email protected]>

* fix(ui): reveal clipped session history (#124866)

* fix(ui): reveal clipped session history

Show a persistent earlier-history action for paginated sessions and reveal loaded content without chaining observer fetches.

Related: #110771

* refactor(ui): split chat history support

* fix(cli): keep internal error causes out of operator output (#124887)

* fix(skills): expand explicit references on agent turns (#124784)

* fix(skills): expand explicit references on agent turns

Route generic Gateway, CLI, webhook, and local agent turns through the same explicit skill-reference renderer as channel auto-replies. Keep original transcript text, preserve unknown slash behavior, and fail visibly for allowlist-hidden skills.

Maintainer review: scoped Option 1 — generic agent turns expand both $skill-name and leading /skill-name args through shared skill rendering; they do not run the channel command dispatcher, and all other slash commands retain their existing behavior.

* fix(skills): bound explicit reference prompts

* fix(skills): prefer allowed reference collisions

* fix(skills): preserve command invocation boundaries

* fix(skills): reject hidden channel slash commands

* perf(skills): skip literal dollar discovery

* fix(ui): replace the broken terminal tab underline (#124875)

* fix(ui): redesign dock panel tabs

* fix(ui): remove stale terminal tab overrides

---------

Co-authored-by: RoboClaw <[email protected]>

* fix(tui): close selection overlays and report rejected handlers (#124876)

openSelector's onSelect fired the async handler with void and only
closed the overlay after a successful await. A rejecting handler (e.g.
setAgent -> setSession against a failing gateway) left the selector
stranded open with an unhandled rejection: the TUI froze on the picker
with no visible cause — a silent dead-end.

Root cause: failure path missing from the overlay lifecycle. The
handler now catches, surfaces the cause via chatLog, and always closes
the overlay.

Regression: /agent selection with a rejecting setSession asserts the
overlay closes and the cause reaches the chat log — fails pre-fix.

* fix(ui): make terminal open failures retryable (#124890)

* fix(sandbox): surface list probe failures instead of empty results (#124881)

sandboxListCommand and fetchAndFilterContainers swallowed backend and
registry probe failures with catch(() => []). A broken Docker daemon or
corrupt registry rendered as 'No sandbox runtimes found.' — and in
recreate, filtered an entire fleet down to nothing — indistinguishable
from a clean empty state. --json emitted a success envelope for a
failed probe.

Root cause: failure collapsed into the empty success shape at the
consumer. The listers now propagate; the sandbox CLI runner already
owns the error path (message + exit 1), and the new --json failure
contract (6c66f48a7c1) emits the JSON error envelope.

Regression: replaced the test that enshrined the masking ('handle
errors gracefully' asserting the empty-state message) with the
propagation contract — fails pre-fix.

* fix(tui): report the first last-session write failure (#124886)

* fix(tui): report the first last-session write failure

rememberCurrentSessionKey swallowed writeTuiLastSessionKey failures
with catch(() => undefined). A corrupt or locked state DB silently
disabled session restore: the operator only discovers it on next
launch, landing in the wrong session with no clue why.

Root cause: fire-and-forget with no recorded failure. The write wrapper
moved to its owner (tui-last-session.ts) as
createRememberSessionKeyWriter, which surfaces the first failure via
the chat log ('session memory write failed: ...') and stays silent on
repeats — one line per TUI run, not one per session switch. Empty and
'unknown' keys still skip without touching the writer.

Regression: colocated tests prove first-failure-once reporting and the
skip path — fail pre-fix (factory did not exist; failure was
swallowed at the call site).

* chore(tui): make the last-session write dependency explicit

deadcode:exports rejects writeTuiLastSessionKey as unused when only the
factory default referenced it; tui.ts now passes it explicitly.

* fix: remove delivery markers from historical sessions (#124888)

* fix(sessions): migrate historical transcript directives

* fix(infra): complete directive migration on pre-archives-schema databases

session_transcript_archives is a lazy additive v17 surface; valid databases
may omit it. The archives phase now treats the missing table as empty and
completes the cursor instead of warning-skipping the whole database forever.
Verified against a real long-lived agent DB: previously stuck cursor
completes with zero warnings in ~100ms.

* chore(ci): allow directive migration SQLite access

* fix(sessions): report self-archive before stopping the turn (#124896)

* feat(agents): record agent creation provenance and add roster tree listing (#124828)

Adds an additive agent_provenance table (shared state DB, schema v8) owned
by src/state/agent-provenance.ts. createAgent() records operator/agent
provenance after commit, the system-agent create-agent operation passes its
own id as creator, and Claw installs record created-via claw at their roster
commit point. Agent deletion removes the agent's own row inside the deletion
journal transaction; children keep dangling creator ids as historical fact.
openclaw agents list gains --tree (provenance hierarchy) and JSON provenance
fields.

* fix(ui): keep message presentation stable when expanded (#124898)

* fix(gateway): stop a plugin dangerous flag from revoking desktop computer.act (#124863)

* fix(gateway): stop a plugin dangerous flag from revoking desktop computer.act

`resolveNodeCommandAllowlistInternal` subtracted every plugin-declared
dangerous command from the composed allowlist, including core's own
`PLATFORM_DEFAULTS` entries and including the pairing allowlist, where core's
dangerous defaults are exempted. `computer.act` is both a desktop platform
default (grant = node-local enablement + pairing approval) and a command that
`registerComputerUseProvider` marks dangerous. Since `cua-computer` became
enabled-by-default on darwin, every macOS-hosted Gateway stripped `computer.act`
from both allowlists, so `normalizeDeclaredNodeCommands` dropped it from the
node's declaration with no pairing upgrade, no prompt, and no record. The
`computer` capability survived because caps were never allowlist-filtered, and
the `computerUse` descriptor was then dropped for the missing command.

Scope the plugin-dangerous subtraction to commands outside the platform-default
base: the flag still keeps a plugin's own surface behind an explicit allow and
still forces a registered invoke policy, but it no longer revokes a command core
declares itself.

Also make cap-without-command unrepresentable. `retainFulfilledNodeCapabilities`
drops a capability when policy withheld commands from its family and admitted
none, and the reconciler records the withheld commands so a refused declaration
is never silent.

* test(gateway): type the computer-use fixture against its contract

* fix(doctor): partition retired session stores (#124846)

Recover owner-qualified rows from the retired top-level session store into each configured agent database without guessing ambiguous ownership. Relocate stale transcript paths, tolerate historical Unicode IDs when an explicit transcript exists, and avoid double-counting physical SQLite databases in migration totals.


Amp-Thread-ID: https://ampcode.com/threads/T-01a00a6a-b64e-74a5-8b15-2d3b966a468d

Co-authored-by: Amp <[email protected]>
Co-authored-by: Josh Lehman <[email protected]>

* perf(ci): price agents-core-models from its measured hybrid wall

`agentic-agents-core-models` carried the 36s scaled estimate while measuring
56.3s (n=6, p90 58.6s) across 260 compact jobs on 2026-08-16. Packed beside
`agentic-agents-core-runtime-hosted-1` (60.4s) it built the only bin running
>=1.25x its prediction: compact-large-19 ran 122s of work priced at 88s, which
made it the most frequent slowest job in the workflow.

Add the measured value to the hybrid hint map, which already exists for exactly
these Blacksmith-specific observations. The packer then separates the two, and
the tallest actual compact bin drops 122s -> 109s with no bin above 1.25x and
no change to row counts (48 push / 56 pull-request), so this costs no extra
runner registrations.

Two things deliberately left alone. The `agentic-gateway-core-3` 140s pin looks
like a 2x over-prediction against its 68.5s median, but run 31938297538 really
did take 138.0s (109.03s + 28.98s across its two configs) on a run whose fleet
slowdown factor was 0.98 -- a genuine tail on a healthy run, so unpinning it
would rebuild a >200s bin whenever the tail lands. Every other bin already sits
within 1.24x of its prediction.

The replaced guard pinned one bin arrangement (`runtime-hosted-1` not sharing a
job with `agents-core-tools`) with no stated failure mode, so any honest refit
broke it. It now asserts the property that comment was reaching for -- both
weight sources survive rebalancing under the body ceiling -- plus the specific
regression this fixes. Mutation-checked: dropping the hint fails the new guard.

Measurement note for the next refit: sum a shard's per-config Duration lines
before taking a median. Pooling them reads as a large over-prediction that is
not there.

* fix(codex): prevent app-server leaks after desktop fallback (#124885)

* fix(codex): reuse app server after managed fallback

* test(codex): opt relay fixtures into loop detection

* fix(ui): add spacing between suggested task actions (#124900)

* fix(ui): separate suggested task card actions

* test(ui): keep task suggestion spacing check lint-safe

* fix(ui): drop duplicate plan card summary (#124895)

* fix(backup): give backup create actionable output errors (#124894)

* fix(backup): give backup create actionable output errors

* fix(backup): preserve output errors for debug

* fix(test): create sessions in default Control UI mock (#124912)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

Co-authored-by: Amp <[email protected]>

* fix(plugins): adopt root context engines on caller-owned handles (#122457)

Keep caller-owned agent runtime registries in discovery mode so full-only
plugins cannot replace process-global sandbox backends. Copy runtime
context-engine factories from the composition-root registry instead.

Co-authored-by: Josh Lehman <[email protected]>

* docs(codex): clarify loop relay behavior (#124918)

* fix(gateway): terminalize stale worker dispatches (#124920)

* refactor(ui): simplify chat history pagination (#124921)

* test(gateway): make archive lifecycle waits deterministic (#124923)

* fix(android): remove completed plan strikethrough (#124916)

* fix(plugins): restore caller-owned workspace plugin-root projection

#124844 made resolvePluginMetadataSnapshot synthesize workspacePluginRootPresent
itself with a process-memoized fs.existsSync probe whenever a caller did not
supply it. That fact is owned by the prepared-model-runtime lease, which resolves
it only for real agent runs (resolveWorkspacePluginRootPresence) and passes it
explicitly, so the probe silently turned an opt-in fast path into the default for
unrelated control-plane callers.

Gateway startup config validation is one of them. It never asserts the fact, so it
began projecting the published lifecycle graph instead of loading a fresh one, and
the projection derives configFingerprint from that graph rather than a real load.
Startup convergence rewrites the persisted plugin index between the two reads that
form the migration checkpoint identity, so the pre-convergence read projected while
the post-convergence read loaded. The two pluginMigrationFingerprint values differed
and the gateway refused readiness with "OpenClaw plugin migration inputs changed
during startup convergence", failing every config-patch restart.

Deleting the probe restores one owner for the fact and a net-negative production
diff. The agent-side hunks of #124844 are untouched: they still pass the fact
explicitly from the lease.

Root cause: admission fact manufactured outside its lifecycle owner.
Owner boundary: src/agents/prepared-model-runtime-lease.ts owns workspace
plugin-root presence; src/plugins/plugin-metadata-snapshot.ts only consumes it.
Production LOC: -18.

Fixes red main ci-gate: QA Smoke memory-dreaming-sweep, matrix-restart-resume,
matrix-post-restart-room-continue.

* fix(doctor): preserve migrated session owner (#124928)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00a6a-b64e-74a5-8b15-2d3b966a468d

Co-authored-by: Amp <[email protected]>

* refactor(webui): read slash commands through the chat metadata store (#124931)

* fix(doctor): stop reporting phantom shared auth migrations (#124929)

* fix(cron): stop advertising inactive JSON defaults (#124903)

* fix(cron): make --json help match behavior

* fix(cron): preserve scratch write JSON output

* test(cli): classify cron JSON result commands

* fix(ui): remove dashboard card text underlines (#124939)

* fix(agents): refuse add when prompts cannot run (#124940)

* test(ui): assert steer order by rendered position (#124905)

* fix(plugins): keep migration metadata authoritative (#124924)

Restrict exact config identity trust to prepared runtime generations and force startup convergence to verify against a fresh authoritative plugin snapshot.

* test(mistral): wait on delivered transcripts after reconnect (#124935)

* test(mistral): wait on delivered transcripts after reconnect

* test(nvidia): assert the remaining catalog fetch budget as a bound

* fix(cli): show actionable guidance for mistyped commands (#124892)

* fix(cli): render unknown commands as guidance

* fix(cli): keep parse JSON terminal-neutral

* refactor(sdk): source wire models from gateway-protocol schemas (#124943)

* test(ui): split chat follow-up E2E suite (#124938)

* fix: honor provider timeouts during stuck-session recovery (#123877)

* fix(diagnostics): respect active model request timeouts

* chore(diagnostics): keep recovery activity internal

* test(diagnostics): await stream wrapper results

* fix(diagnostics): harden provider timeout recovery

* fix(diagnostics): track compaction model calls

* test: prove provider timeout recovery boundary

* fix(config): reject scalar config roots instead of loading defaults (#124945)

A config file whose JSON5 root parsed to a scalar (null, a number, a
bare string — the classic truncated/clobbered file) hit a special case
in loadConfigFromContext that returned {} with a snapshot marked
valid: true. Three failures in one: the process silently ran with
defaults while the operator's real config (channels, auth, allowlists)
disappeared; the valid snapshot could promote the corrupt file's
fingerprint as lastKnownGood, poisoning the clobber-recovery machinery
that exists to catch exactly this; and the load path contradicted the
snapshot path, which correctly reported the same bytes invalid.

Root cause: an early-return that collapsed invalid input into the
empty-config success shape. Deleted; a scalar root now flows into
validateConfigObjectWithPlugins, fails schema validation, records a
valid:false snapshot, and throws INVALID_CONFIG — same as an array
root, same as the snapshot path, handled by doctor's invalid-config
recovery.

Regression: new io.scalar-root.test.ts (null/number/string roots all
throw INVALID_CONFIG; snapshot agrees invalid) — all 3 fail pre-fix.
Updated the compat warning-fingerprint test that relied on null-root
loading as defaults.

* fix(security): prevent approved scripts from changing before execution (#124858)

* fix(security): bind exec approvals to mutable operands

* test: align approval fixtures with operand binding

* fix(security): close durable operand binding gaps

* fix(security): preserve independent exec policy grants

* improve(ui): simplify widget preview chrome (#124883)

Co-authored-by: RoboClaw <[email protected]>

* fix: deliver requested image artifacts across agent runtimes (#124910)

* fix: distinguish image inspection from delivery

Clarify that image-reading tools only load private model context, prefer native Codex image inspection when available, and preserve explicit outbound tool media across Claude CLI loopback runs.

Co-authored-by: pash <[email protected]>

* fix: propagate CLI vision capability

* chore: refresh CI after main fix

---------

Co-authored-by: pash <[email protected]>

* fix(ci): derive plugin SDK boundary cache inputs (#124897)

* feat: add cloud worker profiles and machine selection (#124864)

* feat(workers): add per-dispatch machine classes

* feat(ui): add cloud worker machine picker

* feat(tts): add structured reply speech fields (#124913)

* feat(tts): add structured reply speech fields

* fix(tts): keep transcript directive parser acyclic

* fix(tts): drop unused directive fact export

* fix(outbound): preserve reply-payload metadata through response prefixes

The response-prefix rebuild spread the payload without its metadata carrier,
dropping structured speech facts (and any other payload metadata) whenever a
channel responsePrefix applied. Rebuild via copyReplyPayloadMetadata.

* fix(tts): keep voice-only sends visible when the speech runtime is cold

A structured voiceText-only send with no visible text returned unchanged from
the cold-runtime guard, so delivery normalized the empty payload to null and
the send silently vanished. The cold exit now applies the same visible
fallback as synthesis failure: explicit spoken text materializes as payload
text when no other content exists.

* fix(qa): isolate capture store startup (#124949)

* refactor(channels): align approval reaction bindings (#124942)

Split Signal approval routing into its concept-owned module and call the shared SDK binding helpers directly.

Reject persisted reaction targets when any allowed decision is invalid or duplicated, rather than retaining a valid subset from a corrupt transient record.

* docs(agents): harden live-test and capture-inspection requirements

Live verification of user-facing behavior is the default before landing,
with skips requiring a stated infeasibility in the PR; captured
screenshots/videos count as evidence only after the agent inspects them
in frame.

* refactor(ui): define sidebar panel contract (#124950)

* improve(ui): move session status to second row (#124960)

* improve(ui): move session status to second row

* test(ui): align session row layout expectations

---------

Co-authored-by: RoboClaw <[email protected]>

* docs: clarify model switching guidance (#124889)

* docs: clarify model switching guidance

* docs: warn that reasoning changes invalidate cache reuse

---------

Co-authored-by: RoboClaw <[email protected]>

* fix(ui): stop duplicate dashboard session queries (#124968)

* fix(doctor): surface legacy-config copy failures (#124948)

* fix(doctor): surface legacy-config copy failures

maybeMigrateLegacyConfig swallowed every copyFile error with a bare
catch whose comment claimed EEXIST-only. EACCES, ENOSPC, and
cross-device failures were silently ignored: the operator's
~/.clawdbot/clawdbot.json exists, migration was attempted and failed,
and doctor proceeded as a clean fresh install with no config, no change
note, and no warning.

Root cause: failure collapsed into the skip-silently success shape. The
catch now rethrows anything other than EEXIST with the source/target
paths in the message; EEXIST (config already at the target) keeps its
skip semantics.

Regression: read-only target dir makes the preflight reject with
'Failed to migrate legacy config' — fails pre-fix (resolved as a clean
run); companion test proves the successful copy path still migrates.

* chore(doctor): annotate the errno assertion for the safety ratchet

* refactor(doctor): narrow the copy error without a type assertion

The assertion-safety ratchet flagged the errno cast; property narrowing
removes the assertion instead of annotating it.

* fix(android): show plan status and explanation (#124958)

* fix: scale Gateway RSS diagnostics to runtime limits (#124914)

* fix(logging): scale RSS pressure to runtime limits

Derive Gateway RSS warning and critical thresholds from the smaller of the effective V8 heap and OS process limit. This preserves heap and rapid-growth pressure detection while avoiding routine false alerts on large heaps.

* test(logging): narrow optional heap fixture

* fix(logging): bound process memory sentinels

* test(logging): pin Bun physical memory fixture

* refactor(channels): delete the per-turn progress receipt line (#124972)

The finished-turn digest ('🧠 N thoughts · 💬 N notes · 🛠️ N tool calls ·
⏱️ Ns') was synthesized onto three surfaces: Slack's Block Kit card footer
(removed in #123851), Discord's final-answer subtext, and a duplicate Telegram
implementation added to match Discord.

Nothing gated it — no config key for the receipt has ever existed on any
channel — so PR #122976, which deleted it from Slack's native progress surface,
could only ever be a partial removal. Finish it: live progress surfaces keep
their in-flight indicators, and a finished turn leaves the answer with nothing
synthesized appended.

Telegram's window collapsed *into* the digest, so it now retires like every
other surface; Discord already discarded its draft after the final landed. The
core tracker keeps only the live counters Slack's working footer reads.

* feat(agents): preserve create request provenance (#124963)

* refactor(types): discriminated unions for internal contracts — wave 2 (#124959)

* fix(gateway): surface blocking startup progress (#124309)

Keep Gateway admission sidecar-gated while surfacing retryable startup progress in TUI and Control UI.

Unify deferred startup ownership and shutdown draining so late workers, plugin services, and sidecars cannot outlive transport teardown.

Co-authored-by: RoboClaw <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>

* test(node-host): own proxy tunnel lifecycle

* fix(codex): preserve resumed session usage (#124969)

* fix(doctor): report malformed final JSONL records (#124977)

Co-authored-by: Amp <[email protected]>

* feat(agents): show creation hierarchy in Control UI (#124967)

* feat(agents): show creation hierarchy in Control UI

* chore(protocol): regenerate Swift agent model

* refactor: consolidate record guards (#124970)

* fix: plugin tools disappear from Codex and restricted profiles (#124947)

* fix(memory): make standing intents reachable

* fix(agents): dedupe macOS read path variants

* docs(plugins): document profile tool metadata

* test(codex): complete prepared runtime fixtures

* fix(agents): preserve prepared tool boundaries

* fix(cli): prevent node/device RPCs from corrupting shared state (#123674)

* fix(cli): prevent node/device RPCs from corrupting shared state

* fix(cli): keep gateway RPC transport state read-only

* fix(cli): preserve doctor lint config isolation

* fix(cli): keep gateway RPC transport state read-only

* fix(gateway): keep auth preflight state read-only

* fix(cli): preserve SQLite artifacts in read-only RPCs

* fix(infra): remove stale identity store import

---------

Co-authored-by: VACInc <[email protected]>
Co-authored-by: Patrick Erichsen <[email protected]>

* fix(codex): reject malformed native tool arguments (#124649)

* fix(codex): reject invalid native tool arguments

* fix(codex): preserve raw argument preparation

Signed-off-by: sallyom <[email protected]>

---------

Signed-off-by: sallyom <[email protected]>
Co-authored-by: sallyom <[email protected]>

* feat: main-session agent-wide visibility + session.groupScope routing (#124965)

* feat: add main session group routing

* docs: explain main session routing scopes

* fix: align memory session visibility

* test(qa): cover main-scoped group bindings

* fix(sessions): preserve binding-scoped outbound routes

* fix(routing): preserve explicit outbound owners

* fix(sessions): recognize global main visibility

* chore(ci): prune assertion safety baseline

* fix(installer): finalize deferred PATH installs successfully (#124678)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00ae0-190d-718b-8a76-b75f3e8d1fae

Co-authored-by: Amp <[email protected]>

* fix(cli): align agent exec with system owner (#124697)

* fix(onboard): run channel hooks after config commit (#124736)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00ae0-190d-718b-8a76-b75f3e8d1fae

Co-authored-by: Amp <[email protected]>

* fix(ui): hide mobile transcript metadata until tap (#124936)

* fix(ui): reveal mobile message metadata on tap

* fix(ui): centralize mobile transcript disclosure

Co-authored-by: Vyctor H. Brzezowski <[email protected]>

---------

Co-authored-by: RoboClaw <[email protected]…
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
* fix: keep device identity reads lock-free

Amp-Thread-ID: https://ampcode.com/threads/T-01a00ae0-190d-718b-8a76-b75f3e8d1fae

* feat(lint): enforce import ordering and deduplication (#124730)

* refactor(imports): dedupe and hoist imports

* feat(lint): enforce import/no-duplicates and import/first

* feat(voice-call): sessionScope "main" routes calls into the agent main session (#124708)

* feat(voice-call): add sessionScope "main" for main-session call routing

Inbound and outbound calls can now share the configured agent's main
session instead of a dedicated voice session. The new scope resolves
through the existing explicit-key canonicalization path, honoring core
session.mainKey and global-scope aliasing. The inbound webhook path now
forwards coreSession like every other resolver call site.

* style: format events.test.ts

* test(voice-call): split events.test.ts under the max-lines cap

* fix(cli): forward agent name through setup (#124740)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

Co-authored-by: Amp <[email protected]>

* refactor(mcp): centralize tool filter policy (#124739)

* fix(agents): preserve restart-unsafe delivery evidence (#124737)

* fix(ci): snapshot synced Testbox candidates (#124743)

Co-authored-by: Amp <[email protected]>

* fix(ci): keep QA evidence output repo-relative (#124760)

* fix(cli): allow hook toggles to select an agent (#124761)

* test(upgrade): drop retired agent context assertion (#124765)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00a6a-b64e-74a5-8b15-2d3b966a468d

Co-authored-by: Amp <[email protected]>

* fix(skills): report missing ClawHub skills as not found (#124764)

* feat(codex): show sessions from additional homes (#124660)

* feat(codex): register additional session homes

* fix(codex): preserve automatic session homes

* docs(codex): explain automatic home discovery around sessionCatalog.homes

---------

Co-authored-by: IWhatsskill <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>

* fix(qa): preserve effective fast mode (#124762)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

Co-authored-by: Amp <[email protected]>

* fix(ui): keep Control UI device identity working on plain-HTTP origins (#124724)

* fix(ui): keep Control UI device identity working on plain-HTTP origins

@noble/ed25519 defaults its SHA-512 provider to crypto.subtle, which
browsers gate to secure contexts, so device identity silently vanished
on http:// LAN dashboards and connects fell back to shared-credential
auth with no pairing. Wire a lazy pure-JS @noble/hashes fallback for
SHA-512 and the fingerprint SHA-256, and drop the isSecureContext gate
in the connect path. Secure contexts keep the platform digests and pay
no startup bytes: the fallback loads as its own lazy chunk, kept out of
the gateway-runtime startup chunk on purpose.

* test(ui): cover device identity minting and signing without crypto.subtle

New jsdom regression suite fails on pre-fix code (subtle-less crypto stub
with getRandomValues, which real insecure contexts keep). Rewrites the
gateway connect tests that previously asserted the device-less insecure
fallback: an insecure context now attaches a device identity.

* docs(web): plain-HTTP dashboards now pair with a device identity

The signing key never crosses the wire, so HTTP+pairing is strictly
stronger than the old HTTP token-only fallback; HTTPS (Tailscale Serve)
stays the recommendation for transport privacy.

* fix(ui): drop unnecessary boolean literal compare in secure-context timing meta

* test(ui): declare device.id on the connect-frame test shape

* test(ui): split the subtle-less scope-upgrade e2e into the two real invariants

Without crypto.subtle the browser can now sign, so the banner offers the
explicit admin upgrade; manual-only guidance is reserved for browsers that
cannot mint an identity at all (no WebCrypto RNG). Also corrects the
connect-path comment: blocked storage yields an ephemeral identity, only a
failed mint degrades device-less.

* fix(ui): address review findings on the HTTP device-identity path

- Storage-blocked pages keep one stable in-memory identity per page
  lifetime instead of minting a fresh unpaired key on every reconnect,
  and a write-rejecting store no longer fails the mint (regression tests
  bite pre-fix).
- Connect timing now reports the real browser secure-context fact via a
  shared browserSecureContext() helper instead of inferring it from
  device-identity presence.
- Docs state the accepted trusted-proxy contract: browsers attach a
  device identity on every origin, so first connects follow the standard
  pairing flow (deviceAutoApprove or a one-time approval); device-less
  admission remains only for browsers that cannot mint an identity.

* refactor(ui): trim the connect-path additions under the max-lines cap

* fix(line): retry lost pushes without duplicating an accepted send (#124464)

A LINE push made exactly one attempt, so a transient provider or transport
failure dropped the reply even though retrying was safe to do. Retrying alone
would have duplicated a send LINE already accepted, so every push now carries an
X-Line-Retry-Key and reuses it across attempts: LINE answers a replayed key with
409 and the accepted request's sent messages, which resolves to the original
delivery instead of a second message.

Retries follow LINE's documented policy - server errors and transport failures
only, never 2xx, 409 or any 4xx - and run through the shared channel API retry
runner in strict mode. Replies stay single-attempt because LINE offers no retry
key for them.

* fix(outbound): record queue-write loss and fail every payload on prep abort (#124756)

* fix(outbound): record queue-write loss and fail every payload on prep abort

Two silent-observer gaps in the outbound queue admission path:

1. Best-effort staging/queue-write failures were swallowed with a bare
   'return null'. The send proceeded live-only, so a crash mid-send lost
   the message with zero forensic trace of why the write-ahead row was
   missing. Every sibling degradation on this boundary logs
   (persistQueuedPreSendState, the dispatch-refresh fallback); this one
   now warns with channel/target and the error.

2. Batch preparation failure emitted message_sent for only the first
   payload while audit emitted per-payload terminals, so plugins with
   message_sent hooks saw 1 failure for an N-payload batch. The failure
   path now emits one hook failure per logical payload, matching the
   audit terminals and the recovery sibling's
   queuedTerminalFailureEvents. The unused error.payload pick and its
   OutboundPayloadPreparationError import went with it.

Regressions: queue-write warn asserted in the existing best-effort
fallback test; new multi-payload prep-failure test asserts 2 hook
failures. Both fail pre-fix.

* chore(outbound): keep OutboundPayloadPreparationError module-local

Last external consumer went away with the per-payload emit; the
deadcode:exports gate rejects unused exports.

* refactor(gateway): drop dead session-subscriber registry surface (#124754)

* refactor(gateway): drop dead session-subscriber registry surface

getForConnection and both registry clear() methods had no production
callers — only server-chat-state.test.ts consumed them (verified by
repo-wide grep incl. plugin-sdk). The recency-sorted connToSessionKeys
index existed solely so getForConnection returned keys in subscription
order, an ordering nothing read, rebuilt via toSorted() on every
subscribe/unsubscribe/settle — including the provisional-replay settle
path.

unsubscribeAll now reads the reverse index directly from
connToSessionRecency's keys (same contents, no ordering), removing the
per-call O(k log k) rebuild and the duplicate map. Tests assert through
get()/getApprovals(), the production read paths, per test-audit norms.

Behavior-neutral: subscription state transitions and event-visible
delivery unchanged; chat-state, broadcast, node-subscription,
instance-runtime, agent-events, session-events suites pass.

* test(gateway): fix ETXTBSY flake in workspace-sync candidate bounding

The test rewrote its mock git script between two createGitTransferList
calls. On Linux CI the second spawn can race a lingering fork of the
first child still holding the script's write fd, failing exec with
ETXTBSY. Write the script once; vary the entry count through a data file
the script reads instead.

* fix(config): preserve migration notice paths (#124719)

* fix(runners): preserve device sessions through lifecycle faults (#124744)

* test(runners): cover paired-node lifecycle wire

* fix(runners): preserve retryable device lifecycle

* test(runners): keep wire fixture internals local

* fix(runners): stop fallback on device capacity

* fix(doctor): keep identity probe within typed storage APIs

Amp-Thread-ID: https://ampcode.com/threads/T-01a00ae0-190d-718b-8a76-b75f3e8d1fae

* fix(openai): keep setup auth choices consistent (#124729)

* fix(openai): centralize setup auth metadata

* refactor(openai): overlay auth hooks in place

* fix(tasks): cancel subagents through gateway (#124752)

* fix: honor context caps on Codex-routed models (#124735)

* fix(codex): forward authored context caps

* test(codex): keep binding fixtures uncapped

* fix(agent-harness): separate authored context cap

* fix(config): render actionable validation errors (#124763)

* fix(config): render actionable validation errors

* fix(config): cover service and gateway validation

* docs: remove agent-hierarchy guardrail from VISION roadmap

Agent-created agents (durable roster entries with provenance) are now
planned work, so the blanket VISION.md guardrail against agent-hierarchy
frameworks no longer reflects direction. The adjacent guardrail against
heavy duplicative orchestration layers stays.

* fix(gateway): preserve worker lifecycle failure reasons (#124774)

* fix(cli): explain empty directory lookups (#124753)

* fix(cli): explain empty directory lookups instead of printing nothing

* fix(cli): distinguish unsupported self lookups

* fix(codex): honor session node exec host (#124777)

* refactor(line): replace nine-marker prompt DSL with typed rich messages (#124755)

* refactor(line): replace nine-marker prompt DSL with typed rich messages

Delete the LINE plugin's double-bracket marker language (quick_replies,
location, confirm, buttons, media_player, event, agenda, device,
appletv_remote) and its parser. Portable interactions now flow through the
existing presentation-block seam (renderPresentation, matching Discord and
Feishu); LINE-specific cards ride closed channelData.line schemas mapped to
the existing Flex renderers. Prompt section shrinks to four capability
lines and explicitly de-fangs marker text. Removes the stale
assertion-safety baseline entry for the deleted parser.

Production LOC net -69, tests net -433. Suite: 510/510 green.

* fix(line): declare rich message schema dependency

* fix(line): satisfy rich message type checks

* docs(line): mark card fragments as partial

* feat(ui): surface approvals passively and redesign the approval card (#124767)

* feat(ui): surface approvals passively and redesign the approval card

Approvals no longer auto-open the centered modal: the queue is reachable
only through the sidebar attention chip, while the owning session shows
the inline card and other sessions surface via the session-row shield
icon, agent badges, and the chip. Deletes the inline-vs-modal exclusion
machinery (modalApprovalQueue, inlineApprovalId, forceShowAll) and makes
modal dismissal close the view instead of denying the active request.

Card: severity now drives the accent color instead of a table row,
plugin/agent render as header chips, the session key moves behind a
collapsed Details disclosure (modal only), and low-value exec rows
(Resolved/Security/Ask) collapse into the same disclosure. The codex
app-server bridge stops duplicating the session key into description
text; the envelope already carries it.

* fix(ui): gate settings Escape on the approval dialog's recorded open state

ClawSweeper caught that shouldIgnoreSettingsEscape still inferred an open
approval dialog from queue non-emptiness; with passive approvals a pending
queue no longer implies a visible dialog, so settings would swallow Escape.
The exec-approval element now records dialogOpen as a fact and the guard
reads it.

* refactor(channels): carry typed approval-prompt bindings through signal/imessage send seams (#124742)

The Signal and iMessage channel plugins inferred approval prompts by
regex-sniffing rendered message text (header matching like 'Exec approval
required', /approve command parsing), violating the transport-only channel
doctrine: approval actions must stay typed until channel encoding.

The typed envelope already existed (channelData.execApproval with
approvalId/approvalKind/allowedDecisions) and every payload-level delivery
path consumed it; the regex paths were redundant re-derivation at the raw
send seam plus restart recovery for in-memory iMessage poll state.

- Signal: delete send-level prompt sniffing entirely; all approval sends
  already flow through typed structured-payload or native-handler paths.
- iMessage: sendMessageIMessage takes a typed approvalPrompt binding
  (id/kind/decisions) from the native approval handler instead of an
  approvalKind flag plus text re-parsing.
- iMessage poller: persist pending poll targets in the plugin keyed store
  so restart recovery no longer regex-scans chat history; typed recent-chat
  discovery for handle-only DM targets stays. Split poll-target ownership
  into approval-reaction-poll-targets.ts (max-lines).
- Plugin SDK: remove extractApprovalReactionPromptBinding — beta-only
  surface, never in a stable release, so no deprecation window applies;
  AGENTS.md now records that rule.

Accepted tradeoff: approval prompts delivered by a pre-upgrade process are
not rediscovered from chat text after restart (<=24h transient state;
persisted reaction bindings and event-driven tapbacks still work).

* fix(ci): select aggregate QA evidence by manifest (#124802)

* docs: correct code mode runtime contract (#124792)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b7c-b9f0-73d5-8fb7-e619e8e458e1

Co-authored-by: Amp <[email protected]>

* fix(ci): invalidate extension boundary cache for attempt types (#124800)

* refactor(plugin-sdk): consolidate session catalog families (#124801)

* fix(memory): fail corrupted index commands (#124770)

* fix(memory): fail corrupted index commands

* fix(memory): preserve promotion output limit

* fix(memory): keep ranked promotion output

* feat(codex): name additional session-catalog homes (#124807)

* fix(state): copy-safe agent database registry via state-relative paths (schema v9) (#124728)

* fix(state): store in-root agent database registry paths relative to the state dir (schema v9)

Copied state directories retained stale absolute agent database registry rows. The combined gateway store then merged old and new copies, causing every sessions.list request to fail with SessionCanonicalKeyMigrationRequiredError.

Schema v9 stores in-root registry paths relative to the state directory; migration rewrites eligible rows, deletes stale duplicates, and preserves external paths.

* fix(voice-call): describe state-relative registry migration

* fix(state): preserve registry locator traversal

* test(macos): move PortGuardian schema-version boundary to v9

The store opens any state database up to maximumSupportedSchemaVersion,
which the schema v9 bump moved from 8 to 9. Shift the supported/newer
partition in the boundary test accordingly.

* fix(state): re-anchor copied default-layout registry rows instead of deleting them

Resolve the ClawSweeper P1 by preserving genuine external default-layout registrations, re-anchoring copied rows when an in-root counterpart exists, and deleting only dual default-layout conflicts.

* fix(upgrade): retain owners in legacy cron stores (#124809)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00a6a-b64e-74a5-8b15-2d3b966a468d

Co-authored-by: Amp <[email protected]>

* feat(tools): prompt proactive widget use (#124810)

* fix(ui): stop stale clients from acting connected (#124772)

* fix(ui): stop stale clients from acting connected

Carry reload metadata on terminal Control UI build rejections, render an explicit refresh-required recovery state, fence reconnect-only actions, and surface disconnected approval failures with accessible modal controls.

* fix(ui): preserve reconnecting session drafts

* fix(ui): preserve offline preference intent

* fix(ui): return owned fallback digest bytes

* test(ui): follow passive approval presentation

* fix(ui): distinguish stale builds from protocol mismatches

* style(ui): format gateway recovery phase

* refactor(validation): type producers and drop internal re-validation — pilot lane C (#124808)

* fix(cli): restart disabled installed services (#124786)

* refactor(agents): persist directive facts at the assistant write boundary (#124793)

* refactor(agents): persist directive facts at the assistant write boundary

Assistant final text is now stripped of inline delivery directives once, at
the SessionManager append boundary, with the parsed facts persisted as a
typed openclawDelivery field on the assistant message (openclawDeliveryMirror
precedent, inside event_json — no schema change). Live session state is
replaced with the persisted canonical bytes so same-run continuations and
next-turn store rebuilds never diverge (prompt-cache invariant).

Delivery and restart recovery consume the stored facts instead of re-parsing
persisted text; pre-upgrade in-flight messages without facts intentionally get
no text-parse fallback (commented tradeoff at the read site). Directive
parsing is now code-region aware, so markers quoted in inline code or fences
neither parse nor strip — fixes the empty-code-pill display bug.

The undocumented reaction marker DSL ([[react:]], [[react_to_current:]]) is
deleted; structured message-tool reactions remain the canonical path. Stale
assertion-safety baseline entry removed with the parser.

Production net -10, tests net +38. Focused suites: 9,068 passed; pre-fix
regressions fail for the intended reasons. Codex autoreview clean.

* fix(agents): satisfy directive persistence gates

* fix(config): drop unused directive export

* fix(agents): preserve indented directive examples

* perf(test): remove ClickClack scheduler waits (#124819)

* refactor: split max-lines pilot files and retire suppressions (#124813)

* fix(runners): align reclaim results with runtime (#124791)

* refactor(runners): prepare placement move targets

* fix(runners): preserve normalized dispatch targets

* style(protocol): format reclaim result type

* fix(ui): make light-theme diff syntax readable (#124814)

Co-authored-by: RoboClaw <[email protected]>

* fix(ci): render only aggregate QA evidence (#124823)

* fix(ui): show session changes in review panel (#124824)

* fix(gateway): stop closed clients from restoring session subscriptions (#124771)

* fix(gateway): reject closed session subscribers

* test(gateway): type subscription race params

* test(gateway): use public subscription assertion

* fix(ci): invalidate SDK declarations on attempt types

* chore(ci): align boundary cache comment with main

* fix(gateway): surface failed node event delivery (#124798)

* fix(gateway): surface failed node event delivery

* fix(plugin-sdk): preserve authored context cap

* fix(mcp): make Codex approval dead ends actionable (#124766)

* fix(mcp): make Codex approval dead ends actionable

* fix(mcp): preserve native approval fallback

* fix(mcp): configure saved approval modes

* fix(mcp): preserve saved Codex metadata

* style(mcp): simplify saved metadata spread

* improve(ui): one primary composer button, Enter-steer, Esc-stop, quiet mic, no transcript focus ring (#124799)

* fix(ui): drop the transcript keyboard-focus ring

The .chat-thread:focus-visible 2px inset outline (added in #120693) boxed
the entire main content whenever the transcript took keyboard focus
(Shift+Tab, closing transcript search) and read as a broken border that
stopped above the composer. The transcript stays keyboard-focusable for
scroll keys; it just paints no focus box. Accepted tradeoff: no visible
focus indicator on the scroll container.

* feat(ui): single primary composer button with Enter-steer and Esc-stop

The composer now renders exactly one primary action, always rightmost:
- draft or attachments present: one send-shaped button whose label follows
  the session follow-up mode (Send / Queue / Steer); the stop button no
  longer renders beside it
- empty while a run is active: Stop (tooltip "Stop (Esc)"); Escape in the
  composer aborts the run, deferring to reply-clear and menu precedence
- empty while idle: disabled send labeled "Write a message to send."

Enter on an empty composer while a run is active steers the oldest
steerable queued message — Enter queues, Enter again steers — using the
same eligibility predicate as the queue chip's Steer action (shared
steerableQueuedMessage helper). The mic/dictation control is now always a
compact secondary control left of the primary instead of morphing into
the primary when the composer is empty. Dead ChatRunControlsProps fields
(hasMessages, onExport, onNewSession, showPrimary, showSecondary) and the
composer exportMarkdown wrapper are removed; the assertion-safety
baseline entry for chat-composer.ts shrinks 8 -> 7.

* refactor(ui): quiet the idle composer mic

The idle mic was an accent-tinted two-segment pill (mic + permanently
visible device-picker chevron) that outweighed the primary action. It now
matches the attach button's ghost weight: transparent idle, subtle hover,
and the accent treatment is reserved for the recording and talk-active
states so the idle -> recording escalation reads stronger. The device
picker chevron collapses at idle and reveals on hover/focus-within (kept
always visible on coarse pointers, where dictation matters most; reveal
transition disabled under prefers-reduced-motion). The idle tooltip now
teaches the gesture split — "Tap to talk · Hold to dictate" — while the
aria-label stays "Start voice input".

* refactor(ui): split composer keydown and oversized composer test files

chat-composer.ts crossed the 700-line oxlint budget after the keyboard
additions; the keydown handling (menu routing, history keys, Escape-stop,
Enter steer/send) moves to chat-composer-keydown.ts behind a typed deps
factory. The composer unit tests split their primary-action/keyboard
coverage into chat-composer-actions.test.ts over a shared
chat-composer.test-support.ts, and the catalog/model-discovery e2e cases
move to chat-composer-catalog.e2e.test.ts. Pure moves, no behavior
change; no max-lines suppressions or baseline entries added.

* chore(ui): keep composer test-support ComposerProps internal

The split exported a type nothing imports; the dead-export scan is a
merge gate.

* fix(ui): narrow composer keydown target and adapt keyboard tab-order proof

The keydown split moved two bare textarea assertions into a zero-baseline
file; a single instanceof narrowing at the handler entry replaces both
(the handler only binds to the composer textarea). chat-composer.ts's own
assertion baseline ratchets 7 -> 5. The pointer-activation e2e now walks
the real post-redesign tab order (mic, focus-revealed picker trigger,
then primary send) instead of assuming one Tab.

* fix(ui): gate Enter-steer on the queue chip's visible availability

ClawSweeper P1: the Enter path only required an abortable run, so
offline Enter swallowed the keypress and invoked a steer lifecycle that
returns at !connected with no visible outcome, while the queue chip's
Steer button was correctly hidden behind connected && canCompose. The
keydown path now mirrors the chip's exact boundary (connected, canSend,
abortable, visible queue surface including sessionKey-less pending
rows).

* refactor(ui): align approval page with redesigned approval card (#124816)

* refactor(ui): align approval page with redesigned approval card

Follow up #124767 by carrying severity accents and identity chips onto the standalone approval page.

Remove the unused execApproval.labels severity, plugin, and agent keys.

* refactor(ui): keep approval-page helpers in repo idiom

Reverts drive-by rewrites from the build pass: restore the exhaustive
decisionLabel switch (the ternary lost the never check), the early-return
appliedDecisionMatches, explicit gatewayCode comparisons, and align the
severity mapping shape with the sibling exec-approval-card.ts.

* test(ui): type approval severity fixtures

* test(scripts): wait for a parseable descendant pid in Bun smoke cleanup

The readiness gate only required the descendant pid file to exist, but
existsSync can observe it between open() and write(); a loaded runner
then reads an empty file and the integer assertion flakes (seen on PR
#124816 CI run 31971191374). Readiness now requires parseable content.

* perf(webui): reuse the chat metadata catalog across pages (#124794)

* refactor(webui): centralize chat metadata caching

* test(webui): cover shared chat metadata store

* refactor(webui): move ChatMetadataResult type to its store owner

* fix(webui): let the metadata store own revalidation lifetime

* fix(webui): satisfy no-promise-executor-return in retry delay

* fix(browser): stop local actions when agent turns are cancelled (#124795)

* fix(browser): cancel local actions with agent signal

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

* fix(agent-harness): expose authored context cap

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

* chore(agent-harness): drop redundant context-cap override

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

---------

Co-authored-by: Amp <[email protected]>

* improve(ui): make chat disclosures compact (#124832)

Co-authored-by: RoboClaw <[email protected]>

* fix(gateway): share generated session titles with worktree names and start title work at dispatch (#124787)

Worktree sessions now derive their worktree/branch name from the same
concise generated title the sidebar shows (bounded 8s wait, raw-prompt
slug then crustacean fallback), persisted once as displayName so the
chat-send pass never duplicates the model call. Dashboard title
scheduling moves from the dispatch chain's finally (after the whole
first turn) back to dispatch start, so long or interrupted first turns
no longer leave sessions silently untitled (regression from #122471).
slugifyWorktreeTitle truncates at word boundaries; dead
generatedDisplayName plumbing removed.

* fix(browser): support Chrome Web Store native bootstrap (#124775)

* fix(browser): support Chrome Web Store native bootstrap

* chore: keep browser release note in PR body

* docs(browser): document Store identity trust boundary

* docs(browser): correct Store recovery guidance

* fix(media): bound image-optimize fetch headroom to the image cap (#124838)

When a caller passed an explicit maxBytes with optimizeImages on (the
default), the source-read bound was inflated to max(maxBytes, 100MB
document cap). A channel with a 5MB attachment cap therefore let a
hostile or oversized URL buffer up to 100MB before the final size check
— 20x resource amplification, and the inflation applied before content
classification, so it was not limited to images.

The inflation exists so oversized-but-compressible originals can be
fetched and compressed under the delivery cap. Size that headroom off
the thing that justifies it: 4x the 6MB image cap (24MB), enough for
large phone photos, instead of the document cap.

Accepted tradeoff (named at the constant): originals above 24MB that
would have compressed under the cap now fail; the fetch error names the
bound. Callers without an explicit cap keep per-kind defaults.

Live proof on a real localhost HTTP server (no mocked fetch): an 8.1MB
PNG under a 5MB cap compresses to 3.75MB and delivers; a 30MB-declared
image is rejected at the Content-Length precheck in 7ms with 'content
length 31457280 exceeds maxBytes 25165824'.

Regression: headroom-bound test fails pre-fix (30MB passes the old
100MB bound); companion test proves compression headroom still works.

* fix(channels): route direct DM replies to sender (#124837)

Default direct-message reply context to the authenticated sender address so targetless Reef and Nostr replies do not resolve to the local recipient.

* feat(auto-reply): record message-tool mute outcomes (#124830)

* feat(auto-reply): record message-tool mute outcomes

* fix(auto-reply): require source delivery evidence

* test(infra): preserve historical agent schema fixtures

* fix(agent): preserve implicit roster in configless exec (#124805)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b7c-b9f0-73d5-8fb7-e619e8e458e1

Co-authored-by: Amp <[email protected]>

* fix(delivery): unify terminal settlement ownership (#124825)

* fix(delivery): unify terminal settlement ownership

Treat identityless adapter returns as potentially visible across channel, queue, and cron paths. Let recovery own terminal completion so ambiguity persists as notice debt instead of being double-settled or silently suppressed.

Co-authored-by: ruel225 <[email protected]>

* refactor(delivery): narrow terminal internals

Remove now-unused internal exports after terminal-settlement ownership was consolidated.

* test(tts): preserve message runtime exports

Import and spread the actual message runtime so the focused mock retains every runtime binding while overriding only the durable send core.

---------

Co-authored-by: ruel225 <[email protected]>

* fix(ui): give queued-outbox badges their own outbox icon (#124842)

The sidebar queued-message badge and the composer queue reused the clock
glyph that also marks attached automations, so a session with both showed
two identical clocks distinguishable only by tooltip. Add an outbox tray
icon (Lucide inbox with the roof swapped for a rising arrow) and use it
for queued-to-send surfaces; the clock stays automation/cron-only. The
mock dev fixture now flags one session with hasAutomation so the badge
renders in mocked-dashboard proofs.

* refactor(plugin-sdk): extract stream and SecretRef primitives (#124835)

* refactor(ui): derive cron types from gateway protocol (#124827)

* refactor(ui): derive cron types from gateway protocol

* fix(protocol): preserve cron session target type

* fix(ui): keep sent images visible through history handoff (#124839)

* fix(memory): report indexed SQLite sessions (#124834)

* fix(memory): report indexed SQLite sessions

* refactor(memory): remove unused state path export

* refactor(validation): consolidate boundary guards into schemas (#124820)

* refactor(validation): consolidate boundary guards into schemas — pilot lane B

* fix(meetings): reject non-object browser status

* perf(test): remove Gmail watcher shutdown wait (#124851)

* refactor(types): discriminated unions for internal contracts — pilot lane A (#124845)

* refactor(slack): mark approval headers with typed block ids (#124841)

* feat(ui): add steer-now composer shortcut (#124826)

* fix(slack): drop the tool-call receipt from finished progress cards (#123851)

The Block Kit session card terminalized into a '🛠️ N tool calls · ⏱️ Ns'
footer, leaving a per-turn receipt in the Slack transcript on the default
progress path. PR #122976 deleted the same receipt from the native progress
surface but left this sibling rendering it.

Finished cards now keep only the durable diff stat and the session link;
tool-call and elapsed counters stay live working state. Also corrects the
documented channels.slack.streaming.mode default, stale since #122552.

* fix(agents): keep queued followups from missing post-compaction context (#124850)

* fix(auto-reply): order post-compaction context before followups

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

* test(auto-reply): clean compaction workspace fixture

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

---------

Co-authored-by: Amp <[email protected]>

* fix(test): propagate parent heavy-check ownership (#124859)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b7c-b9f0-73d5-8fb7-e619e8e458e1

Co-authored-by: Amp <[email protected]>

* fix(cli): emit one JSON failure contract for --json invocations (#124849)

* fix(cli): unify JSON failure output

* test(cli): update skills verify failure envelope

* fix(gateway): preserve prepared plugin metadata under load (#124844)

* fix(gateway): preserve prepared plugin metadata under load

* fix(gateway): project metadata before catalog preparation

* test(agents): assert projected startup metadata

* test(gateway): bind load probes to each finalization wave

* docs(ci): record artifact checkout experiment

* perf(test): reuse postpublish file-cap fixture (#124871)

* fix(protocol): model cron run delivery trace (#124856)

* fix(protocol): model cron run delivery trace

* chore(protocol): refresh generated cron run model

* test: replace assertion chains with typed fixture builders — wave 2 (#124865)

* refactor(security): consolidate path containment onto canonical fs-safe guard (#124870)

* refactor(security): expose canonical path containment modes

* refactor(agents): use canonical path containment guard

* refactor(security): consolidate core path containment sites

* refactor(plugins): consolidate path containment sites

* test(security): cover canonical path containment behavior

* fix(gateway): persist agent turns before acknowledgement (#124857)

* fix(gateway): persist agent turns before acknowledgement

* fix(gateway): revalidate exec approval handoffs

* docs(gateway): clarify durable session ownership

* fix(gateway): reject stale transcript admission targets

* fix(ui): show recovery when Control UI does not render (#124861)

* fix(ui): retire bootstrap fallback after render

* test(ui): avoid returning from Promise executor

* fix(qa): recover repeated gateway restarts through channel ingress (#124746)

* fix(qa): repair repeated gateway restart recovery

* test(qa): satisfy restart recovery checks

* fix(audit): rekey repeated recovery identity

* fix(plugin-sdk): expose authored context cap

* test(android): synchronize process tree readiness

* fix(ui): restore task count badge (#124840)

* fix(ui): align update status card spacing (#124878)

* fix(browser): cancel node discovery with tool runs (#124880)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

Co-authored-by: Amp <[email protected]>

* perf(webui): render cached model catalog while the chat pane refreshes (#124868)

* perf(webui): render cached model catalog while the chat pane refreshes

* test(webui): fix seed-test types and shrink assertion baseline

* fix(state): report v9 registry migration row decisions (#124862)

* fix(state): report v9 registry migration row decisions in doctor and logs

* fix(state): consume registry migration summary type

* fix(state): avoid registry path observer import cycle

* fix(workboard): include actual length in bounded-string error

The shared normalizeBoundedString helper in extensions/workboard/src
threw an opaque error like 'comment body must be 2000 characters or
fewer.' whenever an oversize string hit any bounded field. Agents that
posted a long run summary or oversized link URL had no way to tell
how far over the limit they were, so they could not retry with a
trimmed payload.

Include the actual length in the error so the message tells the agent
exactly what to do next:

  comment body must be 2000 characters or fewer (got 3502).

The format applies uniformly to every bounded field routed through
this helper (labels, link URL, link title, link target, comment
body, title, notes, worker log message, session key, run id,
protocol violation detail, etc.) since the helper is the single
canonical owner of the message.

Cover the new format with a focused unit test that pins the regex
for the comment-body repro from #118845 and exercises the six other
bounded fields listed in the issue. Update the existing
gateway.test.ts assertion to allow both the old and new format so
the format change is a forward-compatible improvement.

* test(workboard): align matrix with real normalizeBoundedString consumers

ClawSweeper flagged that the prior matrix at line 31-48 tested
labels/title/notes by manually invoking normalizeBoundedString, even
though those fields use the independent normalizeTitle, normalizeNotes,
and normalizeLabels functions (each with its own generic message).
A regression that drops the (got N) suffix from normalizeBoundedString
would not be caught for those three surfaces — operators would still
see the old opaque error.

This commit narrows the matrix to only the consumers of the shared
helper (comment body, link title, link target, link URL, card id) and
restores the exact labels gateway assertion that should match the
unchanged normalizeLabels error.

Verification: 9/9 inline Node 18 AST harness (node /tmp/verify-pr-118888-v77.mjs);
parent-commit proof-gate (pre-PR helper without the got suffix) fails
4/9 of the post-fix expected messages.

Closes ClawSweeper review on PR #118888 (P2 + P3).

* test: cover Workboard length errors at gateway boundary

* docs: note length-aware Workboard errors (#118888)

* perf(ci): split Windows CI two ways instead of one serial lane

`checks-windows-node-test` ran the whole 222-266s Windows body in a single
Blacksmith lane, so every run that scheduled it finished at 287-334s against a
~180s plateau. Measured across 45 canonical main runs it was the wall in all
seven runs that triggered it (324-519s vs a 210s median elsewhere).

Blacksmith's Windows class admits exactly 2 concurrent jobs (run 31865243804),
which is why the earlier 3-part split failed: its tail queued 211s behind a
finished part. Pin the split width to that measured capacity instead. The two
parts are balanced by measured per-project wall time -- part 1 keeps the old
list 1 plus list 2's non-infra projects (~108s), part 2 takes list 2's infra
project plus the old list 3 (~112s) -- so both land near 113s and the lane
stops setting the wall.

One canonical partition now serves every backend; the github-mode/dispatch
3-part variant and its separate file inventory are gone, along with the
single-lane `task: test` case and the per-row `matrix.runner` the collapsed
lane needed. The complete 65-file Windows inventory is preserved exactly, and
the guards pin the width on both sides (mutation-checked: restoring 3 parts
fails the matrix guard).

* fix: stop forked commands after Gateway timeouts (#124081)

* fix: stop service child trees before timeout completion

* fix: preserve service child root results during cleanup

* test: isolate relay selection from linux spawn wrapping

* refactor: keep service anchor payload internal

* test: validate lifecycle probe pid output

* fix: close service child adversarial races

* fix: preserve service startup failures

* fix(process): flush service output before root result

* fix(process): bound cleanup on held output

* chore(process): satisfy promise executor lint

* fix(process): finish cleanup after lineage loss

* fix(process): retain relay output before subscription

* fix(ci): register service child runtime entries

* fix(ci): expose relay safety invariants

* fix(process): preserve service cancellation grace

* test(process): prove service grace on macOS

* fix: prevent clipped session selections and Code Mode timer crashes (#124879)

* fix(agents): support timers in code mode

* fix(ui): keep selected sessions clear of scrollbars

* fix(agents): propagate timer cancellation after resume

---------

Co-authored-by: RoboClaw <[email protected]>

* fix(ui): reveal clipped session history (#124866)

* fix(ui): reveal clipped session history

Show a persistent earlier-history action for paginated sessions and reveal loaded content without chaining observer fetches.

Related: #110771

* refactor(ui): split chat history support

* fix(cli): keep internal error causes out of operator output (#124887)

* fix(skills): expand explicit references on agent turns (#124784)

* fix(skills): expand explicit references on agent turns

Route generic Gateway, CLI, webhook, and local agent turns through the same explicit skill-reference renderer as channel auto-replies. Keep original transcript text, preserve unknown slash behavior, and fail visibly for allowlist-hidden skills.

Maintainer review: scoped Option 1 — generic agent turns expand both $skill-name and leading /skill-name args through shared skill rendering; they do not run the channel command dispatcher, and all other slash commands retain their existing behavior.

* fix(skills): bound explicit reference prompts

* fix(skills): prefer allowed reference collisions

* fix(skills): preserve command invocation boundaries

* fix(skills): reject hidden channel slash commands

* perf(skills): skip literal dollar discovery

* fix(ui): replace the broken terminal tab underline (#124875)

* fix(ui): redesign dock panel tabs

* fix(ui): remove stale terminal tab overrides

---------

Co-authored-by: RoboClaw <[email protected]>

* fix(tui): close selection overlays and report rejected handlers (#124876)

openSelector's onSelect fired the async handler with void and only
closed the overlay after a successful await. A rejecting handler (e.g.
setAgent -> setSession against a failing gateway) left the selector
stranded open with an unhandled rejection: the TUI froze on the picker
with no visible cause — a silent dead-end.

Root cause: failure path missing from the overlay lifecycle. The
handler now catches, surfaces the cause via chatLog, and always closes
the overlay.

Regression: /agent selection with a rejecting setSession asserts the
overlay closes and the cause reaches the chat log — fails pre-fix.

* fix(ui): make terminal open failures retryable (#124890)

* fix(sandbox): surface list probe failures instead of empty results (#124881)

sandboxListCommand and fetchAndFilterContainers swallowed backend and
registry probe failures with catch(() => []). A broken Docker daemon or
corrupt registry rendered as 'No sandbox runtimes found.' — and in
recreate, filtered an entire fleet down to nothing — indistinguishable
from a clean empty state. --json emitted a success envelope for a
failed probe.

Root cause: failure collapsed into the empty success shape at the
consumer. The listers now propagate; the sandbox CLI runner already
owns the error path (message + exit 1), and the new --json failure
contract (8d5823e7313) emits the JSON error envelope.

Regression: replaced the test that enshrined the masking ('handle
errors gracefully' asserting the empty-state message) with the
propagation contract — fails pre-fix.

* fix(tui): report the first last-session write failure (#124886)

* fix(tui): report the first last-session write failure

rememberCurrentSessionKey swallowed writeTuiLastSessionKey failures
with catch(() => undefined). A corrupt or locked state DB silently
disabled session restore: the operator only discovers it on next
launch, landing in the wrong session with no clue why.

Root cause: fire-and-forget with no recorded failure. The write wrapper
moved to its owner (tui-last-session.ts) as
createRememberSessionKeyWriter, which surfaces the first failure via
the chat log ('session memory write failed: ...') and stays silent on
repeats — one line per TUI run, not one per session switch. Empty and
'unknown' keys still skip without touching the writer.

Regression: colocated tests prove first-failure-once reporting and the
skip path — fail pre-fix (factory did not exist; failure was
swallowed at the call site).

* chore(tui): make the last-session write dependency explicit

deadcode:exports rejects writeTuiLastSessionKey as unused when only the
factory default referenced it; tui.ts now passes it explicitly.

* fix: remove delivery markers from historical sessions (#124888)

* fix(sessions): migrate historical transcript directives

* fix(infra): complete directive migration on pre-archives-schema databases

session_transcript_archives is a lazy additive v17 surface; valid databases
may omit it. The archives phase now treats the missing table as empty and
completes the cursor instead of warning-skipping the whole database forever.
Verified against a real long-lived agent DB: previously stuck cursor
completes with zero warnings in ~100ms.

* chore(ci): allow directive migration SQLite access

* fix(sessions): report self-archive before stopping the turn (#124896)

* feat(agents): record agent creation provenance and add roster tree listing (#124828)

Adds an additive agent_provenance table (shared state DB, schema v8) owned
by src/state/agent-provenance.ts. createAgent() records operator/agent
provenance after commit, the system-agent create-agent operation passes its
own id as creator, and Claw installs record created-via claw at their roster
commit point. Agent deletion removes the agent's own row inside the deletion
journal transaction; children keep dangling creator ids as historical fact.
openclaw agents list gains --tree (provenance hierarchy) and JSON provenance
fields.

* fix(ui): keep message presentation stable when expanded (#124898)

* fix(gateway): stop a plugin dangerous flag from revoking desktop computer.act (#124863)

* fix(gateway): stop a plugin dangerous flag from revoking desktop computer.act

`resolveNodeCommandAllowlistInternal` subtracted every plugin-declared
dangerous command from the composed allowlist, including core's own
`PLATFORM_DEFAULTS` entries and including the pairing allowlist, where core's
dangerous defaults are exempted. `computer.act` is both a desktop platform
default (grant = node-local enablement + pairing approval) and a command that
`registerComputerUseProvider` marks dangerous. Since `cua-computer` became
enabled-by-default on darwin, every macOS-hosted Gateway stripped `computer.act`
from both allowlists, so `normalizeDeclaredNodeCommands` dropped it from the
node's declaration with no pairing upgrade, no prompt, and no record. The
`computer` capability survived because caps were never allowlist-filtered, and
the `computerUse` descriptor was then dropped for the missing command.

Scope the plugin-dangerous subtraction to commands outside the platform-default
base: the flag still keeps a plugin's own surface behind an explicit allow and
still forces a registered invoke policy, but it no longer revokes a command core
declares itself.

Also make cap-without-command unrepresentable. `retainFulfilledNodeCapabilities`
drops a capability when policy withheld commands from its family and admitted
none, and the reconciler records the withheld commands so a refused declaration
is never silent.

* test(gateway): type the computer-use fixture against its contract

* fix(doctor): partition retired session stores (#124846)

Recover owner-qualified rows from the retired top-level session store into each configured agent database without guessing ambiguous ownership. Relocate stale transcript paths, tolerate historical Unicode IDs when an explicit transcript exists, and avoid double-counting physical SQLite databases in migration totals.


Amp-Thread-ID: https://ampcode.com/threads/T-01a00a6a-b64e-74a5-8b15-2d3b966a468d

Co-authored-by: Amp <[email protected]>
Co-authored-by: Josh Lehman <[email protected]>

* perf(ci): price agents-core-models from its measured hybrid wall

`agentic-agents-core-models` carried the 36s scaled estimate while measuring
56.3s (n=6, p90 58.6s) across 260 compact jobs on 2026-08-16. Packed beside
`agentic-agents-core-runtime-hosted-1` (60.4s) it built the only bin running
>=1.25x its prediction: compact-large-19 ran 122s of work priced at 88s, which
made it the most frequent slowest job in the workflow.

Add the measured value to the hybrid hint map, which already exists for exactly
these Blacksmith-specific observations. The packer then separates the two, and
the tallest actual compact bin drops 122s -> 109s with no bin above 1.25x and
no change to row counts (48 push / 56 pull-request), so this costs no extra
runner registrations.

Two things deliberately left alone. The `agentic-gateway-core-3` 140s pin looks
like a 2x over-prediction against its 68.5s median, but run 31938297538 really
did take 138.0s (109.03s + 28.98s across its two configs) on a run whose fleet
slowdown factor was 0.98 -- a genuine tail on a healthy run, so unpinning it
would rebuild a >200s bin whenever the tail lands. Every other bin already sits
within 1.24x of its prediction.

The replaced guard pinned one bin arrangement (`runtime-hosted-1` not sharing a
job with `agents-core-tools`) with no stated failure mode, so any honest refit
broke it. It now asserts the property that comment was reaching for -- both
weight sources survive rebalancing under the body ceiling -- plus the specific
regression this fixes. Mutation-checked: dropping the hint fails the new guard.

Measurement note for the next refit: sum a shard's per-config Duration lines
before taking a median. Pooling them reads as a large over-prediction that is
not there.

* fix(codex): prevent app-server leaks after desktop fallback (#124885)

* fix(codex): reuse app server after managed fallback

* test(codex): opt relay fixtures into loop detection

* fix(ui): add spacing between suggested task actions (#124900)

* fix(ui): separate suggested task card actions

* test(ui): keep task suggestion spacing check lint-safe

* fix(ui): drop duplicate plan card summary (#124895)

* fix(backup): give backup create actionable output errors (#124894)

* fix(backup): give backup create actionable output errors

* fix(backup): preserve output errors for debug

* fix(test): create sessions in default Control UI mock (#124912)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b6b-e4e9-74af-bb31-30363fae6c89

Co-authored-by: Amp <[email protected]>

* fix(plugins): adopt root context engines on caller-owned handles (#122457)

Keep caller-owned agent runtime registries in discovery mode so full-only
plugins cannot replace process-global sandbox backends. Copy runtime
context-engine factories from the composition-root registry instead.

Co-authored-by: Josh Lehman <[email protected]>

* docs(codex): clarify loop relay behavior (#124918)

* fix(gateway): terminalize stale worker dispatches (#124920)

* refactor(ui): simplify chat history pagination (#124921)

* test(gateway): make archive lifecycle waits deterministic (#124923)

* fix(android): remove completed plan strikethrough (#124916)

* fix(plugins): restore caller-owned workspace plugin-root projection

#124844 made resolvePluginMetadataSnapshot synthesize workspacePluginRootPresent
itself with a process-memoized fs.existsSync probe whenever a caller did not
supply it. That fact is owned by the prepared-model-runtime lease, which resolves
it only for real agent runs (resolveWorkspacePluginRootPresence) and passes it
explicitly, so the probe silently turned an opt-in fast path into the default for
unrelated control-plane callers.

Gateway startup config validation is one of them. It never asserts the fact, so it
began projecting the published lifecycle graph instead of loading a fresh one, and
the projection derives configFingerprint from that graph rather than a real load.
Startup convergence rewrites the persisted plugin index between the two reads that
form the migration checkpoint identity, so the pre-convergence read projected while
the post-convergence read loaded. The two pluginMigrationFingerprint values differed
and the gateway refused readiness with "OpenClaw plugin migration inputs changed
during startup convergence", failing every config-patch restart.

Deleting the probe restores one owner for the fact and a net-negative production
diff. The agent-side hunks of #124844 are untouched: they still pass the fact
explicitly from the lease.

Root cause: admission fact manufactured outside its lifecycle owner.
Owner boundary: src/agents/prepared-model-runtime-lease.ts owns workspace
plugin-root presence; src/plugins/plugin-metadata-snapshot.ts only consumes it.
Production LOC: -18.

Fixes red main ci-gate: QA Smoke memory-dreaming-sweep, matrix-restart-resume,
matrix-post-restart-room-continue.

* fix(doctor): preserve migrated session owner (#124928)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00a6a-b64e-74a5-8b15-2d3b966a468d

Co-authored-by: Amp <[email protected]>

* refactor(webui): read slash commands through the chat metadata store (#124931)

* fix(doctor): stop reporting phantom shared auth migrations (#124929)

* fix(cron): stop advertising inactive JSON defaults (#124903)

* fix(cron): make --json help match behavior

* fix(cron): preserve scratch write JSON output

* test(cli): classify cron JSON result commands

* fix(ui): remove dashboard card text underlines (#124939)

* fix(agents): refuse add when prompts cannot run (#124940)

* test(ui): assert steer order by rendered position (#124905)

* fix(plugins): keep migration metadata authoritative (#124924)

Restrict exact config identity trust to prepared runtime generations and force startup convergence to verify against a fresh authoritative plugin snapshot.

* test(mistral): wait on delivered transcripts after reconnect (#124935)

* test(mistral): wait on delivered transcripts after reconnect

* test(nvidia): assert the remaining catalog fetch budget as a bound

* fix(cli): show actionable guidance for mistyped commands (#124892)

* fix(cli): render unknown commands as guidance

* fix(cli): keep parse JSON terminal-neutral

* refactor(sdk): source wire models from gateway-protocol schemas (#124943)

* test(ui): split chat follow-up E2E suite (#124938)

* fix: honor provider timeouts during stuck-session recovery (#123877)

* fix(diagnostics): respect active model request timeouts

* chore(diagnostics): keep recovery activity internal

* test(diagnostics): await stream wrapper results

* fix(diagnostics): harden provider timeout recovery

* fix(diagnostics): track compaction model calls

* test: prove provider timeout recovery boundary

* fix(config): reject scalar config roots instead of loading defaults (#124945)

A config file whose JSON5 root parsed to a scalar (null, a number, a
bare string — the classic truncated/clobbered file) hit a special case
in loadConfigFromContext that returned {} with a snapshot marked
valid: true. Three failures in one: the process silently ran with
defaults while the operator's real config (channels, auth, allowlists)
disappeared; the valid snapshot could promote the corrupt file's
fingerprint as lastKnownGood, poisoning the clobber-recovery machinery
that exists to catch exactly this; and the load path contradicted the
snapshot path, which correctly reported the same bytes invalid.

Root cause: an early-return that collapsed invalid input into the
empty-config success shape. Deleted; a scalar root now flows into
validateConfigObjectWithPlugins, fails schema validation, records a
valid:false snapshot, and throws INVALID_CONFIG — same as an array
root, same as the snapshot path, handled by doctor's invalid-config
recovery.

Regression: new io.scalar-root.test.ts (null/number/string roots all
throw INVALID_CONFIG; snapshot agrees invalid) — all 3 fail pre-fix.
Updated the compat warning-fingerprint test that relied on null-root
loading as defaults.

* fix(security): prevent approved scripts from changing before execution (#124858)

* fix(security): bind exec approvals to mutable operands

* test: align approval fixtures with operand binding

* fix(security): close durable operand binding gaps

* fix(security): preserve independent exec policy grants

* improve(ui): simplify widget preview chrome (#124883)

Co-authored-by: RoboClaw <[email protected]>

* fix: deliver requested image artifacts across agent runtimes (#124910)

* fix: distinguish image inspection from delivery

Clarify that image-reading tools only load private model context, prefer native Codex image inspection when available, and preserve explicit outbound tool media across Claude CLI loopback runs.

Co-authored-by: pash <[email protected]>

* fix: propagate CLI vision capability

* chore: refresh CI after main fix

---------

Co-authored-by: pash <[email protected]>

* fix(ci): derive plugin SDK boundary cache inputs (#124897)

* feat: add cloud worker profiles and machine selection (#124864)

* feat(workers): add per-dispatch machine classes

* feat(ui): add cloud worker machine picker

* feat(tts): add structured reply speech fields (#124913)

* feat(tts): add structured reply speech fields

* fix(tts): keep transcript directive parser acyclic

* fix(tts): drop unused directive fact export

* fix(outbound): preserve reply-payload metadata through response prefixes

The response-prefix rebuild spread the payload without its metadata carrier,
dropping structured speech facts (and any other payload metadata) whenever a
channel responsePrefix applied. Rebuild via copyReplyPayloadMetadata.

* fix(tts): keep voice-only sends visible when the speech runtime is cold

A structured voiceText-only send with no visible text returned unchanged from
the cold-runtime guard, so delivery normalized the empty payload to null and
the send silently vanished. The cold exit now applies the same visible
fallback as synthesis failure: explicit spoken text materializes as payload
text when no other content exists.

* fix(qa): isolate capture store startup (#124949)

* refactor(channels): align approval reaction bindings (#124942)

Split Signal approval routing into its concept-owned module and call the shared SDK binding helpers directly.

Reject persisted reaction targets when any allowed decision is invalid or duplicated, rather than retaining a valid subset from a corrupt transient record.

* docs(agents): harden live-test and capture-inspection requirements

Live verification of user-facing behavior is the default before landing,
with skips requiring a stated infeasibility in the PR; captured
screenshots/videos count as evidence only after the agent inspects them
in frame.

* refactor(ui): define sidebar panel contract (#124950)

* improve(ui): move session status to second row (#124960)

* improve(ui): move session status to second row

* test(ui): align session row layout expectations

---------

Co-authored-by: RoboClaw <[email protected]>

* docs: clarify model switching guidance (#124889)

* docs: clarify model switching guidance

* docs: warn that reasoning changes invalidate cache reuse

---------

Co-authored-by: RoboClaw <[email protected]>

* fix(ui): stop duplicate dashboard session queries (#124968)

* fix(doctor): surface legacy-config copy failures (#124948)

* fix(doctor): surface legacy-config copy failures

maybeMigrateLegacyConfig swallowed every copyFile error with a bare
catch whose comment claimed EEXIST-only. EACCES, ENOSPC, and
cross-device failures were silently ignored: the operator's
~/.clawdbot/clawdbot.json exists, migration was attempted and failed,
and doctor proceeded as a clean fresh install with no config, no change
note, and no warning.

Root cause: failure collapsed into the skip-silently success shape. The
catch now rethrows anything other than EEXIST with the source/target
paths in the message; EEXIST (config already at the target) keeps its
skip semantics.

Regression: read-only target dir makes the preflight reject with
'Failed to migrate legacy config' — fails pre-fix (resolved as a clean
run); companion test proves the successful copy path still migrates.

* chore(doctor): annotate the errno assertion for the safety ratchet

* refactor(doctor): narrow the copy error without a type assertion

The assertion-safety ratchet flagged the errno cast; property narrowing
removes the assertion instead of annotating it.

* fix(android): show plan status and explanation (#124958)

* fix: scale Gateway RSS diagnostics to runtime limits (#124914)

* fix(logging): scale RSS pressure to runtime limits

Derive Gateway RSS warning and critical thresholds from the smaller of the effective V8 heap and OS process limit. This preserves heap and rapid-growth pressure detection while avoiding routine false alerts on large heaps.

* test(logging): narrow optional heap fixture

* fix(logging): bound process memory sentinels

* test(logging): pin Bun physical memory fixture

* refactor(channels): delete the per-turn progress receipt line (#124972)

The finished-turn digest ('🧠 N thoughts · 💬 N notes · 🛠️ N tool calls ·
⏱️ Ns') was synthesized onto three surfaces: Slack's Block Kit card footer
(removed in #123851), Discord's final-answer subtext, and a duplicate Telegram
implementation added to match Discord.

Nothing gated it — no config key for the receipt has ever existed on any
channel — so PR #122976, which deleted it from Slack's native progress surface,
could only ever be a partial removal. Finish it: live progress surfaces keep
their in-flight indicators, and a finished turn leaves the answer with nothing
synthesized appended.

Telegram's window collapsed *into* the digest, so it now retires like every
other surface; Discord already discarded its draft after the final landed. The
core tracker keeps only the live counters Slack's working footer reads.

* feat(agents): preserve create request provenance (#124963)

* refactor(types): discriminated unions for internal contracts — wave 2 (#124959)

* fix(gateway): surface blocking startup progress (#124309)

Keep Gateway admission sidecar-gated while surfacing retryable startup progress in TUI and Control UI.

Unify deferred startup ownership and shutdown draining so late workers, plugin services, and sidecars cannot outlive transport teardown.

Co-authored-by: RoboClaw <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>

* test(node-host): own proxy tunnel lifecycle

* fix(codex): preserve resumed session usage (#124969)

* fix(doctor): report malformed final JSONL records (#124977)

Co-authored-by: Amp <[email protected]>

* feat(agents): show creation hierarchy in Control UI (#124967)

* feat(agents): show creation hierarchy in Control UI

* chore(protocol): regenerate Swift agent model

* refactor: consolidate record guards (#124970)

* fix: plugin tools disappear from Codex and restricted profiles (#124947)

* fix(memory): make standing intents reachable

* fix(agents): dedupe macOS read path variants

* docs(plugins): document profile tool metadata

* test(codex): complete prepared runtime fixtures

* fix(agents): preserve prepared tool boundaries

* fix(cli): prevent node/device RPCs from corrupting shared state (#123674)

* fix(cli): prevent node/device RPCs from corrupting shared state

* fix(cli): keep gateway RPC transport state read-only

* fix(cli): preserve doctor lint config isolation

* fix(cli): keep gateway RPC transport state read-only

* fix(gateway): keep auth preflight state read-only

* fix(cli): preserve SQLite artifacts in read-only RPCs

* fix(infra): remove stale identity store import

---------

Co-authored-by: VACInc <[email protected]>
Co-authored-by: Patrick Erichsen <[email protected]>

* fix(codex): reject malformed native tool arguments (#124649)

* fix(codex): reject invalid native tool arguments

* fix(codex): preserve raw argument preparation

Signed-off-by: sallyom <[email protected]>

---------

Signed-off-by: sallyom <[email protected]>
Co-authored-by: sallyom <[email protected]>

* feat: main-session agent-wide visibility + session.groupScope routing (#124965)

* feat: add main session group routing

* docs: explain main session routing scopes

* fix: align memory session visibility

* test(qa): cover main-scoped group bindings

* fix(sessions): preserve binding-scoped outbound routes

* fix(routing): preserve explicit outbound owners

* fix(sessions): recognize global main visibility

* chore(ci): prune assertion safety baseline

* fix(installer): finalize deferred PATH installs successfully (#124678)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00ae0-190d-718b-8a76-b75f3e8d1fae

Co-authored-by: Amp <[email protected]>

* fix(cli): align agent exec with system owner (#124697)

* fix(onboard): run channel hooks after config commit (#124736)

Amp-Thread-ID: https://ampcode.com/threads/T-01a00ae0-190d-718b-8a76-b75f3e8d1fae

Co-authored-by: Amp <[email protected]>

* fix(ui): hide mobile transcript metadata until tap (#124936)

* fix(ui): reveal mobile message metadata on tap

* fix(ui): centralize mobile transcript disclosure

Co-authored-by: Vyctor H. Brzezowski <[email protected]>

---------

Co-authored-by: RoboClaw <[email protected]…
obviyus added a commit that referenced this pull request Nov 24, 2026
…es (#204502)

Closes #204363

## What Problem This Solves

A PostgreSQL update can migrate its data and then crash. Restoring the previous package alone leaves that package unable to read the newer schema, so no Gateway serves.

## User Impact

Protected release trials migrate private server-side copies and publish their anchors only after validation. Failed trials select the original data with the previous release. SQLite agent databases under PostgreSQL shared state are protected in the same private pass.

The restart is longer. Plan for both server copies, indexes, WAL, temporary work and retained generations. Namespace names change on schema-changing updates; namespace-bound reporting, dump and grant-management scripts must use the current anchor. Source access grants and schema-local defaults are carried and verified, including grant options and column permissions.

## Why This Change Was Made

This extends the existing startup copy-and-swap owner, exact server carrier and durable file plan. It removes the PostgreSQL-anchor version-zero exclusion and its mixed-engine skip. It adds no application schema/version change, trial format, launcher SQL, public flag, timeout or retry loop. There is no portable-export or unprotected in-place fallback for protected stores.

The first verified server copy is the migration destination, not a frozen capture followed by a second restore. A separate frozen-export manifest would misdescribe a namespace that is about to migrate, so retention uses the existing preserved anchors, store UUID and exact role ownership. Normal frozen captures retain their isolation.

Shared state uses that server carrier too. The older backup owner withheld it because credential rollback needed exported shared-state rows; c2 instead retains those rows in the untouched original namespace, selected by the preserved anchor. That removes the need for a portable shared-state export in the protected trial without removing ordinary captures for uncovered stores.

<details>
<summary>Compatibility and inventory source notes</summary>

The physical PostgreSQL version is read in [`state-upgrade-databases.ts:83–92`](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/state/state-upgrade-databases.ts#L83-L92). Its [independent family-version filter](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/state/state-upgrade-databases.ts#L152-L153) replaces the old shared-state version-zero early return, so SQLite agents are not skipped when state uses PostgreSQL. Genuine fresh SQLite version-zero catalogs remain bootstrap-owned.

`v2026.8.1-beta.1` and `beta.2` wrote absolute registry paths. Schema 9 in [#124728](#124728) rewrites eligible in-tree rows to relative paths ([migration lines 269–278](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/state/openclaw-state-db-schema-repair.ts#L269-L278)); `beta.3` and stable include it, and PostgreSQL starts at schema 24. No new reader rebase or row rewriting is needed.

</details>

## Result Wording

- Preparation runs while the previous Gateway serves; a missing CREATE grant names the exact administrator SQL before stopping it.
- Candidate boot logs: “Preparing a protected PostgreSQL copy for OpenClaw … The previous data will stay available for recovery.”
- A healthy candidate keeps the normal update-success message.
- A recovered failed trial keeps the shared serving-version result and retry/report next action. Current versions also show the already-recorded exit-78 startup cause detail, including the server-space remedy.
- Namespace cleanup failure keeps the recovery pair and logs a warning; it never fails a serving release.
- Larger stores keep the existing in-place migration path, with this recorded notice: “This PostgreSQL store (X GiB) is too large to copy within the update window. It is migrated in place, without automatic data rollback. Back it up first: https://docs.openclaw.ai/install/updating#rollback”.

## Evidence

**Product qualification and final-head CI are complete: 89 checks passed, none failed or pending.** Actual [rollback and pre-stop privilege-refusal screenshots](#204502 (comment)) and [corrected space-remedy and successful in-place screenshots](#204502 (comment)) are attached. The corrected normal CLI update exits **0**; it supersedes the recorded pre-fix helper timeout. Every AWS lease was released with `--wait`, and task tunnels were stopped.

Final head: `5bbf3e6712d04546a8a8d639188976be606c7ef5`. [CI attempt 2](https://github.com/openclaw/openclaw/actions/runs/45379513209/attempts/2) and the [CI gate](https://github.com/openclaw/openclaw/actions/runs/45386761656) passed. One Doctor process-custody cleanup test failed on the first attempt; its [single authorized same-head retry](https://github.com/openclaw/openclaw/actions/runs/45379513209/job/138411642189) passed. No cleanup guard, assertion or product timeout was weakened.

- Complete AWS qualification archive builds and package checks passed: pristine reporter41 plus next42 and post-migration-crash42 fixtures from `ad7e628030`. [run_9f2fdf8a02d2aad39a29f67029739435](https://crabbox.openclaw.ai/portal/runs/run_9f2fdf8a02d2aad39a29f67029739435), exit 0. The large-mode fixture also built from `513b774d28` ([run_b92c7c5b1893ded6f4b4c02bbe3e8058](https://crabbox.openclaw.ai/portal/runs/run_b92c7c5b1893ded6f4b4c02bbe3e8058), exit 0). Schema 42 and the lowered large-mode threshold are disposable qualification overlays, not shipped schema or policy changes.

- PostgreSQL 16 focused owner run [run_0a734ee4124db7308ba39734795af613](https://crabbox.openclaw.ai/portal/runs/run_0a734ee4124db7308ba39734795af613): **7/7 pass** on `ad7e6280300163cf55c97987ca36229427a6e236`. Includes a non-superuser runtime owner, real reader and column-only roles, grant options, default grants for later tables, unchanged originals, both historical v39 layouts, mixed engines, frozen-launcher file recovery and owned namespace pruning.
- The new startup regression is red on base `0956e14e6814`: three intended assertion failures (PG-shared cases return current; configured-agent case falls back), not import/setup failures. [run_f03e6807f052b8bee5d12ce55a5a1bd9](https://crabbox.openclaw.ai/portal/runs/run_f03e6807f052b8bee5d12ce55a5a1bd9).
- Reader access is red on pre-ACL `997e3bd583`: actual PostgreSQL `42501 permission denied for schema` after source-owner checks, cloning and physical validation. [run_374698ce02d32a9c790a68028b747f1c](https://crabbox.openclaw.ai/portal/runs/run_374698ce02d32a9c790a68028b747f1c).
- The same deterministic 100-session/10,752-message/42 MiB prose recipe measured **22.030 s** for one direct state+agent copy (7.831 s state, 14.181 s agent), versus **44.9 s** for the earlier server capture+restore. This is prior-head primitive evidence at `4a2ac42861`; physical sizes were 109,199,360 B and 109,256,704 B, respectively. It excludes migration and Gateway readiness and is not a fleet-percentile claim.
- Implementation-head actual 1 GiB copy (`ad7e628030`): **91.312 s** summed API calls (state 6.295 s, agent 85.018 s); **94.903 s** enclosing interval includes receipt/bookkeeping. Fixture: 1,000 sessions, 114,688 messages, 448 MiB prose, 1,074,192,384 physical bytes. Actual in-clone ANALYZE was **8.923 ms / 924.153 ms**; COMMIT→statistics COMMIT **15 ms / 929 ms**, with no statement-cap hit. Same AWS c7a.8xlarge/32 CPUs/PG16.15 loopback environment. [run_ea0ba8f4997497d5471b2514409ac2c1](https://crabbox.openclaw.ai/portal/runs/run_ea0ba8f4997497d5471b2514409ac2c1). Copy interval alone uses 7.91% of the existing budget; migration and readiness are not included.
- Implementation-head static quality (`ad7e628030`): core and test typechecks, lint, format parity, line-cap, SQL-worker/dialect and import-cycle guards passed. That earlier `check:changed` run reported an unchanged UI dead export; the UI file and the main-only `plugin-npm-prepared-release-retained-producer.test.ts` ratchet finding were left unchanged. [run_a6eca5556aa261ea23377fa7ef465043](https://crabbox.openclaw.ai/portal/runs/run_a6eca5556aa261ea23377fa7ef465043). Final CI above is green.
- Additional AWS owner checks [run_5bfc8d62fbe03884f89f1e074d773274](https://crabbox.openclaw.ai/portal/runs/run_5bfc8d62fbe03884f89f1e074d773274), exit 0: real PostgreSQL mixed-engine migration/rollback/prune including a retained JSON configuration file (**3/3**), measured size-mode selection (**2/2**), core typecheck and database-worker ratchet (**166→166** live SQL calls). The earlier bounded update/report/Doctor/startup set passed **102 tests** before static checks found the explicit-return and duplicate-query issues now corrected; its obsolete static continuation was stopped.
- Corrected reporter/candidate full builds passed on `056e58a1f6` ([run_1600dd89588952b226d0c9a1c1464616](https://crabbox.openclaw.ai/portal/runs/run_1600dd89588952b226d0c9a1c1464616), including **83** report/startup-progress owner tests) and `816d247a8e` ([run_1806f6db08bd5a5b96115f85fc7371c0](https://crabbox.openclaw.ai/portal/runs/run_1806f6db08bd5a5b96115f85fc7371c0)).
- Real PG16 terminal-row regression: with the metadata guard removed, the live-custody test receives `undefined` instead of its terminal record; fixed code passes. [run_d6d5571a1f215a87f5595a2d208c00c7](https://crabbox.openclaw.ai/portal/runs/run_d6d5571a1f215a87f5595a2d208c00c7), exit 0. The test overlay SHA-256 `9e183ef1082b9919f31565434c84e98bd9f36efdae23ae3eebcf1029ada42a1e` matches the committed test.
- Historical BLOB corpus: `40910f1112` (before the trace change) and `f5b0f14e05` fail on the premature `Uint8Array` path; main `87f5739fbc` passes ([comparison run](https://crabbox.openclaw.ai/portal/runs/run_bd406b7313533d912b0cf2724017665e)). The corrected `eea155e5d7` full runtime build and corpus case pass, including **all original database `.pre-` hashes**: [run_036ade5c82663f841278cda6d372825b](https://crabbox.openclaw.ai/portal/runs/run_036ade5c82663f841278cda6d372825b), exit 0.

### Linux / PostgreSQL 16 live outcomes

Times are measured HTTP unavailability, with the sampled upper bound in parentheses—not total package-install time.

| Case / update run | Observed result | Unavailable seconds |
| --- | --- | --- |
| [Healthy `3216f87a`](https://crabbox.openclaw.ai/portal/runs/run_348b18b19173c81569cb78f95c97723b) | New namespace, schema 42, unchanged selected table counts; custom reader and default grants still work | 93.443 (93.945) |
| [Crash after private migration `8f78b578`](https://crabbox.openclaw.ai/portal/runs/run_a61b9c3d4becc39890a1efc1f29939c5) | Original namespace/schema 41 and old T serve; Control UI and rollback status reachable | 109.198 (109.700) |
| [Missing CREATE `06cfa933`](https://crabbox.openclaw.ai/portal/runs/run_a98b7abc71e6338fce59695e96e535c6) | Refuses before stop with exact grant; old boot ID unchanged | No unavailable samples |
| [Real space refusal `124b69ae`](https://crabbox.openclaw.ai/portal/runs/run_6c1b9afbbcdcf7e53cdcb9e3205c2fd3) | PG `53100` from a 64 MiB tablespace against a >100 MiB source; exit 78, schema-41 reporter serves; Settings and CLI name the space problem and remedy | 26.559 (27.063) |
| [During server copy](https://crabbox.openclaw.ai/portal/runs/run_e1068fb7d19e614c83fb4895f8118d84) | Backend transaction aborts after one interruption; retry succeeds | 102.281 (102.785) |
| [After private anchor, before live publication `c2462582`](https://crabbox.openclaw.ai/portal/runs/run_13461405a6ea35983c16ded96c9a2d79) | One interruption; retry succeeds | 105.403 (105.906) |
| [Corrected large-store CLI `26687f74`](https://crabbox.openclaw.ai/portal/runs/run_f6ff27e1f1f6dbf9ee1c96dfbd330585) | **Exit 0**, same namespace 41→42, real migration witness; notice in CLI, status and Settings | 20.602 (21.106) |

The corrected large-store run is [run_f6ff27e1f1f6dbf9ee1c96dfbd330585](https://crabbox.openclaw.ai/portal/runs/run_f6ff27e1f1f6dbf9ee1c96dfbd330585), exit 0. A qualification-only lowered threshold selects that branch on a small store; production policy is unchanged.

Cleanup was proved by **byte-identical replay of the existing durable plan**, not a claim that the earlier ad7 retry pruned successfully. Namespace inventory **32→30**: only failed state `restore_ea858c2cbd3241ee9273fb6fee420cdd` and agent `restore_b5af9a52198b4d87b57fcc3d8f755721` were dropped. Live `restore_a8c51d96f8d34ebd8fba8966297a85b3` / `restore_b3ce0081721947ef946c5abf222f6d21` and originals `pgcrash_state_4f1e55aebce84abd` / `pgcrash_agent_889dbaaff3c64c0d` stayed intact. No manual `DROP` or invented plan operations were used.

Cleanup observation: [run_d5c7866cee8a21eb5dd5e79f78ce1a64](https://crabbox.openclaw.ai/portal/runs/run_d5c7866cee8a21eb5dd5e79f78ce1a64).

Plugin maintenance still reports the existing engine-selection warning in these fixtures; core success is not relabelled or hidden. The recorded space cause retains a descriptor warning and generic triage wording alongside the visible free-space remedy.

## Large-store Decision and Named Limits

- **Final decision:** preparation reads the physical sizes of the namespaces that would be copied. At the measured simplification of **90 s/GiB**, an estimate of **at most 600 s** selects c2, leaving half of the existing 20-minute deadline for a retry. Above it, the existing in-place path remains available, without copy-only privilege requirements. Blocking updates would be worse than main for these users. This constant replaces a per-server rate estimate and should be revisited when actual larger-store rates are measured; there is no new user flag, configuration, timer or persisted field.
- A crash before a durable plan discards the private shadow and copies again on the second start. Both starts share that deadline; a large-store retry can expire safely and return to the old version. After publication, the next start sees the target version and reuses the selected namespace.
- **Post-COMMIT, at most ~10 s of planner statistics run before the private anchor is recorded. A crash there can leave one unreferenced namespace requiring manual cleanup.** The [COMMIT→statistics call](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/infra/database-engine/port.worker.ts#L707-L712) precedes the [private anchor write](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/snapshot/database-backup.operations.ts#L441-L456). The bound is the existing `postgres-planner-statistics.ts:16` statement timeout, not a new timer. No new marker was added.
- Deep, external and symlinked paths outside the installed launcher's recoverable inventory keep their ordinary Doctor captures but do not gain automatic data rollback here ([#204394](#204394)).
- A serving T that predates the generic exit-78 report projection still has its old first-hop message. Preparation-time permission refusal keeps its named reason; newer serving versions show recorded boot-refusal detail.
- An older preparer also does not persist the candidate's new informational size notice from a successful check. Candidate boot logs the in-place selection, but the large-store CLI/status notice proof starts an updated schema-41 reporter. This first-hop limitation does not change the older updater's baseline in-place behavior.
- Trial-only writes are discarded on rollback. A PostgreSQL outage is not repaired by restoring anchors; readiness, not a file-level rolled-back label, confirms recovery.
- Already-stranded installations without a preserved original namespace still require a compatible build or a verified matched backup. Never lower schema markers or drop uncertain namespaces to force startup.

## Final-head Scope and Test Budget

`ad7e628030..056e58a` adds physical-size selection and the existing persisted diagnostic notice for the large in-place branch. Below the threshold, the protected copy/migration path is unchanged. Live qualification found retained JSON configuration files reaching the PostgreSQL anchor reader during pruning; the final head filters that existing list once, covered by the real rollback/prune test. Actual disk-space refusal also exposed two diagnostic issues: the report preferred a truncated prefix over the full recorded stderr tail, and normal startup progress printed completion lines after a failed start. The final head uses the existing bounded tail and emits completion only for successful startup phases, leaving the refusal last; CLI finalization is unchanged. Other changes reuse the schema owner's typed content-version reader, make undefined preflight success explicit, compute retention once, correct the docs, and remove 136 redundant wiring-test lines. Mode selection, corrected cleanup and final cause visibility require their own final-source live proof; ad7 live runs do not prove those changes.

Final head `5bbf3e6712` has the `816d247a8e` package runtime plus the SQLite-only legacy-safe discovery correction proved by the BLOB corpus. Remaining changes are the verified test overlay, a test-local rename/import correction, allocation notes and documentation. No PostgreSQL runtime change is excluded from the final 816 package proof.

The CLI failure was a physical-read mismatch, not an uncompleted notice: a real PostgreSQL run was `finished/succeeded`, but `update.runs.get` read the SQLite anchor and returned `run:null`, so the existing follower timed out. The shortcut predates this PR (`1a74a80617cf`, #191332). The earlier PostgreSQL trial used Settings to start updates and `openclaw update status` to inspect them; it did not exercise foreground CLI following. The fix changes the reader owner, not polling, deadlines or the public protocol.

For historical BLOB registry paths, the existing preflight reader leaves non-string rows to Doctor. Both `main` and `ops` databases in the corpus are independently discovered at `agents/<id>/agent/openclaw-agent.sqlite`; the existing corpus test hashes **every** original database and checks its `.pre-` original (`test/state-upgrade.e2e.test.ts:189,247–248`). Non-default legacy BLOB registrations that fall outside that discovery remain a named #204394 limitation, not a new coercion or refusal.

Remaining test allocation (approved after those cuts):
- Real PostgreSQL ACL/non-superuser tests preserve reader access, ownership, grant options and historical layouts.
- Mixed-engine migration failure and crash recovery prove originals survive and only owned unreferenced namespaces are pruned.
- Copy-refusal tests prove preparation fails before stop with an actionable cause.
- Generic report projection and one nested startup-progress regression (tracing off/on) prove recorded boot-refusal remedies remain the final visible cause.
- One parameterized size-routing test proves under/over selection, the notice and retained SQLite protection.
- One real PostgreSQL terminal-read regression exercises the physical command path used by the CLI follower, rather than the SQLite anchor.

Production delta against the base: **+1192/−234, net +958 lines across 27 files**. The growth covers physical-engine inventory/validation, transactional access-right preservation, paired namespace retention, measured mode selection and refusal-output ordering. Existing duplicate private PostgreSQL capture work is removed; standalone and uncovered-store captures remain.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 25, 2026
…es (#204502)

Closes #204363

## What Problem This Solves

A PostgreSQL update can migrate its data and then crash. Restoring the previous package alone leaves that package unable to read the newer schema, so no Gateway serves.

## User Impact

Protected release trials migrate private server-side copies and publish their anchors only after validation. Failed trials select the original data with the previous release. SQLite agent databases under PostgreSQL shared state are protected in the same private pass.

The restart is longer. Plan for both server copies, indexes, WAL, temporary work and retained generations. Namespace names change on schema-changing updates; namespace-bound reporting, dump and grant-management scripts must use the current anchor. Source access grants and schema-local defaults are carried and verified, including grant options and column permissions.

## Why This Change Was Made

This extends the existing startup copy-and-swap owner, exact server carrier and durable file plan. It removes the PostgreSQL-anchor version-zero exclusion and its mixed-engine skip. It adds no application schema/version change, trial format, launcher SQL, public flag, timeout or retry loop. There is no portable-export or unprotected in-place fallback for protected stores.

The first verified server copy is the migration destination, not a frozen capture followed by a second restore. A separate frozen-export manifest would misdescribe a namespace that is about to migrate, so retention uses the existing preserved anchors, store UUID and exact role ownership. Normal frozen captures retain their isolation.

Shared state uses that server carrier too. The older backup owner withheld it because credential rollback needed exported shared-state rows; c2 instead retains those rows in the untouched original namespace, selected by the preserved anchor. That removes the need for a portable shared-state export in the protected trial without removing ordinary captures for uncovered stores.

<details>
<summary>Compatibility and inventory source notes</summary>

The physical PostgreSQL version is read in [`state-upgrade-databases.ts:83–92`](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/state/state-upgrade-databases.ts#L83-L92). Its [independent family-version filter](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/state/state-upgrade-databases.ts#L152-L153) replaces the old shared-state version-zero early return, so SQLite agents are not skipped when state uses PostgreSQL. Genuine fresh SQLite version-zero catalogs remain bootstrap-owned.

`v2026.8.1-beta.1` and `beta.2` wrote absolute registry paths. Schema 9 in [#124728](#124728) rewrites eligible in-tree rows to relative paths ([migration lines 269–278](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/state/openclaw-state-db-schema-repair.ts#L269-L278)); `beta.3` and stable include it, and PostgreSQL starts at schema 24. No new reader rebase or row rewriting is needed.

</details>

## Result Wording

- Preparation runs while the previous Gateway serves; a missing CREATE grant names the exact administrator SQL before stopping it.
- Candidate boot logs: “Preparing a protected PostgreSQL copy for OpenClaw … The previous data will stay available for recovery.”
- A healthy candidate keeps the normal update-success message.
- A recovered failed trial keeps the shared serving-version result and retry/report next action. Current versions also show the already-recorded exit-78 startup cause detail, including the server-space remedy.
- Namespace cleanup failure keeps the recovery pair and logs a warning; it never fails a serving release.
- Larger stores keep the existing in-place migration path, with this recorded notice: “This PostgreSQL store (X GiB) is too large to copy within the update window. It is migrated in place, without automatic data rollback. Back it up first: https://docs.openclaw.ai/install/updating#rollback”.

## Evidence

**Product qualification and final-head CI are complete: 89 checks passed, none failed or pending.** Actual [rollback and pre-stop privilege-refusal screenshots](#204502 (comment)) and [corrected space-remedy and successful in-place screenshots](#204502 (comment)) are attached. The corrected normal CLI update exits **0**; it supersedes the recorded pre-fix helper timeout. Every AWS lease was released with `--wait`, and task tunnels were stopped.

Final head: `5bbf3e6712d04546a8a8d639188976be606c7ef5`. [CI attempt 2](https://github.com/openclaw/openclaw/actions/runs/45379513209/attempts/2) and the [CI gate](https://github.com/openclaw/openclaw/actions/runs/45386761656) passed. One Doctor process-custody cleanup test failed on the first attempt; its [single authorized same-head retry](https://github.com/openclaw/openclaw/actions/runs/45379513209/job/138411642189) passed. No cleanup guard, assertion or product timeout was weakened.

- Complete AWS qualification archive builds and package checks passed: pristine reporter41 plus next42 and post-migration-crash42 fixtures from `ad7e628030`. [run_9f2fdf8a02d2aad39a29f67029739435](https://crabbox.openclaw.ai/portal/runs/run_9f2fdf8a02d2aad39a29f67029739435), exit 0. The large-mode fixture also built from `513b774d28` ([run_b92c7c5b1893ded6f4b4c02bbe3e8058](https://crabbox.openclaw.ai/portal/runs/run_b92c7c5b1893ded6f4b4c02bbe3e8058), exit 0). Schema 42 and the lowered large-mode threshold are disposable qualification overlays, not shipped schema or policy changes.

- PostgreSQL 16 focused owner run [run_0a734ee4124db7308ba39734795af613](https://crabbox.openclaw.ai/portal/runs/run_0a734ee4124db7308ba39734795af613): **7/7 pass** on `ad7e6280300163cf55c97987ca36229427a6e236`. Includes a non-superuser runtime owner, real reader and column-only roles, grant options, default grants for later tables, unchanged originals, both historical v39 layouts, mixed engines, frozen-launcher file recovery and owned namespace pruning.
- The new startup regression is red on base `0956e14e6814`: three intended assertion failures (PG-shared cases return current; configured-agent case falls back), not import/setup failures. [run_f03e6807f052b8bee5d12ce55a5a1bd9](https://crabbox.openclaw.ai/portal/runs/run_f03e6807f052b8bee5d12ce55a5a1bd9).
- Reader access is red on pre-ACL `997e3bd583`: actual PostgreSQL `42501 permission denied for schema` after source-owner checks, cloning and physical validation. [run_374698ce02d32a9c790a68028b747f1c](https://crabbox.openclaw.ai/portal/runs/run_374698ce02d32a9c790a68028b747f1c).
- The same deterministic 100-session/10,752-message/42 MiB prose recipe measured **22.030 s** for one direct state+agent copy (7.831 s state, 14.181 s agent), versus **44.9 s** for the earlier server capture+restore. This is prior-head primitive evidence at `4a2ac42861`; physical sizes were 109,199,360 B and 109,256,704 B, respectively. It excludes migration and Gateway readiness and is not a fleet-percentile claim.
- Implementation-head actual 1 GiB copy (`ad7e628030`): **91.312 s** summed API calls (state 6.295 s, agent 85.018 s); **94.903 s** enclosing interval includes receipt/bookkeeping. Fixture: 1,000 sessions, 114,688 messages, 448 MiB prose, 1,074,192,384 physical bytes. Actual in-clone ANALYZE was **8.923 ms / 924.153 ms**; COMMIT→statistics COMMIT **15 ms / 929 ms**, with no statement-cap hit. Same AWS c7a.8xlarge/32 CPUs/PG16.15 loopback environment. [run_ea0ba8f4997497d5471b2514409ac2c1](https://crabbox.openclaw.ai/portal/runs/run_ea0ba8f4997497d5471b2514409ac2c1). Copy interval alone uses 7.91% of the existing budget; migration and readiness are not included.
- Implementation-head static quality (`ad7e628030`): core and test typechecks, lint, format parity, line-cap, SQL-worker/dialect and import-cycle guards passed. That earlier `check:changed` run reported an unchanged UI dead export; the UI file and the main-only `plugin-npm-prepared-release-retained-producer.test.ts` ratchet finding were left unchanged. [run_a6eca5556aa261ea23377fa7ef465043](https://crabbox.openclaw.ai/portal/runs/run_a6eca5556aa261ea23377fa7ef465043). Final CI above is green.
- Additional AWS owner checks [run_5bfc8d62fbe03884f89f1e074d773274](https://crabbox.openclaw.ai/portal/runs/run_5bfc8d62fbe03884f89f1e074d773274), exit 0: real PostgreSQL mixed-engine migration/rollback/prune including a retained JSON configuration file (**3/3**), measured size-mode selection (**2/2**), core typecheck and database-worker ratchet (**166→166** live SQL calls). The earlier bounded update/report/Doctor/startup set passed **102 tests** before static checks found the explicit-return and duplicate-query issues now corrected; its obsolete static continuation was stopped.
- Corrected reporter/candidate full builds passed on `056e58a1f6` ([run_1600dd89588952b226d0c9a1c1464616](https://crabbox.openclaw.ai/portal/runs/run_1600dd89588952b226d0c9a1c1464616), including **83** report/startup-progress owner tests) and `816d247a8e` ([run_1806f6db08bd5a5b96115f85fc7371c0](https://crabbox.openclaw.ai/portal/runs/run_1806f6db08bd5a5b96115f85fc7371c0)).
- Real PG16 terminal-row regression: with the metadata guard removed, the live-custody test receives `undefined` instead of its terminal record; fixed code passes. [run_d6d5571a1f215a87f5595a2d208c00c7](https://crabbox.openclaw.ai/portal/runs/run_d6d5571a1f215a87f5595a2d208c00c7), exit 0. The test overlay SHA-256 `9e183ef1082b9919f31565434c84e98bd9f36efdae23ae3eebcf1029ada42a1e` matches the committed test.
- Historical BLOB corpus: `40910f1112` (before the trace change) and `f5b0f14e05` fail on the premature `Uint8Array` path; main `87f5739fbc` passes ([comparison run](https://crabbox.openclaw.ai/portal/runs/run_bd406b7313533d912b0cf2724017665e)). The corrected `eea155e5d7` full runtime build and corpus case pass, including **all original database `.pre-` hashes**: [run_036ade5c82663f841278cda6d372825b](https://crabbox.openclaw.ai/portal/runs/run_036ade5c82663f841278cda6d372825b), exit 0.

### Linux / PostgreSQL 16 live outcomes

Times are measured HTTP unavailability, with the sampled upper bound in parentheses—not total package-install time.

| Case / update run | Observed result | Unavailable seconds |
| --- | --- | --- |
| [Healthy `3216f87a`](https://crabbox.openclaw.ai/portal/runs/run_348b18b19173c81569cb78f95c97723b) | New namespace, schema 42, unchanged selected table counts; custom reader and default grants still work | 93.443 (93.945) |
| [Crash after private migration `8f78b578`](https://crabbox.openclaw.ai/portal/runs/run_a61b9c3d4becc39890a1efc1f29939c5) | Original namespace/schema 41 and old T serve; Control UI and rollback status reachable | 109.198 (109.700) |
| [Missing CREATE `06cfa933`](https://crabbox.openclaw.ai/portal/runs/run_a98b7abc71e6338fce59695e96e535c6) | Refuses before stop with exact grant; old boot ID unchanged | No unavailable samples |
| [Real space refusal `124b69ae`](https://crabbox.openclaw.ai/portal/runs/run_6c1b9afbbcdcf7e53cdcb9e3205c2fd3) | PG `53100` from a 64 MiB tablespace against a >100 MiB source; exit 78, schema-41 reporter serves; Settings and CLI name the space problem and remedy | 26.559 (27.063) |
| [During server copy](https://crabbox.openclaw.ai/portal/runs/run_e1068fb7d19e614c83fb4895f8118d84) | Backend transaction aborts after one interruption; retry succeeds | 102.281 (102.785) |
| [After private anchor, before live publication `c2462582`](https://crabbox.openclaw.ai/portal/runs/run_13461405a6ea35983c16ded96c9a2d79) | One interruption; retry succeeds | 105.403 (105.906) |
| [Corrected large-store CLI `26687f74`](https://crabbox.openclaw.ai/portal/runs/run_f6ff27e1f1f6dbf9ee1c96dfbd330585) | **Exit 0**, same namespace 41→42, real migration witness; notice in CLI, status and Settings | 20.602 (21.106) |

The corrected large-store run is [run_f6ff27e1f1f6dbf9ee1c96dfbd330585](https://crabbox.openclaw.ai/portal/runs/run_f6ff27e1f1f6dbf9ee1c96dfbd330585), exit 0. A qualification-only lowered threshold selects that branch on a small store; production policy is unchanged.

Cleanup was proved by **byte-identical replay of the existing durable plan**, not a claim that the earlier ad7 retry pruned successfully. Namespace inventory **32→30**: only failed state `restore_ea858c2cbd3241ee9273fb6fee420cdd` and agent `restore_b5af9a52198b4d87b57fcc3d8f755721` were dropped. Live `restore_a8c51d96f8d34ebd8fba8966297a85b3` / `restore_b3ce0081721947ef946c5abf222f6d21` and originals `pgcrash_state_4f1e55aebce84abd` / `pgcrash_agent_889dbaaff3c64c0d` stayed intact. No manual `DROP` or invented plan operations were used.

Cleanup observation: [run_d5c7866cee8a21eb5dd5e79f78ce1a64](https://crabbox.openclaw.ai/portal/runs/run_d5c7866cee8a21eb5dd5e79f78ce1a64).

Plugin maintenance still reports the existing engine-selection warning in these fixtures; core success is not relabelled or hidden. The recorded space cause retains a descriptor warning and generic triage wording alongside the visible free-space remedy.

## Large-store Decision and Named Limits

- **Final decision:** preparation reads the physical sizes of the namespaces that would be copied. At the measured simplification of **90 s/GiB**, an estimate of **at most 600 s** selects c2, leaving half of the existing 20-minute deadline for a retry. Above it, the existing in-place path remains available, without copy-only privilege requirements. Blocking updates would be worse than main for these users. This constant replaces a per-server rate estimate and should be revisited when actual larger-store rates are measured; there is no new user flag, configuration, timer or persisted field.
- A crash before a durable plan discards the private shadow and copies again on the second start. Both starts share that deadline; a large-store retry can expire safely and return to the old version. After publication, the next start sees the target version and reuses the selected namespace.
- **Post-COMMIT, at most ~10 s of planner statistics run before the private anchor is recorded. A crash there can leave one unreferenced namespace requiring manual cleanup.** The [COMMIT→statistics call](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/infra/database-engine/port.worker.ts#L707-L712) precedes the [private anchor write](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/snapshot/database-backup.operations.ts#L441-L456). The bound is the existing `postgres-planner-statistics.ts:16` statement timeout, not a new timer. No new marker was added.
- Deep, external and symlinked paths outside the installed launcher's recoverable inventory keep their ordinary Doctor captures but do not gain automatic data rollback here ([#204394](#204394)).
- A serving T that predates the generic exit-78 report projection still has its old first-hop message. Preparation-time permission refusal keeps its named reason; newer serving versions show recorded boot-refusal detail.
- An older preparer also does not persist the candidate's new informational size notice from a successful check. Candidate boot logs the in-place selection, but the large-store CLI/status notice proof starts an updated schema-41 reporter. This first-hop limitation does not change the older updater's baseline in-place behavior.
- Trial-only writes are discarded on rollback. A PostgreSQL outage is not repaired by restoring anchors; readiness, not a file-level rolled-back label, confirms recovery.
- Already-stranded installations without a preserved original namespace still require a compatible build or a verified matched backup. Never lower schema markers or drop uncertain namespaces to force startup.

## Final-head Scope and Test Budget

`ad7e628030..056e58a` adds physical-size selection and the existing persisted diagnostic notice for the large in-place branch. Below the threshold, the protected copy/migration path is unchanged. Live qualification found retained JSON configuration files reaching the PostgreSQL anchor reader during pruning; the final head filters that existing list once, covered by the real rollback/prune test. Actual disk-space refusal also exposed two diagnostic issues: the report preferred a truncated prefix over the full recorded stderr tail, and normal startup progress printed completion lines after a failed start. The final head uses the existing bounded tail and emits completion only for successful startup phases, leaving the refusal last; CLI finalization is unchanged. Other changes reuse the schema owner's typed content-version reader, make undefined preflight success explicit, compute retention once, correct the docs, and remove 136 redundant wiring-test lines. Mode selection, corrected cleanup and final cause visibility require their own final-source live proof; ad7 live runs do not prove those changes.

Final head `5bbf3e6712` has the `816d247a8e` package runtime plus the SQLite-only legacy-safe discovery correction proved by the BLOB corpus. Remaining changes are the verified test overlay, a test-local rename/import correction, allocation notes and documentation. No PostgreSQL runtime change is excluded from the final 816 package proof.

The CLI failure was a physical-read mismatch, not an uncompleted notice: a real PostgreSQL run was `finished/succeeded`, but `update.runs.get` read the SQLite anchor and returned `run:null`, so the existing follower timed out. The shortcut predates this PR (`1a74a80617cf`, #191332). The earlier PostgreSQL trial used Settings to start updates and `openclaw update status` to inspect them; it did not exercise foreground CLI following. The fix changes the reader owner, not polling, deadlines or the public protocol.

For historical BLOB registry paths, the existing preflight reader leaves non-string rows to Doctor. Both `main` and `ops` databases in the corpus are independently discovered at `agents/<id>/agent/openclaw-agent.sqlite`; the existing corpus test hashes **every** original database and checks its `.pre-` original (`test/state-upgrade.e2e.test.ts:189,247–248`). Non-default legacy BLOB registrations that fall outside that discovery remain a named #204394 limitation, not a new coercion or refusal.

Remaining test allocation (approved after those cuts):
- Real PostgreSQL ACL/non-superuser tests preserve reader access, ownership, grant options and historical layouts.
- Mixed-engine migration failure and crash recovery prove originals survive and only owned unreferenced namespaces are pruned.
- Copy-refusal tests prove preparation fails before stop with an actionable cause.
- Generic report projection and one nested startup-progress regression (tracing off/on) prove recorded boot-refusal remedies remain the final visible cause.
- One parameterized size-routing test proves under/over selection, the notice and retained SQLite protection.
- One real PostgreSQL terminal-read regression exercises the physical command path used by the CLI follower, rather than the SQLite anchor.

Production delta against the base: **+1192/−234, net +958 lines across 27 files**. The growth covers physical-engine inventory/validation, transactional access-right preservation, paired namespace retention, measured mode selection and refusal-output ordering. Existing duplicate private PostgreSQL capture work is removed; standalone and uncovered-store captures remain.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit c7b132a)
Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…es (openclaw#204502)

Closes openclaw#204363

## What Problem This Solves

A PostgreSQL update can migrate its data and then crash. Restoring the previous package alone leaves that package unable to read the newer schema, so no Gateway serves.

## User Impact

Protected release trials migrate private server-side copies and publish their anchors only after validation. Failed trials select the original data with the previous release. SQLite agent databases under PostgreSQL shared state are protected in the same private pass.

The restart is longer. Plan for both server copies, indexes, WAL, temporary work and retained generations. Namespace names change on schema-changing updates; namespace-bound reporting, dump and grant-management scripts must use the current anchor. Source access grants and schema-local defaults are carried and verified, including grant options and column permissions.

## Why This Change Was Made

This extends the existing startup copy-and-swap owner, exact server carrier and durable file plan. It removes the PostgreSQL-anchor version-zero exclusion and its mixed-engine skip. It adds no application schema/version change, trial format, launcher SQL, public flag, timeout or retry loop. There is no portable-export or unprotected in-place fallback for protected stores.

The first verified server copy is the migration destination, not a frozen capture followed by a second restore. A separate frozen-export manifest would misdescribe a namespace that is about to migrate, so retention uses the existing preserved anchors, store UUID and exact role ownership. Normal frozen captures retain their isolation.

Shared state uses that server carrier too. The older backup owner withheld it because credential rollback needed exported shared-state rows; c2 instead retains those rows in the untouched original namespace, selected by the preserved anchor. That removes the need for a portable shared-state export in the protected trial without removing ordinary captures for uncovered stores.

<details>
<summary>Compatibility and inventory source notes</summary>

The physical PostgreSQL version is read in [`state-upgrade-databases.ts:83–92`](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/state/state-upgrade-databases.ts#L83-L92). Its [independent family-version filter](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/state/state-upgrade-databases.ts#L152-L153) replaces the old shared-state version-zero early return, so SQLite agents are not skipped when state uses PostgreSQL. Genuine fresh SQLite version-zero catalogs remain bootstrap-owned.

`v2026.8.1-beta.1` and `beta.2` wrote absolute registry paths. Schema 9 in [openclaw#124728](openclaw#124728) rewrites eligible in-tree rows to relative paths ([migration lines 269–278](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/state/openclaw-state-db-schema-repair.ts#L269-L278)); `beta.3` and stable include it, and PostgreSQL starts at schema 24. No new reader rebase or row rewriting is needed.

</details>

## Result Wording

- Preparation runs while the previous Gateway serves; a missing CREATE grant names the exact administrator SQL before stopping it.
- Candidate boot logs: “Preparing a protected PostgreSQL copy for OpenClaw … The previous data will stay available for recovery.”
- A healthy candidate keeps the normal update-success message.
- A recovered failed trial keeps the shared serving-version result and retry/report next action. Current versions also show the already-recorded exit-78 startup cause detail, including the server-space remedy.
- Namespace cleanup failure keeps the recovery pair and logs a warning; it never fails a serving release.
- Larger stores keep the existing in-place migration path, with this recorded notice: “This PostgreSQL store (X GiB) is too large to copy within the update window. It is migrated in place, without automatic data rollback. Back it up first: https://docs.openclaw.ai/install/updating#rollback”.

## Evidence

**Product qualification and final-head CI are complete: 89 checks passed, none failed or pending.** Actual [rollback and pre-stop privilege-refusal screenshots](openclaw#204502 (comment)) and [corrected space-remedy and successful in-place screenshots](openclaw#204502 (comment)) are attached. The corrected normal CLI update exits **0**; it supersedes the recorded pre-fix helper timeout. Every AWS lease was released with `--wait`, and task tunnels were stopped.

Final head: `5bbf3e6712d04546a8a8d639188976be606c7ef5`. [CI attempt 2](https://github.com/openclaw/openclaw/actions/runs/45379513209/attempts/2) and the [CI gate](https://github.com/openclaw/openclaw/actions/runs/45386761656) passed. One Doctor process-custody cleanup test failed on the first attempt; its [single authorized same-head retry](https://github.com/openclaw/openclaw/actions/runs/45379513209/job/138411642189) passed. No cleanup guard, assertion or product timeout was weakened.

- Complete AWS qualification archive builds and package checks passed: pristine reporter41 plus next42 and post-migration-crash42 fixtures from `ad7e628030`. [run_9f2fdf8a02d2aad39a29f67029739435](https://crabbox.openclaw.ai/portal/runs/run_9f2fdf8a02d2aad39a29f67029739435), exit 0. The large-mode fixture also built from `513b774d28` ([run_b92c7c5b1893ded6f4b4c02bbe3e8058](https://crabbox.openclaw.ai/portal/runs/run_b92c7c5b1893ded6f4b4c02bbe3e8058), exit 0). Schema 42 and the lowered large-mode threshold are disposable qualification overlays, not shipped schema or policy changes.

- PostgreSQL 16 focused owner run [run_0a734ee4124db7308ba39734795af613](https://crabbox.openclaw.ai/portal/runs/run_0a734ee4124db7308ba39734795af613): **7/7 pass** on `ad7e6280300163cf55c97987ca36229427a6e236`. Includes a non-superuser runtime owner, real reader and column-only roles, grant options, default grants for later tables, unchanged originals, both historical v39 layouts, mixed engines, frozen-launcher file recovery and owned namespace pruning.
- The new startup regression is red on base `5c569ef59a78`: three intended assertion failures (PG-shared cases return current; configured-agent case falls back), not import/setup failures. [run_f03e6807f052b8bee5d12ce55a5a1bd9](https://crabbox.openclaw.ai/portal/runs/run_f03e6807f052b8bee5d12ce55a5a1bd9).
- Reader access is red on pre-ACL `997e3bd583`: actual PostgreSQL `42501 permission denied for schema` after source-owner checks, cloning and physical validation. [run_374698ce02d32a9c790a68028b747f1c](https://crabbox.openclaw.ai/portal/runs/run_374698ce02d32a9c790a68028b747f1c).
- The same deterministic 100-session/10,752-message/42 MiB prose recipe measured **22.030 s** for one direct state+agent copy (7.831 s state, 14.181 s agent), versus **44.9 s** for the earlier server capture+restore. This is prior-head primitive evidence at `4a2ac42861`; physical sizes were 109,199,360 B and 109,256,704 B, respectively. It excludes migration and Gateway readiness and is not a fleet-percentile claim.
- Implementation-head actual 1 GiB copy (`ad7e628030`): **91.312 s** summed API calls (state 6.295 s, agent 85.018 s); **94.903 s** enclosing interval includes receipt/bookkeeping. Fixture: 1,000 sessions, 114,688 messages, 448 MiB prose, 1,074,192,384 physical bytes. Actual in-clone ANALYZE was **8.923 ms / 924.153 ms**; COMMIT→statistics COMMIT **15 ms / 929 ms**, with no statement-cap hit. Same AWS c7a.8xlarge/32 CPUs/PG16.15 loopback environment. [run_ea0ba8f4997497d5471b2514409ac2c1](https://crabbox.openclaw.ai/portal/runs/run_ea0ba8f4997497d5471b2514409ac2c1). Copy interval alone uses 7.91% of the existing budget; migration and readiness are not included.
- Implementation-head static quality (`ad7e628030`): core and test typechecks, lint, format parity, line-cap, SQL-worker/dialect and import-cycle guards passed. That earlier `check:changed` run reported an unchanged UI dead export; the UI file and the main-only `plugin-npm-prepared-release-retained-producer.test.ts` ratchet finding were left unchanged. [run_a6eca5556aa261ea23377fa7ef465043](https://crabbox.openclaw.ai/portal/runs/run_a6eca5556aa261ea23377fa7ef465043). Final CI above is green.
- Additional AWS owner checks [run_5bfc8d62fbe03884f89f1e074d773274](https://crabbox.openclaw.ai/portal/runs/run_5bfc8d62fbe03884f89f1e074d773274), exit 0: real PostgreSQL mixed-engine migration/rollback/prune including a retained JSON configuration file (**3/3**), measured size-mode selection (**2/2**), core typecheck and database-worker ratchet (**166→166** live SQL calls). The earlier bounded update/report/Doctor/startup set passed **102 tests** before static checks found the explicit-return and duplicate-query issues now corrected; its obsolete static continuation was stopped.
- Corrected reporter/candidate full builds passed on `056e58a1f6` ([run_1600dd89588952b226d0c9a1c1464616](https://crabbox.openclaw.ai/portal/runs/run_1600dd89588952b226d0c9a1c1464616), including **83** report/startup-progress owner tests) and `816d247a8e` ([run_1806f6db08bd5a5b96115f85fc7371c0](https://crabbox.openclaw.ai/portal/runs/run_1806f6db08bd5a5b96115f85fc7371c0)).
- Real PG16 terminal-row regression: with the metadata guard removed, the live-custody test receives `undefined` instead of its terminal record; fixed code passes. [run_d6d5571a1f215a87f5595a2d208c00c7](https://crabbox.openclaw.ai/portal/runs/run_d6d5571a1f215a87f5595a2d208c00c7), exit 0. The test overlay SHA-256 `9e183ef1082b9919f31565434c84e98bd9f36efdae23ae3eebcf1029ada42a1e` matches the committed test.
- Historical BLOB corpus: `40910f1112` (before the trace change) and `f5b0f14e05` fail on the premature `Uint8Array` path; main `47b6dfba22` passes ([comparison run](https://crabbox.openclaw.ai/portal/runs/run_bd406b7313533d912b0cf2724017665e)). The corrected `eea155e5d7` full runtime build and corpus case pass, including **all original database `.pre-` hashes**: [run_036ade5c82663f841278cda6d372825b](https://crabbox.openclaw.ai/portal/runs/run_036ade5c82663f841278cda6d372825b), exit 0.

### Linux / PostgreSQL 16 live outcomes

Times are measured HTTP unavailability, with the sampled upper bound in parentheses—not total package-install time.

| Case / update run | Observed result | Unavailable seconds |
| --- | --- | --- |
| [Healthy `3216f87a`](https://crabbox.openclaw.ai/portal/runs/run_348b18b19173c81569cb78f95c97723b) | New namespace, schema 42, unchanged selected table counts; custom reader and default grants still work | 93.443 (93.945) |
| [Crash after private migration `8f78b578`](https://crabbox.openclaw.ai/portal/runs/run_a61b9c3d4becc39890a1efc1f29939c5) | Original namespace/schema 41 and old T serve; Control UI and rollback status reachable | 109.198 (109.700) |
| [Missing CREATE `06cfa933`](https://crabbox.openclaw.ai/portal/runs/run_a98b7abc71e6338fce59695e96e535c6) | Refuses before stop with exact grant; old boot ID unchanged | No unavailable samples |
| [Real space refusal `124b69ae`](https://crabbox.openclaw.ai/portal/runs/run_6c1b9afbbcdcf7e53cdcb9e3205c2fd3) | PG `53100` from a 64 MiB tablespace against a >100 MiB source; exit 78, schema-41 reporter serves; Settings and CLI name the space problem and remedy | 26.559 (27.063) |
| [During server copy](https://crabbox.openclaw.ai/portal/runs/run_e1068fb7d19e614c83fb4895f8118d84) | Backend transaction aborts after one interruption; retry succeeds | 102.281 (102.785) |
| [After private anchor, before live publication `c2462582`](https://crabbox.openclaw.ai/portal/runs/run_13461405a6ea35983c16ded96c9a2d79) | One interruption; retry succeeds | 105.403 (105.906) |
| [Corrected large-store CLI `26687f74`](https://crabbox.openclaw.ai/portal/runs/run_f6ff27e1f1f6dbf9ee1c96dfbd330585) | **Exit 0**, same namespace 41→42, real migration witness; notice in CLI, status and Settings | 20.602 (21.106) |

The corrected large-store run is [run_f6ff27e1f1f6dbf9ee1c96dfbd330585](https://crabbox.openclaw.ai/portal/runs/run_f6ff27e1f1f6dbf9ee1c96dfbd330585), exit 0. A qualification-only lowered threshold selects that branch on a small store; production policy is unchanged.

Cleanup was proved by **byte-identical replay of the existing durable plan**, not a claim that the earlier ad7 retry pruned successfully. Namespace inventory **32→30**: only failed state `restore_ea858c2cbd3241ee9273fb6fee420cdd` and agent `restore_b5af9a52198b4d87b57fcc3d8f755721` were dropped. Live `restore_a8c51d96f8d34ebd8fba8966297a85b3` / `restore_b3ce0081721947ef946c5abf222f6d21` and originals `pgcrash_state_4f1e55aebce84abd` / `pgcrash_agent_889dbaaff3c64c0d` stayed intact. No manual `DROP` or invented plan operations were used.

Cleanup observation: [run_d5c7866cee8a21eb5dd5e79f78ce1a64](https://crabbox.openclaw.ai/portal/runs/run_d5c7866cee8a21eb5dd5e79f78ce1a64).

Plugin maintenance still reports the existing engine-selection warning in these fixtures; core success is not relabelled or hidden. The recorded space cause retains a descriptor warning and generic triage wording alongside the visible free-space remedy.

## Large-store Decision and Named Limits

- **Final decision:** preparation reads the physical sizes of the namespaces that would be copied. At the measured simplification of **90 s/GiB**, an estimate of **at most 600 s** selects c2, leaving half of the existing 20-minute deadline for a retry. Above it, the existing in-place path remains available, without copy-only privilege requirements. Blocking updates would be worse than main for these users. This constant replaces a per-server rate estimate and should be revisited when actual larger-store rates are measured; there is no new user flag, configuration, timer or persisted field.
- A crash before a durable plan discards the private shadow and copies again on the second start. Both starts share that deadline; a large-store retry can expire safely and return to the old version. After publication, the next start sees the target version and reuses the selected namespace.
- **Post-COMMIT, at most ~10 s of planner statistics run before the private anchor is recorded. A crash there can leave one unreferenced namespace requiring manual cleanup.** The [COMMIT→statistics call](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/infra/database-engine/port.worker.ts#L707-L712) precedes the [private anchor write](https://github.com/openclaw/openclaw/blob/ad7e6280300163cf55c97987ca36229427a6e236/src/snapshot/database-backup.operations.ts#L441-L456). The bound is the existing `postgres-planner-statistics.ts:16` statement timeout, not a new timer. No new marker was added.
- Deep, external and symlinked paths outside the installed launcher's recoverable inventory keep their ordinary Doctor captures but do not gain automatic data rollback here ([openclaw#204394](openclaw#204394)).
- A serving T that predates the generic exit-78 report projection still has its old first-hop message. Preparation-time permission refusal keeps its named reason; newer serving versions show recorded boot-refusal detail.
- An older preparer also does not persist the candidate's new informational size notice from a successful check. Candidate boot logs the in-place selection, but the large-store CLI/status notice proof starts an updated schema-41 reporter. This first-hop limitation does not change the older updater's baseline in-place behavior.
- Trial-only writes are discarded on rollback. A PostgreSQL outage is not repaired by restoring anchors; readiness, not a file-level rolled-back label, confirms recovery.
- Already-stranded installations without a preserved original namespace still require a compatible build or a verified matched backup. Never lower schema markers or drop uncertain namespaces to force startup.

## Final-head Scope and Test Budget

`ad7e628030..056e58a` adds physical-size selection and the existing persisted diagnostic notice for the large in-place branch. Below the threshold, the protected copy/migration path is unchanged. Live qualification found retained JSON configuration files reaching the PostgreSQL anchor reader during pruning; the final head filters that existing list once, covered by the real rollback/prune test. Actual disk-space refusal also exposed two diagnostic issues: the report preferred a truncated prefix over the full recorded stderr tail, and normal startup progress printed completion lines after a failed start. The final head uses the existing bounded tail and emits completion only for successful startup phases, leaving the refusal last; CLI finalization is unchanged. Other changes reuse the schema owner's typed content-version reader, make undefined preflight success explicit, compute retention once, correct the docs, and remove 136 redundant wiring-test lines. Mode selection, corrected cleanup and final cause visibility require their own final-source live proof; ad7 live runs do not prove those changes.

Final head `5bbf3e6712` has the `816d247a8e` package runtime plus the SQLite-only legacy-safe discovery correction proved by the BLOB corpus. Remaining changes are the verified test overlay, a test-local rename/import correction, allocation notes and documentation. No PostgreSQL runtime change is excluded from the final 816 package proof.

The CLI failure was a physical-read mismatch, not an uncompleted notice: a real PostgreSQL run was `finished/succeeded`, but `update.runs.get` read the SQLite anchor and returned `run:null`, so the existing follower timed out. The shortcut predates this PR (`ba58d6a00b17`, openclaw#191332). The earlier PostgreSQL trial used Settings to start updates and `openclaw update status` to inspect them; it did not exercise foreground CLI following. The fix changes the reader owner, not polling, deadlines or the public protocol.

For historical BLOB registry paths, the existing preflight reader leaves non-string rows to Doctor. Both `main` and `ops` databases in the corpus are independently discovered at `agents/<id>/agent/openclaw-agent.sqlite`; the existing corpus test hashes **every** original database and checks its `.pre-` original (`test/state-upgrade.e2e.test.ts:189,247–248`). Non-default legacy BLOB registrations that fall outside that discovery remain a named openclaw#204394 limitation, not a new coercion or refusal.

Remaining test allocation (approved after those cuts):
- Real PostgreSQL ACL/non-superuser tests preserve reader access, ownership, grant options and historical layouts.
- Mixed-engine migration failure and crash recovery prove originals survive and only owned unreferenced namespaces are pruned.
- Copy-refusal tests prove preparation fails before stop with an actionable cause.
- Generic report projection and one nested startup-progress regression (tracing off/on) prove recorded boot-refusal remedies remain the final visible cause.
- One parameterized size-routing test proves under/over selection, the notice and retained SQLite protection.
- One real PostgreSQL terminal-read regression exercises the physical command path used by the CLI follower, rather than the SQLite anchor.

Production delta against the base: **+1192/−234, net +958 lines across 27 files**. The growth covers physical-engine inventory/validation, transactional access-right preservation, paired namespace retention, measured mode selection and refusal-output ordering. Existing duplicate private PostgreSQL capture work is removed; standalone and uncovered-store captures remain.

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

Labels

app: macos App: macos channel: voice-call Channel integration: voice-call docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M 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