Skip to content

refactor(state): move device identity into canonical SQLite state - #110392

Merged
steipete merged 22 commits into
mainfrom
codex/sqlite-device-identity
Jul 18, 2026
Merged

steipete merged 22 commits into
mainfrom
codex/sqlite-device-identity

Conversation

@steipete

@steipete steipete commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

#110611 landed as prerequisite commit 3e8f1c6448a5b4041e78c297e1a7955c95cadda9; this PR now targets main.

Related: #107227

What Problem This Solves

OpenClaw still treated identity/device.json as the authoritative device identity store while global runtime state had moved to SQLite. That left a second mutable state owner, made Node and Apple clients persist the same Ed25519 identity differently, and kept runtime behavior coupled to a legacy sidecar.

Why This Change Was Made

This moves the stable device identity keypair into the existing typed device_identities table in the shared state database. Runtime code reads and writes SQLite only. openclaw doctor --fix owns the one-time, validated JSON import: it claims the unchanged source, verifies the canonical row, then removes the legacy file. Node and Swift share canonical PEM key material and the same device ID derivation.

Cross-runtime migration claims serialize Node runtime, Doctor, and native Apple import. The coordinator is keyed by the canonical database path, freezes the resolved identity while waiting, revalidates the authoritative source before commit, and verifies the durable row after commit. Aggregate operation and cleanup failures retain both errors.

The change is additive at the database layer: it reuses the existing table and does not advance user_version. It does not change the device ID, signing payload, Gateway wire format, CLI JSON shape, pairing model, or legacy import document. Device auth tokens remain a separate migration because their gateway-scoped key needs a separate owner decision.

User Impact

Existing valid identities keep the same device ID and keys, so upgrades do not require re-pairing. Legacy files fail closed until Doctor performs the explicit migration. Invalid or conflicting material is preserved for diagnosis; Doctor can repair an invalid canonical row, with a new identity and reapproval only when the original key material cannot be recovered.

This is a one-way database-first cutover. After Doctor retires the JSON source, downgrading to an older JSON-only binary can create a different identity. Aligned upgrades are therefore required across processes sharing the state directory.

Evidence

  • Exact head: 84536b7d6e24e5f700fba19881068396d4679dd7, targeting main after fix(plugin-sdk): refresh memory runtime API baseline #110611 landed. git range-diff proves all 22 identity commits patch-identical to prior fully reviewed head 833680d025ac55c612ca2621a22c4ef92fb535c2.
  • The head advances the prior reviewed identity stack by four behavior-neutral cleanup commits: test-only wrappers moved out of the app module, the unshipped throw-only error type became a categorized NSError factory, package-test callers moved to the canonical internal seam, and the gateway readiness test now pins the TaskLocal state directory used by its SQLite identity. Runtime entry points, localized error messages, and migration behavior are unchanged.
  • Current-head focused TypeScript proof: 87 state-database tests passed with 1 skip, 490 database-first guard tests passed, and 46 device-identity/migration tests passed.
  • Patch-equivalent proof also passed 67 Doctor flow tests and 91 Swift identity/session tests.
  • Current exact-head hosted CI is green: 95 passed checks, 33 intentional skips, and no failure or pending check. Capacity-only queued macOS/iOS lanes were rerun as attempt 2; macos-swift, macos-node, ios-build, and openclaw/ci-gate all passed in run 29651466734.
  • Full architecture chain, Kysely guardrails, dead-code exports, iOS SwiftFormat, node --max-old-space-size=8192 --import tsx scripts/generate-plugin-sdk-api-baseline.ts --check, targeted lint/format, and git diff --check passed. The identity enum is below the 900-line SwiftLint cap. The final head also passes a focused OpenClawKit target build and exact SwiftFormat check.
  • Fresh autoreview of the state-isolation cleanup reported one non-actionable claim at 0.92; source verification rejected it because the readiness-failure reset remains immediately before descriptor installation and also in deferred cleanup. The prior caller cleanup was clean at 0.99, error-type cleanup at 0.97, test-API cleanup at 0.98, exact CI-gate review at 0.94, and caught-error preservation at 0.97; earlier coordinator and migration reviews were also clean.

Maintainer Decision

Accepted by the maintainer's explicit land all instruction: Doctor-required legacy import, coordinated versions for processes sharing one state directory, and no supported downgrade to a JSON-only binary after migration.

AI-assisted: yes. I understand and reviewed the runtime, migration, cryptographic, and native-client behavior.

@steipete
steipete requested a review from a team as a code owner July 18, 2026 03:58
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: ios App: ios app: macos App: macos gateway Gateway runtime cli CLI command changes scripts Repository scripts commands Command implementations agents Agent runtime and tooling plugin: file-transfer size: XL maintainer Maintainer-authored PR labels Jul 18, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 18, 2026
@clawsweeper

clawsweeper Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 12:12 PM ET / 16:12 UTC.

Summary
The PR moves Node and Apple device identities from identity/device.json into the shared SQLite device_identities table, with openclaw doctor --fix as the legacy-import owner.

PR surface: Source +1502, Tests +1141, Docs -2, Other +1583. Total +4224 across 73 files.

Reproducibility: yes. source-reproducible with medium confidence: make persisted identity loading fail during the full reset path with no gateway stable ID, then observe that the guard returns before broader onboarding and credential cleanup runs.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: database schema: apps/shared/OpenClawKit/Sources/OpenClawKit/DeviceIdentitySQLiteStore.swift, database schema: src/state/openclaw-state-db.test.ts, migration/backfill/repair: apps/shared/OpenClawKit/Sources/OpenClawKit/DeviceIdentitySQLiteStore.swift, migration/backfill/repair: docs/gateway/doctor.md, migration/backfill/repair: scripts/e2e/lib/upgrade-survivor/update-restart-auth.sh, migration/backfill/repair: src/commands/doctor-config-flow.test.ts, and 28 more. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Change full reset so identity-independent cleanup completes when persisted identity loading fails.
  • [P1] Attach redacted terminal or runtime-log proof of openclaw doctor --fix importing a legacy identity, preserving its device ID, and permitting subsequent runtime use.
  • Obtain explicit maintainer acceptance of the documented one-way downgrade and mixed-version contract.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body provides extensive test and CI claims, but no inspectable redacted terminal output, runtime logs, recording, or linked artifact showing a real legacy identity import, retained device ID, and subsequent runtime use; add that evidence without private keys, tokens, paths, or endpoints. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] An upgrade with a corrupt or inaccessible SQLite identity can leave iOS full onboarding reset unable to clear stale gateway credentials, TLS/header state, and onboarding flags, blocking the intended recovery path.
  • [P1] The documented one-way cutover can change an existing device identity after an unsupported downgrade or mixed-version use of the same state directory; that affects pairing and stored device-auth tokens.
  • [P1] The PR body reports focused tests and CI, but it does not provide inspectable after-fix evidence of a real legacy identity/device.json import followed by runtime use and recovery behavior.

Maintainer options:

  1. Repair reset and prove migration (recommended)
    Keep the SQLite ownership design, but let full reset complete without identity and attach redacted live Doctor-import plus runtime-use evidence before merge.
  2. Accept the cutover contract
    A maintainer may explicitly accept Doctor-required migration and unsupported mixed-version or downgrade sharing after the recovery path and proof are satisfactory.
  3. Pause for upgrade-policy redesign
    Defer the PR if OpenClaw needs a supported rollback or mixed-version contract rather than this one-way state cutover.

Next step before merge

  • [P1] A narrow reset repair is visible, but the PR also requires contributor-owned runtime proof and a maintainer decision on the permanent upgrade contract.

Maintainer decision needed

  • Question: Should OpenClaw accept this Doctor-required one-way device-identity cutover, including fail-closed legacy files and unsupported downgrade/mixed-version sharing after migration?
  • Rationale: The implementation deliberately changes the supported upgrade and rollback contract for cryptographic device identity; source review cannot determine whether that operational tradeoff is acceptable for existing deployments.
  • Likely owner: steipete — The supplied history ties this contributor to both the current migration design and its merged prerequisite, making them the best available routing candidate for the decision packet.
  • Options:
    • Accept after recovery proof (recommended): Approve the documented one-way cutover after the reset regression is fixed and a redacted legacy-import and post-import runtime proof is attached.
    • Preserve a compatibility path: Require an explicit, supported upgrade or rollback strategy for older JSON-only processes before accepting the canonical SQLite cutover.

Security
Cleared: The inspected diff changes local cryptographic identity persistence and migration handling but introduces no concrete new secret-exposure, dependency, workflow, or supply-chain defect.

Review findings

  • [P2] Let full onboarding reset complete without identity — apps/ios/Sources/Onboarding/GatewayOnboardingReset.swift:27-33
Review details

Best possible solution:

Make full onboarding reset clear all identity-independent state even when identity loading fails, attach redacted real-run evidence that Doctor preserves an existing device ID and allows subsequent runtime use, then obtain explicit maintainer acceptance of the one-way mixed-version and downgrade contract.

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

Yes, source-reproducible with medium confidence: make persisted identity loading fail during the full reset path with no gateway stable ID, then observe that the guard returns before broader onboarding and credential cleanup runs.

Is this the best way to solve the issue?

No: canonical SQLite ownership and Doctor-only migration fit the repository direction, but the reset must not depend on identity loading and the one-way upgrade contract still needs explicit maintainer acceptance.

Full review comments:

  • [P2] Let full onboarding reset complete without identity — apps/ios/Sources/Onboarding/GatewayOnboardingReset.swift:27-33
    Do not return from the full-reset paths when preparePairingState cannot load a persisted identity. That failure should skip only device-scoped token deletion; returning here leaves stale credentials and onboarding state intact when reset is needed for recovery. This repeats the prior reported blocker because the relevant reset guard remains in the current head.
    Confidence: 0.92

Overall correctness: patch is incorrect
Overall confidence: 0.86

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P2: This is a broad but bounded device-identity migration with a concrete recovery-path defect and meaningful upgrade risk, not an established emergency regression.
  • merge-risk: 🚨 compatibility: The PR retires a shipped JSON identity store in favor of SQLite and explicitly documents a one-way upgrade with no JSON-only downgrade support.
  • merge-risk: 🚨 auth-provider: The migrated identity is used for signed gateway authentication, pairing, and lookup of device-scoped auth tokens.
  • merge-risk: 🚨 availability: A missing or invalid persisted identity can currently prevent the iOS full-reset recovery flow from clearing broader broken pairing state.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body provides extensive test and CI claims, but no inspectable redacted terminal output, runtime logs, recording, or linked artifact showing a real legacy identity import, retained device ID, and subsequent runtime use; add that evidence without private keys, tokens, paths, or endpoints. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +1502, Tests +1141, Docs -2, Other +1583. Total +4224 across 73 files.

View PR surface stats
Area Files Added Removed Net
Source 23 1803 301 +1502
Tests 24 1481 340 +1141
Docs 4 35 37 -2
Config 0 0 0 0
Generated 0 0 0 0
Other 22 2132 549 +1583
Total 73 5451 1227 +4224

What I checked:

  • Current reset behavior: The changed onboarding reset code still guards the full reset on prepare(...); an unavailable or invalid persisted identity therefore returns before clearing the broader pairing/onboarding state, even though only device-scoped token cleanup needs an identity. (apps/ios/Sources/Onboarding/GatewayOnboardingReset.swift:27, 84536b7d6e24)
  • Prior review continuity: The prior ClawSweeper cycle identified the same full-reset failure path at commit 833680d025ac55c612ca2621a22c4ef92fb535c2; the supplied latest commit is a macOS gateway-readiness test isolation commit, so the unresolved iOS recovery concern remains relevant. (apps/ios/Sources/Onboarding/GatewayOnboardingReset.swift:27, 84536b7d6e24)
  • One-way upgrade contract: The PR body explicitly describes a Doctor-required, one-way JSON-to-SQLite cutover with no supported downgrade to a JSON-only binary and coordinated versions for processes sharing a state directory. (src/infra/state-migrations.device-identity.ts:1, 84536b7d6e24)
  • Doctor-only migration wiring: The changed Doctor preflight and health flow pass doctorOnlyStateMigrations only during explicit repair, matching the repository policy that runtime consumes canonical state and Doctor owns legacy migration. (src/flows/doctor-health-contributions.ts:521, 84536b7d6e24)
  • Related prerequisite landed: The supplied related-item context shows the Plugin SDK baseline prerequisite merged as commit 3e8f1c6448a5b4041e78c297e1a7955c95cadda9; it removes the stated stacked prerequisite but does not resolve this PR's migration and recovery review. (3e8f1c6448a5)

Likely related people:

  • steipete: Authored the merged prerequisite on current main and the complete device-identity migration stack, including the current recovery and Apple-runtime changes; the supplied context does not expose a stronger independent ownership trail. (role: adjacent current-main contributor and migration author; confidence: medium; commits: a1fad5d50964, 84536b7d6e24; files: src/infra/device-identity.ts, src/infra/state-migrations.device-identity.ts, apps/ios/Sources/Onboarding/GatewayOnboardingReset.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-18T12:36:59.638Z sha d7c329c :: needs maintainer review before merge. :: none
  • reviewed 2026-07-18T12:52:03.338Z sha a1e864c :: needs maintainer review before merge. :: none
  • reviewed 2026-07-18T13:32:26.184Z sha 0501d29 :: found issues before merge. :: [P1] Restrict legacy root probing to the fallback state directory
  • reviewed 2026-07-18T13:55:07.257Z sha 24ae600 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-18T14:24:17.452Z sha 37455e4 :: needs real behavior proof before merge. :: [P2] Let full reset continue when identity loading fails
  • reviewed 2026-07-18T14:54:26.728Z sha 833680d :: needs real behavior proof before merge. :: [P2] Allow full reset to proceed without identity
  • reviewed 2026-07-18T15:18:27.403Z sha 833680d :: needs real behavior proof before merge. :: [P2] Allow full reset to proceed without identity
  • reviewed 2026-07-18T16:00:41.330Z sha 833680d :: needs real behavior proof before merge. :: [P2] Keep full reset independent of identity loading

@steipete
steipete force-pushed the codex/sqlite-device-identity branch from d340366 to c1f0e62 Compare July 18, 2026 07:01
@steipete
steipete force-pushed the codex/sqlite-device-identity branch from c1f0e62 to 36219f8 Compare July 18, 2026 08:11
@steipete steipete self-assigned this Jul 18, 2026
@steipete
steipete force-pushed the codex/sqlite-device-identity branch 2 times, most recently from 4328e27 to d7c329c Compare July 18, 2026 12:33
@steipete
steipete changed the base branch from main to codex/plugin-sdk-api-baseline-refresh July 18, 2026 12:37

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7c329cd73

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +161 to +164
// Unentitled macOS builds intentionally probe the former App Group once: shipped
// installs must carry their identity and auth together instead of rotating/re-pairing.
[selectedStateDirURL, self.appGroupStateDirURL(), self.legacyStateDirURL()]
.compactMap(\.self)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Gate legacy imports to fallback stores

On entitled iOS/macOS builds where the App Group store is the selected state directory, this still adds Application Support/OpenClaw as a legacy identity source. If a stale per-app identity/device.json from an older install exists there with different key material, DeviceIdentitySQLiteStore.loadOrCreate claims both sources and requireConsistentClaims rejects the conflict, so loadOrCreatePersisted returns nil and app connection/startup paths fail even though the current App Group identity is valid. The previous code ignored that legacy location whenever the App Group was available, and the comment here says the extra probe is for unentitled fallback builds, so the legacy root should only be added in that fallback case.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot removed the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Jul 18, 2026
@steipete
steipete force-pushed the codex/sqlite-device-identity branch from 833680d to 84536b7 Compare July 18, 2026 16:11
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 18, 2026
@steipete
steipete merged commit 98410d9 into main Jul 18, 2026
214 of 219 checks passed
@steipete
steipete deleted the codex/sqlite-device-identity branch July 18, 2026 16:44
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 19, 2026
…enclaw#110392)

* refactor: store device identities in SQLite

* style: satisfy Swift identity lint limits

* test: harden device identity migration fixtures

* fix: harden SQLite device identity recovery

* chore: remove stale identity helper

* refactor: isolate device identity repair

* chore: remove stale migration import

* test: validate migrated identity key types

* fix: harden device identity repair

* style: format device identity assertion

* fix: derive repaired identity key from PEM

* style: remove redundant PEM conversions

* fix: align native identity store with schema v4

* fix(state): satisfy SQLite identity CI gates

* fix(state): coordinate native identity migration

* test(doctor): include native identity claim path

* fix(infra): preserve coordinator release error

* fix(state): clear identity validation gates

* refactor(apple): remove identity test-only APIs

* refactor(apple): remove dead identity error type

* test(apple): use canonical identity test seam

* test(macos): isolate gateway readiness identity
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…enclaw#110392)

* refactor: store device identities in SQLite

* style: satisfy Swift identity lint limits

* test: harden device identity migration fixtures

* fix: harden SQLite device identity recovery

* chore: remove stale identity helper

* refactor: isolate device identity repair

* chore: remove stale migration import

* test: validate migrated identity key types

* fix: harden device identity repair

* style: format device identity assertion

* fix: derive repaired identity key from PEM

* style: remove redundant PEM conversions

* fix: align native identity store with schema v4

* fix(state): satisfy SQLite identity CI gates

* fix(state): coordinate native identity migration

* test(doctor): include native identity claim path

* fix(infra): preserve coordinator release error

* fix(state): clear identity validation gates

* refactor(apple): remove identity test-only APIs

* refactor(apple): remove dead identity error type

* test(apple): use canonical identity test seam

* test(macos): isolate gateway readiness identity
steipete added a commit that referenced this pull request Oct 15, 2026
…ply text (wave-4 bundle) (#172669)

* refactor(infra): remove redundant replay and freshness machinery

Trust successful migration statements inside their synchronous transactions,
reuse unchanged approval parses, share canonical package-root discovery,
namespace directory caches by plugin identity, and simplify ephemeral presence,
OS facts and suspension timer bookkeeping. Keep source validation, conflicts,
transaction durability, postcommit checks, security authority and write settlement.

Best-effort tradeoffs accepted

- Node-host own-write verification (#108457): no human successful-SQL-loss report; SQL errors still roll back, and independent source retirement checks remain.
- Workspace setup/attestation replay (#109147): no human driver-rewrite report; trust successful writes while retaining fingerprints and later source checks.
- APNs expected-ID replay (#108543): no human silent-insert-loss report; canonical parsing, tombstones and receipts remain.
- Device-auth presence assertion (#112663): no human successful-upsert-loss report; credential validation and transaction failure handling remain.
- Device-identity replay (#110392): no human silent-row-rewrite report; preserve independent post-await verification before source deletion.
- MCP OAuth replay (#161219): no human silent-write-loss report; canonical/source parsing and worker admission remain.
- Exec-approval read/parse/deep-compare replay (#114063): no human successful-driver-rewrite report; malformed policy stays fail-closed and actual authority is unchanged.
- Shared-auth target reread (#123349): no human silent-row-rewrite report; return the known SQL postimage and keep independent copy/flip/cleanup checks.
- Identical authored approval bytes (#168094) reuse the existing parse; changed normalized bytes still parse before publication.
- Plugin metadata fingerprinting (353d778): no human in-place metadata-mutation report; distinct objects remain isolated, and same-object edits use TTL/reset.
- Duplicate asset ancestor search (7224585): no human cached-miss incident; canonical realpath/wrapper discovery remains, while newly appearing packages need owner invalidation/restart.
- Presence logical clock (#134737): provenance is synthetic rollback/suspend tests; clock correction may temporarily retain or hide display rows until full update/reconnect, wall time catches up, or restart. TTL, capacity and connection privacy remain.
- Suspension timer generation (#130003): the removed test directly called a canceled callback; native timer cancellation and current-entry authority remain. An out-of-contract timer implementation could resume a renewed lease early.
- OS tuple-keyed cache (#135911): keep measured probe sharing and sticky labels; hot-patching OS identity needs restart rather than another namespace.
- Presence list type guards (409a160): callers supply validated arrays; existing normalization still owns their values.

Production +40/-228, net -188. Focused migration, asset/cache, presence/caller,
approval-publication and suspension/OS tests pass, as do production and infra-test
types, changed-file lint, assertion and suppression checks, and zero-cycle checks.
Independent final review has no actionable P0-P2 findings. No schema, durability,
retention, indexing, permission, recovery or public SDK change is intended.

Broad changed-check is not claimed green: the original base reproduces the
455-versus-454 environment budget failure. The initial Web Push Doctor timeout
remains unattributed; all Web Push production hunks were dropped and its exact
test passed on restored source. Full build and hosted CI remain unrun.

* refactor(agents): simplify reply preparation and refresh bookkeeping

Share typed actor-store adapters and prepared async auth reads. Reuse the
admitted memory-flush plan, retain last-good catalog views by provider, and
remove unused metadata bookkeeping and config projections. Preserve live
credential/effect authority, FIFO, transcript durability, and ordinary write
settlement. Net production reduction: 303 lines.

Best-effort tradeoffs accepted:
- Plugin-drain successors (#162301, synthetic): wait the current drain once;
  a later reload owns its own publication and recovery.
- A changed memory-flush plan during preparation (#162177/#121157, synthetic):
  finish with the admitted plan; the next turn resolves again.
- Per-row catalog freshness (#158113, synthetic): failed discovery retains
  the provider's last-good configured and supplemental overlays until success.
  Existing auth/profile/source gates and successful-empty replacement remain.
- MCP sibling invalidation during discovery (#138694, synthetic): a listing
  may briefly be stale; the next read observes the invalidation.
- Passive context metadata supersession (#119607, synthetic): late discovered
  metadata may win until refresh. Keep the single current-promise check before
  replacing configured limits, preserving the human capacity fix (#39857).
- Registration-time question answers (#110372/#134003, synthetic): a prompt
  can briefly race the answer; its terminal signal closes delivery.
- Duplicate or never-attached internal question registrations: both real
  producers attach once synchronously. Unsupported misuse loses its extra
  diagnostic/disposal wakeup; ordinary lifecycle rejection remains.
- Cancellation publication once/must-consume flags (#161124, synthetic): the
  sole internal producer invokes once. Keep active-scope/effect authority.
- In-flight placement-service replacement (#164744, synthetic): use the
  captured startup service, with its observation and writer authority intact.
- Compaction callback rebinding (#146732/#163264, synthetic): current work
  retains its captured callbacks and live assertion; later work captures anew.
- Re-entrant logging between synchronous run-owner checks: #162227 removed
  the awaited retry, making the second check redundant. Real post-await and
  mutation-effect checks remain.
- Startup diagnostic admission (#146792): the sole producer checks lifecycle
  immediately before recording. Remove only the recorder's duplicate check;
  preserve the human abort/recovery fix (#146692), reset, and admin redaction.

Release-note context: verbose diagnostics no longer include suppressed reply
text or background bash command contents. Execution and user replies remain
unchanged. Config show uses the same schema-aware redactor without cloning
an already detached result or redacting unused snapshot views.

Validation: touched core, messaging and Gateway-method type graphs passed;
49 changed TypeScript files passed targeted lint/format; runtime and Madge
cycles are both zero. Auth reader, question authority, memory flush, restart
claim, catalog worker, cancellation and compaction boundary proof is recorded
in the lane ledger. Final supplemental run: 392 tests passed, four failed
across 28 files, with final source verification. All 120 agents-support tests
passed, including refresh coalescing, publication, run-wait and compaction.
The four failures were an unchanged 120s ACP reset deadline and three MCP
fixtures settling before child startup markers (empty logs, existing 1-2s
connection/4s catalog deadlines). Narrow failed-case replay passed ACP reset
and two MCP cases; the one-second MCP retirement fixture still failed before
its first child marker. Clean lane-base comparison could not reach assertions:
the temporary checkout lacked workspace-local dependency links for worker
compilation. That case is unresolved, not proven inherited; coordinator-bundle
CI must adjudicate it. No deadline, retry, skip or assertion was weakened.
The final selected real-dispatch suppressed-reply logging regression passed
with completed source verification (one selected case, 202.58s wrapper).

Independent P0-P2 review completed four passes. Declined duplicate findings
about unsupported placement-service hot-swap (real observation/database/writer
authority remains) and alleged run-wait awaits (only synchronous logging lies
between the checks; real mutation and post-await checks remain).

Broad check-changed is NOT green: env-name budget 455/454 also fails on the
unchanged lane-base index, with no added env names; production/full-tree Knip
hit their existing 600s budget; the silent legacy-store scan was interrupted
after 782s. Those two scans are missing proof, not attributed inherited reds.
Hosted coordinator-bundle CI remains the broad gate. Owned mock/type/legacy
fixture findings were corrected and their targeted replays pass.

No changelog, dependency, database schema, durability, retention, permission,
or public API change is included. BELOW-500 branch-only coordinator handoff;
no lane PR or merge.

* chore: shrink stale reply assertion allowance

* test: align catalog publication calls with current contract
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
…ply text (wave-4 bundle) (openclaw#172669)

* refactor(infra): remove redundant replay and freshness machinery

Trust successful migration statements inside their synchronous transactions,
reuse unchanged approval parses, share canonical package-root discovery,
namespace directory caches by plugin identity, and simplify ephemeral presence,
OS facts and suspension timer bookkeeping. Keep source validation, conflicts,
transaction durability, postcommit checks, security authority and write settlement.

Best-effort tradeoffs accepted

- Node-host own-write verification (openclaw#108457): no human successful-SQL-loss report; SQL errors still roll back, and independent source retirement checks remain.
- Workspace setup/attestation replay (openclaw#109147): no human driver-rewrite report; trust successful writes while retaining fingerprints and later source checks.
- APNs expected-ID replay (openclaw#108543): no human silent-insert-loss report; canonical parsing, tombstones and receipts remain.
- Device-auth presence assertion (openclaw#112663): no human successful-upsert-loss report; credential validation and transaction failure handling remain.
- Device-identity replay (openclaw#110392): no human silent-row-rewrite report; preserve independent post-await verification before source deletion.
- MCP OAuth replay (openclaw#161219): no human silent-write-loss report; canonical/source parsing and worker admission remain.
- Exec-approval read/parse/deep-compare replay (openclaw#114063): no human successful-driver-rewrite report; malformed policy stays fail-closed and actual authority is unchanged.
- Shared-auth target reread (openclaw#123349): no human silent-row-rewrite report; return the known SQL postimage and keep independent copy/flip/cleanup checks.
- Identical authored approval bytes (openclaw#168094) reuse the existing parse; changed normalized bytes still parse before publication.
- Plugin metadata fingerprinting (f31bc71): no human in-place metadata-mutation report; distinct objects remain isolated, and same-object edits use TTL/reset.
- Duplicate asset ancestor search (40fb74f): no human cached-miss incident; canonical realpath/wrapper discovery remains, while newly appearing packages need owner invalidation/restart.
- Presence logical clock (openclaw#134737): provenance is synthetic rollback/suspend tests; clock correction may temporarily retain or hide display rows until full update/reconnect, wall time catches up, or restart. TTL, capacity and connection privacy remain.
- Suspension timer generation (openclaw#130003): the removed test directly called a canceled callback; native timer cancellation and current-entry authority remain. An out-of-contract timer implementation could resume a renewed lease early.
- OS tuple-keyed cache (openclaw#135911): keep measured probe sharing and sticky labels; hot-patching OS identity needs restart rather than another namespace.
- Presence list type guards (3965f6b): callers supply validated arrays; existing normalization still owns their values.

Production +40/-228, net -188. Focused migration, asset/cache, presence/caller,
approval-publication and suspension/OS tests pass, as do production and infra-test
types, changed-file lint, assertion and suppression checks, and zero-cycle checks.
Independent final review has no actionable P0-P2 findings. No schema, durability,
retention, indexing, permission, recovery or public SDK change is intended.

Broad changed-check is not claimed green: the original base reproduces the
455-versus-454 environment budget failure. The initial Web Push Doctor timeout
remains unattributed; all Web Push production hunks were dropped and its exact
test passed on restored source. Full build and hosted CI remain unrun.

* refactor(agents): simplify reply preparation and refresh bookkeeping

Share typed actor-store adapters and prepared async auth reads. Reuse the
admitted memory-flush plan, retain last-good catalog views by provider, and
remove unused metadata bookkeeping and config projections. Preserve live
credential/effect authority, FIFO, transcript durability, and ordinary write
settlement. Net production reduction: 303 lines.

Best-effort tradeoffs accepted:
- Plugin-drain successors (openclaw#162301, synthetic): wait the current drain once;
  a later reload owns its own publication and recovery.
- A changed memory-flush plan during preparation (openclaw#162177/openclaw#121157, synthetic):
  finish with the admitted plan; the next turn resolves again.
- Per-row catalog freshness (openclaw#158113, synthetic): failed discovery retains
  the provider's last-good configured and supplemental overlays until success.
  Existing auth/profile/source gates and successful-empty replacement remain.
- MCP sibling invalidation during discovery (openclaw#138694, synthetic): a listing
  may briefly be stale; the next read observes the invalidation.
- Passive context metadata supersession (openclaw#119607, synthetic): late discovered
  metadata may win until refresh. Keep the single current-promise check before
  replacing configured limits, preserving the human capacity fix (openclaw#39857).
- Registration-time question answers (openclaw#110372/openclaw#134003, synthetic): a prompt
  can briefly race the answer; its terminal signal closes delivery.
- Duplicate or never-attached internal question registrations: both real
  producers attach once synchronously. Unsupported misuse loses its extra
  diagnostic/disposal wakeup; ordinary lifecycle rejection remains.
- Cancellation publication once/must-consume flags (openclaw#161124, synthetic): the
  sole internal producer invokes once. Keep active-scope/effect authority.
- In-flight placement-service replacement (openclaw#164744, synthetic): use the
  captured startup service, with its observation and writer authority intact.
- Compaction callback rebinding (openclaw#146732/openclaw#163264, synthetic): current work
  retains its captured callbacks and live assertion; later work captures anew.
- Re-entrant logging between synchronous run-owner checks: openclaw#162227 removed
  the awaited retry, making the second check redundant. Real post-await and
  mutation-effect checks remain.
- Startup diagnostic admission (openclaw#146792): the sole producer checks lifecycle
  immediately before recording. Remove only the recorder's duplicate check;
  preserve the human abort/recovery fix (openclaw#146692), reset, and admin redaction.

Release-note context: verbose diagnostics no longer include suppressed reply
text or background bash command contents. Execution and user replies remain
unchanged. Config show uses the same schema-aware redactor without cloning
an already detached result or redacting unused snapshot views.

Validation: touched core, messaging and Gateway-method type graphs passed;
49 changed TypeScript files passed targeted lint/format; runtime and Madge
cycles are both zero. Auth reader, question authority, memory flush, restart
claim, catalog worker, cancellation and compaction boundary proof is recorded
in the lane ledger. Final supplemental run: 392 tests passed, four failed
across 28 files, with final source verification. All 120 agents-support tests
passed, including refresh coalescing, publication, run-wait and compaction.
The four failures were an unchanged 120s ACP reset deadline and three MCP
fixtures settling before child startup markers (empty logs, existing 1-2s
connection/4s catalog deadlines). Narrow failed-case replay passed ACP reset
and two MCP cases; the one-second MCP retirement fixture still failed before
its first child marker. Clean lane-base comparison could not reach assertions:
the temporary checkout lacked workspace-local dependency links for worker
compilation. That case is unresolved, not proven inherited; coordinator-bundle
CI must adjudicate it. No deadline, retry, skip or assertion was weakened.
The final selected real-dispatch suppressed-reply logging regression passed
with completed source verification (one selected case, 202.58s wrapper).

Independent P0-P2 review completed four passes. Declined duplicate findings
about unsupported placement-service hot-swap (real observation/database/writer
authority remains) and alleged run-wait awaits (only synchronous logging lies
between the checks; real mutation and post-await checks remain).

Broad check-changed is NOT green: env-name budget 455/454 also fails on the
unchanged lane-base index, with no added env names; production/full-tree Knip
hit their existing 600s budget; the silent legacy-store scan was interrupted
after 782s. Those two scans are missing proof, not attributed inherited reds.
Hosted coordinator-bundle CI remains the broad gate. Owned mock/type/legacy
fixture findings were corrected and their targeted replays pass.

No changelog, dependency, database schema, durability, retention, permission,
or public API change is included. BELOW-500 branch-only coordinator handoff;
no lane PR or merge.

* chore: shrink stale reply assertion allowance

* test: align catalog publication calls with current contract
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: ios App: ios app: macos App: macos cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: file-transfer rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant