Skip to content

fix(state): move Gateway state consumers through existing workers - #169580

Merged
steipete merged 197 commits into
mainfrom
dbasync/t1cut-state
Oct 14, 2026
Merged

steipete merged 197 commits into
mainfrom
dbasync/t1cut-state

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Gateway state consumers reached synchronous SQLite through shared-state and SDK owners although worker operations already existed. Config and machine-state operations now use the shared-state worker; profile policy uses its admitted catalog; personal GitHub connections use facts invalidated by write receipts. Authentication prepares its owner asynchronously. Deletion bookkeeping consumes the live lease and journal/provenance receipts. Canonical validation runs at admission; metadata writes use a conditional upsert without a preliminary SELECT. Bundled callers migrate together and private superseded readers are removed. Whole-store auth saves and cold discovery remain deferred to #169763.

User Impact

Gateway state access moves off the main thread while preserving its authorization, persistence and deletion behavior.

Credential, publication and filesystem-effect checks remain with their effect owners. Failed GitHub writes invalidate requested and commit-reported owners so a lost receipt cannot preserve old credentials. Explicit local-store and environment-only reads avoid ambient shared-owner preparation. Released synchronous SDK APIs remain deprecated compatibility paths. No lane schema, retention, stored-format, dependency or permission change is introduced.

Why This Change Was Made

Existing workers own the database operations and publish committed facts. Callers can reuse those facts without opening synchronous handles or rereading internal bookkeeping.

T1 and scope

Inventory Before After
Source-aware lane baseline 63a034f 33 26
Original census, including 21 classification corrections 54 26

Seven actual cuts cover four final-guard primitives, lifecycle facts, canonical-receipt runtime admission and publication lifecycle reads. The remaining 26 expressions are 25 original-file calls and one relocated reader. Worker use, deprecated released SDK/native compatibility, boot admission, migrations, Doctor/CLI one-shots, lock primitives and real credential/user-data/effect guards remain. Classification is not query savings; zero literal T1 or whole-Gateway MAIN SQL is not claimed. The original audited reduction remains seven calls. On integrated main 2d9b602a, the regenerated inventory classifies this same 17-file cohort as 24 T1 + 6 T1-compat calls; the candidate has 18 T1 + 5 T1-compat calls (30 → 23). Main's classification changes explain the different absolute totals.

Evidence

The latest integration merges main 2d9b602a74ee482171c5f80ac8a775c3a2d26a2a; its only conflict resolves the reply-dispatch fixture to main’s version, dropping the process-global active-run assertion while preserving delivery/custody/deadline proof. The preceding integration resolved only the generated worker inventory. Earlier conflicts reconcile main’s async session preparation and deletion queue with the lane’s prepared-profile fixtures, extracted lifecycle binding and receipt-based guards. The inventory was regenerated from merged source. The latest integration changes no fixed-cohort source files. The preceding integration added main’s singleStatement transaction option and comment, with no new SQL call expression. The engine-store inspectSqlite contract, lexical boot admission, shared-state v22 and memory-incognito cutover are preserved. No new SQL measurement is claimed for this integration.

  • SDK API diff passed on 6b9535cd4f9d (job 115087987866): zero entrypoint additions/removals, one additive export (agent-runtime.replaceRuntimeAuthProfileStoreSnapshotsAsync), 197 reachable changes, zero direct signature changes/removals. Released synchronous API signatures remain. This is reused evidence, not a current-head render.
  • Actual create/delete readiness passed on that head (job 115087989454, 76.141 seconds), including concurrent mutation and teardown. The later real-Gateway create/delete/recreate/list case passed in 78.556 seconds.
  • Published-driver × candidate update cell passed (run 38325882261, job 115074755865, 957 seconds). Later conflict/test-only integration reuses this proof.
  • Two Codex review rounds completed; the second was scoped-clean.
  • Prior-head CI 38476953568, on ae6132ab, completed with 142 successful and 20 skipped jobs. Production/test types, lint/source contracts, Knip/Madge, T1/dialect/worker ratchets, build, PostgreSQL conformance and security passed. The three behavioral failures are addressed below; this is prior-head evidence, not the final gate.

The Phase E hold is absent. #169763 remains deferred. Diff against integrated main: 477 files, +10,170 / −8,204 lines (net +1,966), including earlier integration drift. Frozen-lockfile install, changed-fixture formatting/lint and whitespace checks pass.

Removed checks and accepted edges

  • Pending status-read freshness: main refactor(gateway): finish GitHub publication worker cutover #169581 (5b242) retired held pending-read freshness; the retained delayed-read scaffolding is removed. Status preparation racing completion may require a refresh. Confirmation checks the live receipt before effects, and direct terminal-confirmation/no-extra-commands regression coverage remains.
  • Deletion journal/install/lease rereads: supported writers publish receipts; out-of-owner SQL is not observed. Live lease and filesystem-effect checks remain. Eight tests pinning unowned writes are removed.
  • Canonical receipt object-identity/reload checks: admission may renew its receipt; the next batch uses it. Revoked authority and physical identity still reject.
  • Metadata SELECT-before-write: an already-current conditional upsert is a harmless no-op.
  • GitHub pre/post mutation rereads: committed results and receipts determine state; cancellation after completion is harmless.
  • Duplicate plugin/deferred-migration admission and native snapshot fallback: the worker owns captured facts; external mutation needs readmission.
  • Held-catalog native alias refresh: receipts cover supported writes; direct SQL appears after readmission. Cross-state and membership-revocation checks remain.
  • Creator-preparation catalog: the catalog survives a short-handle close; raw DELETE that bypasses writer receipts is unsupported. Cross-state disclosure denial and in-process merge-receipt coverage remain.
  • Cleared-model archive preparation: no catalog is awaited when unused; catalog-dependent restore still prepares before effects.
  • Concurrent deletion: one request completes; the loser may get held-lease or not-found. No retry or weaker effect check is added.
  • Cron retry acknowledgement: accepted configuration stays active while monitor metadata may lag the scheduled retry; thrown errors retain recovery.
  • Background update callback reread: later attempts appear on the next discovery; execution stays with the update owner.

OAuth identity, credential replacement and reconnect-safe pin-removal checks protect real credentials/user data and remain. No generations, fencing or new cross-thread handshake is added.

Measurement

Original three-pair base 656287c940a5287da9efe69aabde2348695e07e1 versus byte-verified candidate later committed as d595c2a59827c (manifest 737bc8ebdb5edb70a246be2d25d884bae33855ebd357b703ef7c8572829eecd9). Measurements retain their recorded snapshots; neither series measures the current head.

Original three alternating pairs:

Metric Base Candidate
Warmed all-thread statements median [min–max] 322.4 [321.9–322.9] 321.2 [318.7–326.6]
Warmed requests median [min–max] 92.1 [91.9–92.3] 91.7 [91.6–92.7]
Warmed MAIN statements 0 0
Whole statements / requests / MAIN 9422 / 1758 / 1984 9423 / 1779 / 1979

The whole-workload request increase is +1.19% under the cold T1-move allowance. The newer combined pair below preserves the shared-family attribution required by the updated campaign rule.

Live integration pair and attribution

The combined SDK follow-up was measured with the unchanged shared harness: baseline 63a034f64e3af869a5affb0968d0d3a199121358, candidate 1d4c0e3d1ab5d9655d6a3c00c35beb0cb154e70e. It is an earlier measured pin, not the final Git head. Later fixture/type/conflict and cold-auth/lost-receipt repairs were not remeasured; the table reports only the pinned pair. All 13 turns, child flow, cron, compaction and shutdown completed. The copied harness readiness budget alone was raised from 300 to 900 seconds after one loaded-host startup attempt ended before any turn; the shared harness and workload deadlines were unchanged.

Metric Base Measured candidate
Warmed all-thread statements median [min–max] 343 [303–489] 456.5 [424–549]
Warmed requests median [min–max] 95.5 [82–116] 113 [105–123]
Warmed MAIN statements median [min–max] 0 [0–2] 0 [0–2]
Whole statements / requests / MAIN 10096 / 1943 / 1995 11817 / 2176 / 2104

Main commit 7aae49e8677b18ca992b72a49221e1b6de4b45e4 (#169660) introduces a transcript-triggered usage-cost sidecar absent from this baseline. It adds 122 SQL/18 requests plus 3 SQL/3 plugin-state requests per warmed turn. These are real inherited operations, not a state-lane saving or unexplained noise. This lane's warmed state operations add no statements or requests.

Shared read family, mean per warmed turn Base Candidate
Exact-entry facts SQL 11.4 10.1
Actor hydration SQL 5.3 6.5
Entry-cache snapshot SQL 1.2 1.2
Row-facts SQL / requests 26.5 / 5.3 26.5 / 5.3
Watermarks SQL 7.3 6.3

The hydration increase decomposes exactly: nine additional borrowed reads and nine delivery-settlement hydrations follow usage-cache writes on the same writer thread; one follows an unchanged memory write; transcript-append hydrations fall by seven. Net +12 over ten turns. The usage operations' unscoped transaction bumps the global write revision used by actor residency. This points to a separate usage-owner optimization, not extra state preparation calls. No inherited deletion-status-cache saving is credited here.

Cold state operation counts (SQL/requests): machineState.read 0/0→5/5; userModelAccounts.links 8/2→4/1; profile ensureOwner 34/1→37/1; config health/snapshot and profile authority/attribution operations retain their counts. A skipped registry maintenance sweep lowers deletion snapshot sampling, so that reduction is not credited.

Limitations: one candidate startup sweep logs an invalidated registry snapshot and skips safely; the later cron workload passes. This existing check guards real deletion/retention data and stays. Candidate background Workshop review reaches an existing synchronous transcript effect guard (130 MAIN SQL across cron/compaction); base schedules the same review but rejects a stale anchor before admission. Scheduler/review/guard code is unchanged, although metadata preparation can affect timing. This is reported as background-flow placement variation, not zero whole-Gateway MAIN. Warmed MAIN outliers are unchanged secret-store timer work outside this lane. SQL conservation is exact with no missing contexts or duplicate sends; send/receive tracing has two unmatched records on base and three on candidate.

Current CI disposition

Current head: 2faeb9b28f31ecf609d57d9e8896105a69d89961. Exact-head CI 38487193297 follows the conflict-only integration. Its failed shard is empirically inherited as detailed below. The preceding run 38486203555 was superseded by that integration. Prior-head CI 38482903334, on 414755eb, passed all static and security gates: production/test types, lint, Knip, Madge, database/T1/dialect ratchets, source contracts, PostgreSQL conformance, Security Review, Security High, Critical Quality and Opengrep. These remain prior-head evidence, not the final gate. Earlier failures were:

  • models-config.providers.implicit.outcomes.test.ts: draining all timers also drains the process-wide recurring directory observer until Vitest's 10,000-timer limit. The fixture now advances by the sum of its six catalog delays and awaits the catalog operation. Concurrency, merge order and outcome assertions remain.
  • dispatch-from-config.reply-dispatch.test.ts: two pending-final cases expected no timers anywhere in the process. The helper now checks the reply-run owner has no active run. Pending-final records, newer-intent protection and deadline advancement remain. Deadline cancellation itself is independently covered by reply-flow.test.ts and retry-owner tests.
  • ops.run-admission-cleanup.test.ts, “releases scheduled ownership after cleanup-terminal persistence fails”: the same undefined-versus-1770372303000 assertion reproduced in a full-file run on main 9690a6d7fa9cdb (10 passed, one failed). The failing file is unchanged by this PR. This is an empirical inherited-failure exception; the isolated case passing on both branches is not claimed as a repair. The main failure is assigned through the campaign's main-failure inbox.

Focused replay on this head passed all three previously failing timer cases: both pending-final delivery cases and bounded catalog discovery. The two selected files completed in 181.56 seconds including compilation (individual Vitest durations: 109.37 and 46.12 seconds). No broad local suite was rerun.

The latest prior-head run also exposed two cases:

  • session-accessor.sqlite-scope.test.ts, “slow writer failure separates waiting and execution”: the same 120,000 ms timeout reproduced on the pinned integrated main 7039a3213373c092e769899a230588f70e279f21 (175.53 seconds Vitest / 184.40 seconds wrapper) and candidate (190.55 seconds Vitest / 231.52 seconds wrapper). The test and its queue/admission owner are unchanged against that main. This is empirical inherited evidence; an early assertion can strand the fixture's deferred writer before its cleanup block. The main-failure owner has the evidence. Two earlier baseline attempts failed on workspace setup and are not counted as behavioral proof.
  • session-state-notices.test.ts, “cancels a newer watcher buffer when an older queued batch starts during close”: the full file passed on main (10 tests, 5.69 seconds Vitest / 10.55 seconds wrapper), so it is not claimed inherited. The fixture now awaits the actual singleton lifecycle drain instead of running every timer in the process. Pending notice cancellation releases queued buffers; mock settlements are resolved before draining. All cancellation, coalescing and deadline assertions remain. Changed-file formatting/lint and whitespace checks passed. Candidate focused replay passed all 10 cases in 3.92 seconds Vitest / 9.63 seconds wrapper.

Current-head CI remains the landing gate; any new failures require attribution.

Final-head failure attribution

Job 115604878369 reports three 120,000 ms timeouts: the known slow-writer case and session-entry-read.retirement.worker.test.ts cases “settles ordered exact-entry refusal without waiting on the following writer” and “settles ordered exact-entry eviction without waiting on the following writer”. Running those same three cases in the same two-file sequence on integrated main 2d9b602a74ee482171c5f80ac8a775c3a2d26a2a reproduces all three timeouts (430.07 seconds Vitest / 439.07 seconds wrapper). These files and the retirement/ordered-reader/admission owners are unchanged by the PR. The candidate’s retirement file passes alone (two cases; 74.75 seconds including compilation). The slow-writer fixture can strand the process-global writer queue, and later fixture cleanup waits on that queue. This is an empirical inherited-failure exception, not a claim that an isolated pass fixes the sequence. The main-failure owner has the exact reproduction. No retries, weaker assertions, or timeout increases were added.

Merge readiness

On exact head 2faeb9b28f31ecf609d57d9e8896105a69d89961, all static gates pass: production/test types, core/extension lint, Knip/dependencies, source contracts, Madge/architecture, database/T1/dialect ratchets, build artifacts and PostgreSQL conformance. Applicable security/quality checks completed with 21 successes, five skips and one neutral result. CI reports 144 successful and 19 skipped jobs, one failed job containing only the three empirically inherited timeouts above, and one still-running behavioral shard (checks-node-changed-compact-small-6, job 115604878705). No passing result is claimed for that pending shard or the aggregate gate. Landing uses the maintainer-approved relaxed v4 slow-CI exception after the focused fixture proofs; any newly revealed regression requires follow-up. Two review rounds are complete. No additional production change followed them.

Prepare machine state, profile identity, auth ownership, and lifecycle facts through existing workers. Keep committed facts with their owning Gateway and use write receipts at effect boundaries. Remove redundant state rereads and migrate bundled callers to asynchronous SDK replacements while retaining documented deprecated adapters.
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 2faeb9b28f31ecf609d57d9e8896105a69d89961
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/auth-profiles.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/candidate-stores.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/oauth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/path-resolve.native.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/path-resolve.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/paths.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/personal-store.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/profiles.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/runtime-snapshot-publication.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/runtime-snapshot-selection.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/runtime-snapshots.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/shared-store-bootstrap.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/source-check.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/sqlite.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/store-read.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/store.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/store.worker.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/upsert-with-lock.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/legacy-inherited-auth-dir.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/gateway/github-oauth-lifecycle.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/github-personal-oauth.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/model-auth-refresh.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/connect-hello.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/state-migrations.shared-auth-store.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/secrets/auth-store-paths.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • 1 additional sensitive files; see the workflow summary.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: telegram Channel integration: telegram gateway Gateway runtime extensions: memory-core Extension: memory-core cli CLI command changes scripts Repository scripts commands Command implementations agents Agent runtime and tooling size: XL labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR moves Gateway state preparation into existing database workers and maintains prepared facts through committed write receipts.

Example: A cold plugin call resolves TTS preferences with OPENCLAW_STATE_DIR=/tmp/tts-state and stored tts.prefsPath=/tmp/tts-state/custom.json.

  • Before: The synchronous resolver returns /tmp/tts-state/custom.json.
  • After: It returns /tmp/tts-state/settings/tts.json until asynchronous preparation admits the stored path.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful maintainer-directed work, with one unresolved compatibility defect and insufficient proof of the changed authority boundaries.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Synchronous state queries can stall Gateway chat and control requests.
Reason: The maintainer-authored direction reuses existing workers and migrates bundled consumers together; the deferred stacked work is explicitly outside this PR.

Merge readiness

⛔ Blocked before merge - 5 items remain

Keep this maintainer-owned PR open: the worker cutover is useful, but the cold synchronous TTS compatibility regression remains.

Priority: P2
Reviewed head: c05918ba8f96b331a8cc38f986dadaffb6b557ce

Before merge

  • Add real behavior proof - Authority-chain proof required: The recorded Gateway workload and guard-level regressions do not show an allowed personal GitHub effect followed by rejection before credential/publication I/O after disconnect, reassignment, or uncertain settlement, nor revoked authority rejected through production deletion cleanup. Supply redacted traces or logs covering those effects, removing API keys, IPs, phone numbers, and non-public endpoints, then update the PR evidence for re-review. 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.
  • Preserve the stored TTS path for cold synchronous SDK calls (P1) - When an installed plugin calls resolveTtsPrefsPath before prepareTtsPreferences, with no explicit config/environment override and an existing tts.prefsPath machine setting, getPreparedTtsPreferences returns undefined because nothing has admitted that path yet. The resolver therefore returns the default settings/tts.json instead of the stored file, silently ignoring the user's speech preferences and potentially directing preference writes elsewhere. Main's synchronous reader returns the stored path, and the changed test now explicitly expects this incorrect fallback. Preserve cold behavior through the deprecated native compatibility path while keeping ordinary Gateway callers asynchronous.
  • Resolve security concern: Establish rejection at the credential and cleanup effects - The source retains live guards and invalidation mechanisms, but supplied proof does not establish their composition through final credential/publication I/O and production deletion cleanup after supported revocation or uncertain settlement; no concrete bypass is asserted.
  • Resolve merge risk - Before merge, establish that receipt-backed credential and deletion facts cannot retain effect authority after supported owner revocation or uncertain settlement.
  • Improve patch quality - Add final-effect proof for personal GitHub disconnect, reassignment, and uncertain settlement, and for revoked authority through production deletion cleanup.

Findings

  • [P1] Preserve the stored TTS path for cold synchronous SDK calls — src/tts/tts.ts:16
  • [medium] Establish rejection at the credential and cleanup effects — src/state/user-github-connections.ts:152

Tests

  • Missing end-to-end proof: Show an allowed personal GitHub effect and revoked/reassigned/uncertain authority rejected before credential or publication I/O, plus revoked deletion authority rejected through production cleanup; the cold synchronous TTS case currently asserts the regression.
Agent review details

How this fits together

Gateway requests and plugin SDK calls consume machine settings, profile policy, credentials, and agent lifecycle facts from shared SQLite state; workers return prepared facts and publish committed invalidations.

flowchart LR
  A[Gateway and plugin callers] --> B[Asynchronous preparation]
  B --> C[Existing database workers]
  C --> D[Shared SQLite state]
  C --> E[Prepared facts and receipts]
  E --> F[Current authority guards]
  F --> G[Credential and filesystem effects]
Loading

Technical review

Best possible solution:

Keep ordinary Gateway preparation asynchronous while preserving cold synchronous SDK behavior and proving revocation at the final credential, publication, and deletion effects.

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

Source and the changed TTS test establish the cold-path regression: a persisted custom path is ignored before asynchronous admission; no runtime reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Existing workers and writer receipts are the appropriate owners, but eliminating synchronous discovery from a released compatibility API must not change its returned path.

Full review comments:

  • [P1] Preserve the stored TTS path for cold synchronous SDK calls — src/tts/tts.ts:16
    When an installed plugin calls resolveTtsPrefsPath before prepareTtsPreferences, with no explicit config/environment override and an existing tts.prefsPath machine setting, getPreparedTtsPreferences returns undefined because nothing has admitted that path yet. The resolver therefore returns the default settings/tts.json instead of the stored file, silently ignoring the user's speech preferences and potentially directing preference writes elsewhere. Main's synchronous reader returns the stored path, and the changed test now explicitly expects this incorrect fallback. Preserve cold behavior through the deprecated native compatibility path while keeping ordinary Gateway callers asynchronous.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Keep landing paused for authority-boundary proof (recommended)
    Keep this PR open until the PR owner supplies production-path evidence that revoked credential and deletion authority is rejected before the final effects.

Provenance checked

  • Synchronous TTS preference resolution changes intended behavior with a stated reason (2665147: The preceding SDK migration moved ordinary callers to asynchronous preparation while retaining synchronous compatibility for installed plugins.)
  • Personal GitHub connection authority keeps the original intent (a9dac67: Connection receipts identify changed owners and retired profiles so retained publication authority observes supported committed changes.)
  • Agent deletion authority and cleanup keeps the original intent (be2850e: Deletion must retain current journal ownership while draining work, retiring stores, and performing cleanup.)

Testing

Proof path: in-process harness.

Security

Needs attention: The changed receipt-backed authority boundaries need final-effect revocation evidence before security clearance.

Evidence

Security concerns:

  • [medium] Establish rejection at the credential and cleanup effects — src/state/user-github-connections.ts:152
    The source retains live guards and invalidation mechanisms, but supplied proof does not establish their composition through final credential/publication I/O and production deletion cleanup after supported revocation or uncertain settlement; no concrete bypass is asserted.
    Confidence: 0.93

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 24d5996 adds src/agents/agent-lifecycle-registry.ts:124 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 24d599636ab2; files: src/agents/agent-lifecycle-registry.ts)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a normal-priority internal state-worker cutover with a concrete SDK compatibility defect.
  • merge-risk: 🚨 compatibility: The cold synchronous TTS resolver silently selects a different preference file for an existing stored machine setting.
  • merge-risk: 🚨 security-boundary: Retained personal credentials and destructive deletion guards now consume receipt-maintained authority facts.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (27 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-12T19:31:31.640Z sha 38699c1 :: needs real behavior proof before merge. :: [P2] Remove the schema-marker override that bypasses reachability
  • reviewed 2026-10-12T19:54:03.458Z sha 339e4f7 :: needs real behavior proof before merge. :: [P1] Preserve the stored TTS path for cold synchronous SDK calls | [P2] Remove the schema-marker override that bypasses reachability
  • reviewed 2026-10-12T20:55:43.006Z sha dfbe993 :: needs real behavior proof before merge. :: [P1] Preserve the stored TTS path for cold synchronous SDK calls | [P2] Remove the schema-marker override that bypasses reachability | [P2] Remove duplicate recovery-test resource declarations | [P2] Migrate the remaining cron caller to the moved writer | [P2] Keep the bootstrap loader's exports in the profile mock
  • reviewed 2026-10-12T21:20:08.170Z sha de15c53 :: needs real behavior proof before merge. :: [P1] Preserve the stored TTS path for cold synchronous SDK calls | [P2] Restore caller-sensitive schema-marker classification | [P2] Keep the bootstrap identity reader in the profile mock
  • reviewed 2026-10-12T21:53:55.559Z sha e802994 :: needs real behavior proof before merge. :: [P1] Preserve the stored TTS path for cold synchronous SDK calls | [P2] Restore caller-sensitive schema-marker classification
  • reviewed 2026-10-12T23:11:49.910Z sha 43a02af :: needs real behavior proof before merge. :: [P1] Preserve the stored TTS path for cold synchronous SDK calls | [P2] Restore caller-sensitive schema-marker classification
  • reviewed 2026-10-13T02:06:00.383Z sha 6b9535c :: needs real behavior proof before merge. :: [P1] Preserve the stored TTS path for cold synchronous SDK calls
  • reviewed 2026-10-13T02:28:05.736Z sha 81e5072 :: needs real behavior proof before merge. :: [P1] Preserve the stored TTS path for cold synchronous SDK calls | [P2] Encode a valid removal policy for the three deprecation records

Reviewed October 12, 2026, 11:16 PM ET / October 13, 2026, 03:16 UTC (Revision 28).

@steipete
steipete merged commit 4466c0d into main Oct 14, 2026
244 of 247 checks passed
@steipete
steipete deleted the dbasync/t1cut-state branch October 14, 2026 00:24
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…enclaw#169580)

Route Gateway config and machine-state reads, lifecycle facts, and GitHub publication through existing worker owners. Reuse committed receipts for internal deletion bookkeeping while retaining credential and filesystem-effect authority checks. Share the credential-aware machine-state writer and remove superseded internal readers.

Remove seven live main-thread SQLite call sites in the fixed state cohort (historical audit 33 to 26; current classification 30 to 23 including compatibility). Preserve released synchronous SDK signatures and add asynchronous replacements. Keep whole-store auth saves and cold discovery deferred to openclaw#169763.

Align direct fixtures with worker-owned preparation and preserve main integration changes.
steipete added a commit that referenced this pull request Oct 14, 2026
Prepare the shared auth owner before constructing the synthetic auth snapshot
in the source-only credential refresh case. Commit 4466c0d (#169580)
made synchronous auth paths consume prepared ownership; this fixture still
relied on the removed cold preparation and failed before starting its reloader.

Keep every credential-coherence assertion unchanged. The exact selected case,
fixture format check, and type-aware lint pass in run 38544268431.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
Prepare the shared auth owner before constructing the synthetic auth snapshot
in the source-only credential refresh case. Commit 07dcf9c (openclaw#169580)
made synchronous auth paths consume prepared ownership; this fixture still
relied on the removed cold preparation and failed before starting its reloader.

Keep every credential-coherence assertion unchanged. The exact selected case,
fixture format check, and type-aware lint pass in run 38544268431.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: telegram Channel integration: telegram cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: codex extensions: memory-lancedb Extension: memory-lancedb gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts security-sensitive-changed 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