Skip to content

refactor(gateway): store personal model-account links through workers - #164630

Merged
steipete merged 10 commits into
mainfrom
dbasync/acctctl
Oct 4, 2026
Merged

steipete merged 10 commits into
mainfrom
dbasync/acctctl

Conversation

@steipete

@steipete steipete commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Personal model-account control-plane storage still ran on the Gateway caller thread. Its asynchronous replacement must also preserve the synchronous service methods shipped through the Plugin SDK in v2026.9.8.

Current reviewed head: 97674e19d7a2c1092de6b697c64d5d78fbbc4717. Landed main repairs are incorporated, including a real conflict with account-test consolidation. Fresh whole-PR P2 review is clean and all 27 final-candidate focused cases passed, including the real accepted-write close prelude. Exact-head CI passed first attempt (82 successful jobs, 21 skipped; 532 seconds), and trusted ClawSweeper completed without actionable correctness/security findings. The required local released-SDK report preserves all 12 existing service members and the action shape, adding exactly seven Async methods; the tool completed successfully in 1,220.74 seconds, including cleanup. Earlier-head results remain explicitly historical below.

Why This Change Was Made

Use the existing shared-state user-profile worker and broker for bundled account operations. Capture the physical store before yielding, compare credentials before BEGIN, and compare current credentials and selection again in the synchronous transaction. Transaction-local role facts keep the host authority checks free of same-store reads while preserving live connection and policy checks at transaction and commit.

The existing account service reserves FIFO order before asynchronous lookup, retains accepted writes independently of scheduler cancellation, and joins them in the real server close prelude. A confirmed commit determines the terminal result when cancellation races its reply. Unknown outcomes do not replay. List, status, and metadata callers revalidate disclosure after reads.

User Impact

RPC envelopes, credentials, stored bytes, schemas, retention, durability, and update behavior are unchanged. No new worker service, persistent cache, dependency, or environment name. Credentials never enter control-plane replies. The live account-pin guard in src/gateway/server-methods/users-model-account-access.ts:129 remains a separate native authority and T1 debt.

Production: +869 / −173 / net +696 (1,042 changed lines, below the 1,300 cap). T1: 921 → 920 (−1) against 20f485c7af9185eb29707fb7d8d879ce6b88ca33, measured with each revision’s own inventory classifications. Native SDK list/link/unlink calls remain honest T1 debt; they are excluded from the zero-caller-SQL claim.

SDK compatibility

The released listLinks, link, unlink, list, select, status, and cancel methods keep their synchronous signatures, immediate native completion, return shapes, and authority semantics. Each has @deprecated guidance to its matching Async replacement. All production bundled callers use the async methods. The original { owner, assertCurrent: () => void } action shape is preserved.

Warnings use the existing process-wide compatibility owner: once per plugin and method, including across plugin reloads. The compatibility record and migration docs retain the native methods until the next Plugin SDK major and explicit breaking-release approval. Runtime tests cover synchronous results and immediate persistence; the independent SDK type test checks the released contracts through the public context entrypoints.

Released SDK comparison against v2026.9.8: passed: all 12 pre-existing service members (including the seven synchronous methods) and the action shape are unchanged; exactly seven Async methods added.

Evidence

Opened-head (430d80b71c2a8280b6baaa30f859fd7942a2990f) evidence: all 181 cases below passed (2,437.20s summed serial wall time) with pnpm test <file> --maxWorkers=1, run serially on the local host. Wall time includes runtime preparation and import overhead; these are measured local costs, not GitHub CI test durations.

Focused test Cases Wall seconds
src/gateway/model-account-connect.worker.test.ts 10 105.36
src/gateway/server-methods/users-auth-connect.test.ts 37 113.53
src/gateway/server-methods/users-auth-connect.control-plane.test.ts 24 75.01
src/gateway/server-close.model-accounts.test.ts 1 220.98
src/state/user-model-accounts.test.ts 29 136.89
src/gateway/server-methods/chat-metadata-runtime.personal-accounts.test.ts 7 131.66
src/plugins/compat/registry.test.ts 12 10.34
test/scripts/runtime-process-build-graph.test.ts 10 7.36
test/scripts/eager-import-closure.test.ts 17 82.11
src/auto-reply/reply/get-reply.imports.test.ts 1 12.68
src/state/openclaw-state.worker.imports.test.ts 2 244.31
src/cron/store/dispatch.worker.imports.test.ts 5 305.28
src/agents/agent-model-discovery.imports.test.ts 2 19.07
src/agents/harness/native-hook-relay.imports.test.ts 1 17.73
src/config/sessions/session-history-read.imports.test.ts 2 24.41
src/config/sessions/session-transcript-reconcile.imports.test.ts 1 13.68
src/gateway/session-archive.imports.test.ts 1 327.28
src/gateway/worker-environments/worker-turn-launcher.imports.test.ts 4 43.75
src/worker/worker.runtime-imports.test.ts 4 133.76
src/gateway/model-account-connect.compat.test.ts 2 87.42
src/plugins/compat/model-account-connect-deprecation.test.ts 1 197.52
src/plugin-sdk/gateway-model-account-connect-compat.test.ts 1 3.62
src/gateway/server-lifetime-sidecars.test.ts 7 123.45

The real RPC boundary observes zero caller-thread SQL for moved account operations, including role-enabled grants, transaction/commit refusal and error-class identity, pre-BEGIN/current-row races, disclosure revocation, and a lost worker reply with no replay. The shutdown regression drives the real server close order. Before controls demonstrated native caller SQL and the post-commit cancellation regression.

  • node scripts/check-changed.mjs --base 20f485c7af9185eb29707fb7d8d879ce6b88ca33: passed, 1,754.63s on admitted Testbox run 37157944161, including production and test typechecks (the SDK test shard passed). The machine stopped immediately after the gate. The final one-line lifecycle-test switch to statusAsync followed that capture and passed its focused suite; production bytes are unchanged.
  • pnpm build: passed, 499.10s on the opened-head Testbox run 37163521731, including runtime bundles, plugin declarations, all 151 public SDK subpaths, 96 plugin builds, and the production UI. Native exit was 0 and the machine stopped successfully; the external runner portal sync timed out afterward.
  • Madge: passed, 0 cycles, 23.52s on the opened-head Testbox.
  • Database worker ratchet: passed, 2.27s, no T1 call-count growth against the pinned merge base.
  • Released SDK report: passed, 231.20s on the opened-head Testbox run 37162122042, stopped after success. Canonical report digest: 608e1209e3571f7ee226d903a0975b8fe9cfb90c99cca79ed50b0b68abaf188e. The full release-to-current report includes unrelated historical SDK changes; the service-specific verifier proves the preserved members and exact seven additions.
  • Final Codex autoreview through P2: scoped-clean on the fully staged candidate. An outdated lifecycle assertion was corrected and its suite rerun.
  • git diff --check: passed.

All requested pre-PR gates completed. Correction head 151abdc63a528ce6c1262d408c43bb6df77aac0b passed hosted CI and ClawSweeper. Main subsequently introduced real merge conflicts; the current merge candidate and its fresh validation are recorded below. Earlier-head proof is identified explicitly.

Landing corrections and validation

Correction commit: 151abdc63a528ce6c1262d408c43bb6df77aac0b.

CI on the opened head exposed six duplicate worker/native export names and an account-catalog integration still running inside Vitest threads. Internal worker exports now use distinct Async names, and the integration uses the existing Gateway database-worker fork owner. Its controlled timeout clock keeps the real five-second catalog budget from racing deliberately held auth/DNS gates and asynchronous unlink. Production deadlines, broker admission, and every successful-unlink, RPC-refusal, retained-credential, and zero-forbidden-HTTP assertion are preserved.

Attribution used five serial runs per revision with pnpm test test/model-account-catalog-authority.integration.test.ts --maxWorkers=1: the opened head failed the same two unlink cases 5/5, while merge base 20f485c7af9185eb29707fb7d8d879ce6b88ca33 passed all ten cases 5/5. These are PR-caused CI repairs, not an inherited-failure exception.

  • Linux/Hetzner correction validation: 99 focused cases passed, including the real Gateway close-prelude regression, worker refusal and settlement, RPC authority, metadata, and released synchronous SDK compatibility. pnpm tsgo:core and the export-collision guard passed. The focused test command took 173.63s; the complete comparison/validation payload took 523.33s. Validation run.
  • The final catalog fixture clock correction subsequently passed all 10 cases locally, 191.03s wrapper wall time (158.90s Vitest). Its unlink cases took more than 11 seconds and still produced refusal with zero outbound requests. The earlier local baseline loopback timeout is recorded as fixture timing evidence, not claimed as a product regression or repaired by a passing replay.
  • Final Codex autoreview through P2: scoped-clean. Formatting, git diff --check, and the export-collision guard passed. Local targeted lint could not start because prerequisite SDK declaration generation hit its five-minute deadline; hosted lint passed on the pushed head.
  • Prior correction-head CI run 37168705952: success, first attempt, 580 CI seconds elapsed for the full PR workflow (parallel jobs; not an isolated test-file measurement). The final catalog fixture measured 191.03s locally as recorded above.
  • ClawSweeper revision 3 completed on correction head 151abdc63a528ce6c1262d408c43bb6df77aac0b at 2026-10-04 01:46:11 UTC, with no actionable patch or security findings. Its generated migration checkbox names the SDK deprecation record; that record is metadata, and both source inspection and the review text confirm no stored-data or schema change.
  • Those corrections introduced no public SDK signature change, schema change, or new environment name. Main integration is described separately below.

Main conflict integration

First conflict-integration head: eacc0142c7b2333673349504338c7161e75bacf8, incorporating main 12c5644ad78f4a3b3882cb7e10aaf8f49bbeb3d0 with a merge commit, without rebasing. GitHub reported actual conflicts after the correction head passed CI.

The two resolutions preserve both owners: server-lifecycle.ts starts and awaits account-write settlement alongside main's auth-usage drain (#164588), and chat-metadata-runtime.ts carries main's canonical ACP metadata (#162920) alongside prepared personal-account selection. Main's cached startup paths and post-await authority check remain intact.

  • Fresh Codex P2 review of the complete PR delta against integrated main: scoped-clean.
  • 56 focused cases passed, 1,202.72s local wrapper wall time, covering the real account close prelude, auth-usage shutdown, metadata and native-session behavior, personal-account authority, and the public SDK compatibility type test. Command: pnpm test src/gateway/server-close.model-accounts.test.ts src/gateway/server-close.auth-usage.test.ts src/gateway/server-methods/chat-metadata-runtime.test.ts src/gateway/server-methods/chat-metadata-runtime.native-session.test.ts src/gateway/server-methods/chat-metadata-runtime.personal-accounts.test.ts src/plugin-sdk/gateway-model-account-connect-compat.test.ts --maxWorkers=1.
  • Formatting and git diff --check passed. The service factory, authority/action contract, compatibility records, and result schemas are byte-identical to the reviewed correction head. No credentials were introduced into control-plane results or public evidence.
  • Mandatory local released SDK comparison against v2026.9.8: completed for eacc0142c7b2333673349504338c7161e75bacf8. All 12 existing service members and the released action shape are unchanged; exactly seven Async methods are added. Report digest: 777fe8b4ea5d123d948ebebac7f220b911534edefc2b08a946ae26ca4195fbc6. The full release-to-head report includes unrelated main API changes; this compatibility conclusion is scoped to the account service.
  • ClawSweeper revision 5 completed on this exact head at 2026-10-04 03:18:44 UTC, with no actionable correctness or security findings. Its requested SDK report is now complete. The generated data-migration checkbox still names deprecation metadata; its substantive source review explicitly confirms there is no stored-data contract change.
  • Prior integration-head CI run 37173442568, attempt 1: completed with two independently inherited failures described below. All other selected jobs passed, including security-fast; no jobs were cancelled and no CI rerun was requested.

Resolved inherited CI failures

The run tested GitHub merge 492bb8db2c2908fb9ac2ba4523ce9bedac9c05ab, with ordered parents main 35f60579010ca7ba4c158f20bd0f4409965731f0 and PR head eacc0142c7b2333673349504338c7161e75bacf8.

  1. checks-fast-baseline-ratchets: main's new mock-export scanner fails with spawnSync git ENOBUFS. The unchanged 1,675,312-byte mock baseline exceeds the default 1 MiB limit in the shared Git reader, before any candidate source is scanned. The same command failed 5/5 on clean main, and scheduled main CI job 111351985083 reproduces the same failure at main 301a040200d10e65813c434a57364c5eb79e7b97. Scanner, Git reader, and baseline blobs are identical between the tested merge and its main parent.
  2. checks-node-compact-small-2: type-suppression-inventory.test.ts expects 16 entries but sees two additional annotations in src/plugin-sdk/plugin-config-runtime.test.ts, introduced by main's test(core): remove low-value tests (batch d186) #164718. The test, scanner, and offending file are identical between the tested merge and its main parent; none are changed by this PR. The exact mismatch was independently reproduced 5/5 on clean main, with serial walls of 197, 144, 100, 132, and 74 seconds. Main fixed the omitted entries in d073c774d3c6a053ad55c1a39cf8aa2398514762; the same four-case file then passed locally after integration. No same-failure scheduled-main inventory result is claimed.

The failed aggregate CI gate reflected those two jobs. Main subsequently fixed both owners: d073c774d3c6a053ad55c1a39cf8aa2398514762 for the inventory and 06131c40d09f3249b5ac253c414aa861be1de82b for large Git baseline reads (following #164743). These fixes are incorporated before final publication; no CI rerun or admin bypass was used for this historical attempt.

Final main and fixture integration

Local merge 6eddf170e00eba584e9dbb1ecd0f6029414180ec incorporated main d0c59630c5a6eb3e63dcae17e69fa0faf20f7f7c without conflicts. Its 16 focused cases passed in 877.85s, including the real accepted-write close prelude, released SDK type test, runtime build graph, and repaired inventory check; P2 review was scoped-clean and the committed tree exactly matched the reviewed/tested tree.

The candidate also incorporates main 4fa690195797c00155e15f1757ab7f963c6a9713, including the scanner fix. That scan then identified 12 incomplete mocks introduced or relocated by this PR. They now spread the real module exports before overriding the specific fixture functions. Existing behavior assertions remain intact, and one nonexistent duplicate mock export was removed. The native guard pruned exactly seven obsolete baseline entries, with zero additions or new allowances. Production account code remains unchanged.

Final staged candidate validation: 93 focused cases passed in 996.75s with pnpm test <files> --maxWorkers=1, covering both affected account-handler suites, real worker/RPC authority, released synchronous compatibility, account-label behavior, the accepted-write close prelude, public SDK types, runtime build graph, and reply import closure. These are local wall measurements; exact-head CI time is recorded separately when available. Fresh Codex P2 autoreview: scoped-clean. Formatting, the mock-export guard, and git diff --check passed. No assertions or timeouts were relaxed.

Prior reviewed head: cdbe1b7a79964a753a1f7d831e8a7f88d6dac5fe. Its tree exactly matches the reviewed/tested candidate. ClawSweeper revision 7 completed on this head at 2026-10-04 04:31:27 UTC, from successful review run 37176965092, with no actionable correctness or security findings. Its remaining substantive SDK-report request is now resolved below. Its repeated generated migration checkbox remains inapplicable: the substantive review confirms unchanged stored representation and deprecation metadata only.

Prior-head CI run 37176902534, attempt 1, finished in 545 CI seconds elapsed: 79 successful jobs, 21 skipped, one failed Windows job plus its failed aggregate gate, zero cancellations. Security-fast passed independently. No CI rerun was requested. This is recorded as failed CI, not green CI.

The sole failing case is write-unified-entry-dts > reuses unaffected canonical groups while rebuilding runtime after input edits in Windows job 111361482139. Main #164269 (4fa690195797c00155e15f1757ab7f963c6a9713) converted a type-only .js import in format-duration-exact.ts into a value import; native Node cannot resolve that nonexistent .js sibling, while the actual .ts file is present and copied by the fixture. The failure occurs while linking the native build generator, before account source is built.

The seven failure-path files are byte-identical in this PR, CI main 2e76e316c286b32d14581e7ad3480e1ec49253d7, and tested merge f9b8e862af61501af2b1aac4e9c42be238e05cfb; the PR changes none of them. Native Node 24.21 reproduces the import failure directly on clean main, and the exact test case failed 5/5 on that main (one full-file run, four file-scoped filtered runs, all with --maxWorkers=1). The full-file main run also had four unrelated local compiler-fixture deadline failures, which are preserved as local coverage limits; they are not attributed to this Windows CI case. The latest scheduled main run predates the introducing commit, so no same-failure scheduled-main result is claimed. The same case also failed 5/5 on the exact tested merge, using the same file/name filter, Node 24.21, and --maxWorkers=1 (102, 70, 109, 87, and 82 seconds). This completed independent attribution for the authorized native admin route, but that exception was not submitted: main landed the formatter repair before preparation finished. No passing replay or CI rerun was used as proof.

Prior-head local released-SDK report: passed for v2026.9.8 → cdbe1b7a79964a753a1f7d831e8a7f88d6dac5fe. All 12 pre-existing service members, including the seven synchronous methods, and the released action declaration are unchanged; exactly seven Async methods are added. Canonical report digest: cdc08e95b4bfe921d72910c75491c0ada070cce4f0ca27decc9fa1d55412ba92. The full report includes unrelated release-to-main API changes; this compatibility conclusion is scoped to the account service. No credentials appear in the control-plane result contracts or this public evidence.

Formatter repair integration

Head f9f2d5bb87b23fa2c8308e0d6c95553434d9a06d merges main 4bac1493291e7d931c0eea48b8ed07e98dc37ce0, including 3c0f7e4c5cdade301b896970c9afbf4ab253de5e, which changes the formatter's runtime import to the existing .ts sibling. The merge is conflict-free. All PR-owned account production and test files are byte-identical to the 93-case validated candidate; the only overlap is main's added redact-linear-matchers entry in the wrapper dependency inventory.

Fresh whole-PR Codex P2 review: scoped-clean against the integrated main. git diff --check passed. Native Node 24.21 successfully imports scripts/lib/format-duration.mts and formats 1,250 ms as 1.2s, directly confirming the repaired link. An additional bare-repository build-all.mts probe could not resolve the workspace package alias; it is an inspection setup gap, not claimed as declaration-fixture proof. The actual CI fixture supplies those workspace links.

This head was subsequently superseded by the main UI assertion repair below. Its failed CI and the earlier baseline timeout caveats remain historical evidence.

Integration and overlap

Main integration was reviewed and committed separately before compatibility work. Its inventory conflict was resolved by keeping one account-store classification list and retaining main’s Doctor/merge classifications. The compatibility update then restored native SDK classifications.

Coordination-only overlap: #162896 remains parked with its authority semantics preserved; the standing decision permits overlap with #162433. Other inspected overlaps were incidental: #104569 (inactive catalog-mode work), #164424 (separate generated-HTML namespace), and #164403 (does not change the close-prelude functions). No competing active account-storage migration or same-function security repair was found.

UI assertion repair integration

Head 6ff53caf135f73de6a773bc93cd7f6e9bd570435 merges main 6a3f4a2bd2612a216cbdd26cc222adab17b32c65 without conflicts, including the already-landed fix in 65829ead96bb115b69782e6357e8b619b3add8bf (#164465). Account production and fixture files are unchanged; main contributes lifecycle documentation, wrapper inventory entries, and unrelated baseline pruning. All existing main changes are preserved.

Prior-head CI run 37181476806, attempt 1: 80 successful jobs, 21 skipped, one failed UI job and its aggregate gate. The Windows declaration fixture passed, confirming the incorporated formatter repair. UI job 111374977300 failed only session-progress-refresh.e2e.test.ts / refreshes only the work card and preserves disclosure: desktop-expanded: it expected the retired session-progress-refresh-spin name after main #164577 switched CSS to shared btn-spinner-spin. All eight failure-path files match CI main e02b5b2972848a442dc76eeb4322ff6e5bf3b608 in tested merge 936b444731aa38bd8637592408c91a34178e6a1f; the PR changes no UI or Gateway client/protocol input, and this mocked-Gateway case cannot execute account storage. The landed fix checks that the animation is running while preserving the reduced-motion and other behavior assertions. Local 5+5 reproductions were not launched because the exact repair was already available and required integration. No rerun or admin exception was used.

ClawSweeper revision 10 completed on prior head f9f2d5bb87b23fa2c8308e0d6c95553434d9a06d at 2026-10-04 06:07:54 UTC, from run 37181631134, with no actionable correctness or security findings. Its substantive review explicitly rejects the generated migration checkbox: persisted schemas and bytes are unchanged. The final replacement head received the completed review recorded below.

Fresh complete-PR Codex P2 review: scoped-clean against integrated main. The committed tree ca0d13d60bb6d8055ff4fc31ae881475b82e3cfa matches the reviewed candidate. git diff --check passed; private credentials remain outside control-plane result contracts. The previous-head SDK run was deliberately interrupted and cleaned up when this landed repair made it obsolete; it is not counted as passing evidence. This intermediate report was interrupted when the subsequent real conflict required another main merge; the completed final-head comparison is recorded below.

Final-head focused validation: 13 cases passed in 481.12 seconds (479.41 seconds in the test wrapper), including the real close-prelude accepted-write regression, released public SDK type contract, runtime build graph, and reply import closure. Command: pnpm test src/gateway/server-close.model-accounts.test.ts src/plugin-sdk/gateway-model-account-connect-compat.test.ts test/scripts/runtime-process-build-graph.test.ts src/auto-reply/reply/get-reply.imports.test.ts --maxWorkers=1. The shutdown case itself took 21.22 seconds; most local wall time was compiler preparation/import work.

Final account-test conflict resolution

Head 97674e19d7a2c1092de6b697c64d5d78fbbc4717 merges main 6b48bdb60803ae8ec72fe7be3de645b50fec1475 without rebasing. Main cleanup #164798 overlapped connectToken in user-model-accounts.test.ts. Resolution retains this PR's prepared replacement credential and main's plain assertCurrent function, preserving all of main's test consolidation. No account production code changed. The previous head had no CI run because GitHub already reported the conflict.

  • Fresh complete-PR Codex P2 autoreview: scoped-clean, with no actionable findings or real credentials.
  • 27 focused cases passed in 274.22 seconds (272.54 seconds in the test wrapper): pnpm test src/state/user-model-accounts.test.ts src/gateway/server-close.model-accounts.test.ts --maxWorkers=1. The consolidated storage file passed 26 cases; the real close-prelude regression passed and proved accepted account/link persistence before database teardown.
  • Committed tree 4767037952bdcf028a05df7c9e4b68a9520e7df0 equals the reviewed and tested tree. git diff --check passed.
  • The preceding 13-case proof remains valid for unchanged SDK types, runtime build graph, and reply import closure. The completed local release-to-head SDK comparison is recorded below; superseded report runs are not counted as passes.

ClawSweeper revision 12 completed for exact head 97674e19d7a2c1092de6b697c64d5d78fbbc4717 at 2026-10-04 06:43:33 UTC, from successful trusted run 37183399723. No actionable correctness or security finding remains. Its substantive SDK-report request is satisfied by the completed local report below. The generated migration checkbox is inapplicable: the same review explicitly confirms unchanged stored-data contracts and compatibility metadata only.

Final-head CI run 37183347202, attempt 1: SUCCESS, 82 successful jobs, 21 skipped, zero failures or cancellations, 532 CI seconds elapsed. Aggregate openclaw/ci-gate job 111381387792 passed. The formerly failing UI E2E and Windows declaration fixtures both pass with their landed main repairs. No CI rerun or admin bypass was used.

Final-head local released-SDK report against v2026.9.8: generated and independently qualified for 97674e19d7a2c1092de6b697c64d5d78fbbc4717. All 12 existing service members and the original action shape are unchanged; exactly seven Async methods are added. Digest: 591add44230936c02afa21b96d498b7f6183b679f2b102a081584de96644f2d8. The full release-to-head report contains unrelated main API changes; this compatibility claim is scoped to the account service. The local tool exited 0 after native cleanup; total wall time was 1,220.74 seconds. This supplies the substantive comparison requested by ClawSweeper.

Move personal account control-plane storage to the existing shared-state
profile worker while preserving live transaction and commit authority,
credential comparison, FIFO admission, and disclosure revalidation.

Retain accepted persistence through the real close prelude and reconcile
confirmed commits with cancellation that races the worker result. Keep
unknown outcomes non-replayable and credentials out of RPC responses.

Release-note context: personal account RPC behavior and storage formats
remain compatible; account writes no longer execute on the Gateway thread.
Keep the seven account-service contracts shipped in v2026.9.8 synchronous
through the existing native store. Add awaited worker-backed replacements
and migrate bundled RPC callers to them. Preserve the released authority
callback shape, with transaction-local role facts on the worker action.

Deprecate the sync methods through the existing per-plugin warning owner
and record removal at the next Plugin SDK major. Restore the honest T1
classification for retained native inventory and link operations.

Validate immediate native persistence, worker/RPC isolation, authority,
settlement, warning deduplication, and released SDK type compatibility.
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@github-actions

github-actions Bot commented Oct 4, 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: 97674e19d7a2c1092de6b697c64d5d78fbbc4717
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/model-account-authority.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/operator-role-policy.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-methods/users-auth-connect.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XL labels Oct 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 4, 2026, 3:04 AM ET / 07:04 UTC (Revision 13).

ClawSweeper review

What this changes

Moves personal model-account storage operations into the existing database worker, updates Gateway callers, and preserves released synchronous plugin methods alongside awaited replacements.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open as useful, review-ready work. The final-head SDK comparison resolves the previous blocker, and no actionable correctness or security findings remain.

Likely related people: steipete and scoootscooob are routing candidates based on prior merged account work.

Priority: P2
Reviewed head: 97674e19d7a2c1092de6b697c64d5d78fbbc4717

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong production-boundary evidence, preserved released contracts, and successful exact-head validation support an above-average clean refactor.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Recorded isolated account-handler executions use the actual profile worker and SQLite owners, demonstrating allowed persistence, revoked transaction/commit rollback, disclosure refusal, and lost-reply non-replay; real Gateway close proof verifies accepted persistence before teardown. Stored schemas and serialized account formats are unchanged.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): Recorded isolated account-handler executions use the actual profile worker and SQLite owners, demonstrating allowed persistence, revoked transaction/commit rollback, disclosure refusal, and lost-reply non-replay; real Gateway close proof verifies accepted persistence before teardown. Stored schemas and serialized account formats are unchanged.
Evidence reviewed 8 items Pinned introduction and clean checkout: Reviewed the introduced delta from 6b48bdb to the exact original head. The supplied test merge is stale and was not used to attribute removals or regressions. The checkout remained clean, and the read-only whitespace check passed.
Authority through the final write: Worker admission binds the physical store, target profile, and exact actor-role facts; both transaction and commit grants invoke current host authority. The Gateway callback also checks the original connection, current profile identities, scopes, and live role policy. Native account kernels repeat credential/selection comparisons inside synchronous transactions.
Production-boundary proof: The recorded executions exercise real profile workers and SQLite through account handlers: allowed writes, transaction/commit refusal with unchanged storage, credential/selection races, disconnected disclosure, and lost worker replies without replay. The real Gateway close regression verifies persisted credential/link state after dependency teardown. Test source was inspected; no tests or target code were executed during this review.
Findings None None.
Security None None.

How this fits together

The Gateway account service accepts authenticated account-management requests and provider sign-in results. It stores private credentials and account selections, then supplies sanitized account information to clients and model selection.

flowchart TD
  A[Authenticated account request] --> B[Gateway account service]
  C[Provider sign-in result] --> B
  B --> D[Existing profile worker]
  D --> E{Current authority and account rows}
  E -->|Allowed| F[Private account storage]
  E -->|Refused| G[Visible error]
  F --> H[Sanitized account reply]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +696, Tests +1287, Docs +70, Other +1. Total +2054 across 49 files.

View PR surface stats
Area Files Added Removed Net
Source 25 869 173 +696
Tests 17 1901 614 +1287
Docs 4 70 0 +70
Config 0 0 0 0
Generated 0 0 0 0
Other 3 8 7 +1
Total 49 2848 794 +2054

Review metrics

Metric Value Why it matters
SDK compatibility surface 12 existing members preserved; 7 Async methods added The completed released-SDK comparison resolves the prior review's concrete compatibility prerequisite.
Production and test growth production +869/-173, net +696; tests/support +1901/-614, net +1287 Production growth is explained by worker admission, retained-write settlement, and shipped synchronous compatibility.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/plugins/compat/model-account-connect-record.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Use the existing profile worker for bundled account operations while retaining shipped synchronous SDK contracts through their documented deprecation window.

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

Not applicable as a standalone bug report; current-main source establishes the native storage path, and recorded production-boundary executions demonstrate the changed worker behavior.

Is this the best way to solve the issue?

Yes. Reusing the existing worker and transaction owners, migrating bundled callers, and preserving released plugin contracts provides a coherent execution cutover.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: Seven awaited plugin methods expand the SDK surface, with released synchronous contracts preserved and the compatibility window explicitly documented and checked.

Label justifications:

  • P2: This is a bounded internal storage improvement with established account behavior preserved.
  • merge-risk: 🚨 compatibility: Seven awaited plugin methods expand the SDK surface, with released synchronous contracts preserved and the compatibility window explicitly documented and checked.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Recorded isolated account-handler executions use the actual profile worker and SQLite owners, demonstrating allowed persistence, revoked transaction/commit rollback, disclosure refusal, and lost-reply non-replay; real Gateway close proof verifies accepted persistence before teardown. Stored schemas and serialized account formats are unchanged.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded isolated account-handler executions use the actual profile worker and SQLite owners, demonstrating allowed persistence, revoked transaction/commit rollback, disclosure refusal, and lost-reply non-replay; real Gateway close proof verifies accepted persistence before teardown. Stored schemas and serialized account formats are unchanged.

Evidence

What I checked:

  • Pinned introduction and clean checkout: Reviewed the introduced delta from 6b48bdb to the exact original head. The supplied test merge is stale and was not used to attribute removals or regressions. The checkout remained clean, and the read-only whitespace check passed. (97674e19d7a2)
  • Authority through the final write: Worker admission binds the physical store, target profile, and exact actor-role facts; both transaction and commit grants invoke current host authority. The Gateway callback also checks the original connection, current profile identities, scopes, and live role policy. Native account kernels repeat credential/selection comparisons inside synchronous transactions. (src/state/user-model-account-operations.ts:24, 97674e19d7a2)
  • Production-boundary proof: The recorded executions exercise real profile workers and SQLite through account handlers: allowed writes, transaction/commit refusal with unchanged storage, credential/selection races, disconnected disclosure, and lost worker replies without replay. The real Gateway close regression verifies persisted credential/link state after dependency teardown. Test source was inspected; no tests or target code were executed during this review. (src/gateway/model-account-connect.worker.test.ts:89, 97674e19d7a2)
  • Complete captured body inspected: The complete GitHub body was retrieved and its exact SHA-256 matched the captured snapshot: 983f3e2aef266c28875d620fa1e93119f01f6557b3e3182201299ff15c206fc6, 28,561 UTF-16 units. The previously omitted sections record final-head 27-case storage/close validation and the completed local released-SDK comparison, digest 591add44230936c02afa21b96d498b7f6183b679f2b102a081584de96644f2d8, exit 0 after cleanup in 1,220.74 seconds. (97674e19d7a2)
  • Released SDK compatibility blocker resolved: Release-tag source confirms the original action shape and synchronous account methods. Current source retains their immediate native completion; public-context type coverage and runtime persistence coverage support the recorded comparison preserving all 12 existing service members and adding seven Async methods. Migration documentation explicitly retains synchronous compatibility until the next SDK major and breaking-release approval. The compatibility record is metadata, not a stored-data migration. (src/plugin-sdk/gateway-model-account-connect-compat.test.ts:15, fc23bc864e45)
  • Still necessary on current main: Fetched main still uses native personal account control-plane operations and lacks this service's worker-backed cutover. Related merged auth-usage, media, and lifecycle PRs address adjacent owners rather than superseding this work. The latest release establishes the synchronous compatibility contract, not an implementation of the requested cutover. (src/gateway/model-account-connect.ts:110, d65e8ec89bb3)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • scoootscooob: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-04T03:18:44.530Z sha eacc014 :: blocked before merge. :: none
  • reviewed 2026-10-04T03:38:15.842Z sha eacc014 :: blocked before merge. :: none
  • reviewed 2026-10-04T04:31:27.556Z sha cdbe1b7 :: blocked before merge. :: none
  • reviewed 2026-10-04T04:58:42.634Z sha cdbe1b7 :: blocked before merge. :: none
  • reviewed 2026-10-04T05:16:22.760Z sha cdbe1b7 :: blocked before merge. :: none
  • reviewed 2026-10-04T06:07:54.713Z sha f9f2d5b :: blocked before merge. :: none
  • reviewed 2026-10-04T06:33:03.271Z sha 6ff53ca :: blocked before merge. :: none
  • reviewed 2026-10-04T06:43:33.344Z sha 97674e1 :: blocked before merge. :: none

@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Give internal worker operations distinct Async exports and migrate their callers and mocks, preserving all released synchronous service signatures.

Route the account-catalog integration through the existing host-broker test owner. Freeze its catalog deadlines while held auth and DNS gates wait for worker admission, retaining successful unlink, refusal, and zero forbidden HTTP assertions.
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 4, 2026
Merge main to resolve the account-control lane conflicts with auth-usage shutdown (#164588) and canonical ACP metadata (#162920).

Retain both close-prelude owners and pass canonical ACP metadata alongside prepared personal-account selection. The released account service signatures and storage contract remain unchanged.
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Oct 4, 2026
Merge main d0c5963 to incorporate the inherited type-suppression inventory repair from d073c77.

Keep the account-control worker delta unchanged and combine the wrapper dependency inventory with current main. The account service, authority checks, storage operations, close prelude, metadata, and released synchronous SDK contracts retain their reviewed implementation.
Merge main 4fa6901, including the inherited large-baseline scanner repair.

Preserve real exports in twelve account fixture mocks before overriding the specific test functions. Remove the duplicate nonexistent mock export and prune seven obsolete mock baseline entries without adding allowances. Keep the existing behavior assertions and account production implementation.
@clawsweeper clawsweeper Bot added the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Oct 4, 2026
Merge main 4bac149, including the native duration import fix from 3c0f7e4 that resolves the inherited Windows declaration-fixture failure.

Preserve the reviewed account worker and fixture changes. The only overlap is main's added wrapper dependency inventory entry. Native Node now imports the formatter and returns the expected duration value.
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Incorporate main 6a3f4a2, including the landed session progress animation test repair. Account production and fixture bytes are unchanged; fresh whole-PR P2 review is clean.
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 4, 2026
Preserve main test consolidation and its plain authority callback while retaining prepared replacement credentials. The resolved storage suite and real account shutdown regression pass (27 cases); complete-PR P2 review is clean.
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Oct 4, 2026
@steipete
steipete merged commit a6b9da2 into main Oct 4, 2026
187 of 188 checks passed
@steipete
steipete deleted the dbasync/acctctl branch October 4, 2026 07:59
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…openclaw#164630)

* refactor(gateway): store personal model-account links through workers

Move personal account control-plane storage to the existing shared-state
profile worker while preserving live transaction and commit authority,
credential comparison, FIFO admission, and disclosure revalidation.

Retain accepted persistence through the real close prelude and reconcile
confirmed commits with cancellation that races the worker result. Keep
unknown outcomes non-replayable and credentials out of RPC responses.

Release-note context: personal account RPC behavior and storage formats
remain compatible; account writes no longer execute on the Gateway thread.

* fix(plugin-sdk): retain synchronous personal account methods

Keep the seven account-service contracts shipped in v2026.9.8 synchronous
through the existing native store. Add awaited worker-backed replacements
and migrate bundled RPC callers to them. Preserve the released authority
callback shape, with transaction-local role facts on the worker action.

Deprecate the sync methods through the existing per-plugin warning owner
and record removal at the next Plugin SDK major. Restore the honest T1
classification for retained native inventory and link operations.

Validate immediate native persistence, worker/RPC isolation, authority,
settlement, warning deduplication, and released SDK type compatibility.

* fix(gateway): qualify async account operations and broker tests

Give internal worker operations distinct Async exports and migrate their callers and mocks, preserving all released synchronous service signatures.

Route the account-catalog integration through the existing host-broker test owner. Freeze its catalog deadlines while held auth and DNS gates wait for worker admission, retaining successful unlink, refusal, and zero forbidden HTTP assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts security-sensitive-changed size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant