Repository navigation
feat(state): local client credential cutover (R0 PR1b) - #174599
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR moves client identities, cached tokens, and native socket secrets into a separately versioned local SQLite store. Example: A CLI installation uses PostgreSQL for Gateway state.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep open: this maintainer-approved cutover remains necessary, the two latest findings are addressed, and the explicit landing pause still applies. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherCLI and Apple clients submit bounded credential operations to the active app or an exclusive offline owner; migration and restore owners preserve the shared/local binding. flowchart TD
A[CLI and Apple clients] --> B[Credential routing]
B --> C[Authenticated app control]
B --> D[Exclusive offline custody]
C --> E[Local credential SQLite]
D --> E
F[Doctor and updater] --> E
F --> G[Shared state migration]
Technical reviewBest possible solution: Complete the approved single-owner cutover with exact migration and restore binding, preserving the documented rollback contract. Do we have a high-confidence way to reproduce the issue? This is an approved architectural cutover; current-main source confirms the shared-storage coupling, and no runtime reproduction was attempted during this read-only review. Is this the best way to solve the issue? The inspected implementation uses one local credential owner and existing migration, backup, and capture coordinators; the two requested repairs fit those owners without introducing competing state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0a0d88df543a. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete bypass was established, but the new credential-disclosure boundary still needs its scheduled authority proof. EvidenceWhat I checked:
Likely related people:
PR surfacePR surface statistics unavailable: the file list is incomplete. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 17, 2026, 6:29 PM ET / 22:29 UTC (Revision 5). |
f30c956 to
d09b09a
Compare
f9e8e76 to
62e3976
Compare
3f78fee to
a1095b1
Compare
Behavior and ownership
Implements Peter's approved R0 ownership split (2026-10-14), following PR1a #174294 and the landed R14b seam #174360. Swift and TypeScript client identities, token caches, and IPC/socket credentials now belong to the explicitly local
<resolved-client-root>/client/credentials.sqlite. Native bootstrap does not open the selected Gateway database. Approval policy and effect-time authority stay unchanged.App-running callers use authenticated bounded operations; app-absent callers acquire exclusive local custody. Migration captures, copies exact rows, verifies, publishes its receipt, then retires shared credentials under the same custody. Shared schema/cutover is 29; local store and receipt versions stay 1. Receipts bind source identity, generation, and content hash. A stale orphan store is rebuilt from the authoritative source, never merged.
Independent native sources remain byte-identical and genuinely read-only. Same-source imports retain local tokens and consumed-import claims; changed or restored sources trigger a bounded rebuild. Revoked credentials cannot be reimported. Old native readers refuse retired canonical layouts and accept untouched independent sources.
This replaces closed #174485: frozen predecessor artifacts exceeded ClawSweeper's changed-line limit. The replacement uses delta SQL and regenerated current artifacts, with no frozen predecessor runtime/catalog copies.
Update and rollback
Before first cutover the local store does not exist: PR1a enables no production reader or writer. Published SQLite drivers capture the shared credential tables. Automatic rollback restores those tables and socket material; the old version ignores the orphan local store. Credentials issued between upgrade and rollback are lost; affected clients re-pair. The next upgrade rebuilds local state from restored shared state.
PG installations begin with PR1a/R14b-capable drivers that capture shared families and local companions. R14b's capture coordinator attributes the candidate Doctor's writes; no parallel journal or borrow registry was added. Standalone SQLite Doctor takes a fresh same-custody table backup, verifies source row hashes, then retires. Scope is
[device_identities, device_auth_tokens, gateway_origin_device_tokens, exec_approvals_config], plussqlite_stat1/sqlite_stat4for retired indexes. Native-v0 at a PG anchor refuses with guidance to start once on SQLite, runopenclaw doctor --fix, then port; it is not auto-published.Actual published stable 20→29→20, beta 22→29→22, and installed PR1a PG 25→29→25 capture → candidate Doctor → rollback harnesses pass. They verify restored shared credentials/socket rows, the orphan-store contract, unchanged independent-source bytes/mode/mtime/inode, and old native-reader acceptance.
Rebase and conflict resolutions
Rebased onto
c91613518f8076c61f7e598c93388488899426a2, preserving main's schema 28 and assigning this cutover 29. Generated files were regenerated through their owners.The latest main change inlined the single-caller JSONL transport. This cutover introduces a second production caller, so the reconciliation retains one shared transport plus the exec-host adapter and preserves main's complete real-socket tests. The credential-specific revocation-before-send and bounded-reply tests remain. Generated worker inventory was regenerated, never hand-merged. Independent P0–P2 rebase review is clean. Final local results are recorded below.
Proof
Latest rebase proof: 125 selected tests pass across nine full files (47 transport/credential; 78 updater/admission/onboarding), three type graphs and scoped type-aware lint/format pass, PG generation/check 176 contracts and Kysely four contracts pass. Wrapper inventory/closure, import guard, and ratchets pass except the three inherited UI findings. Mac disconnect 7/7 and test build pass; generated Swift bytes are unchanged from the prior complete native proof. The earlier broad-config lint invocation timed out in declaration preparation before lint ran; the supported core-config lint completed cleanly.
Final source head:
a1f95b9c505ca389bb00235312250bcc51e2058e. Current-head CI: 39324475402, actual tested merge0ee4e16ea617466677ff3a2c25bf7a14d5138119/ main1099ccc1713bda550cbbf04b97b3f6d4299b0415. All three PG shards actually passed: 934 passed, 37 skipped, zero failed. All CI jobs are now terminal; classification is below. Earlier83986705evidence remains retained as historical proof; the classification below uses the current head and attempt.Signed real-Mac proof pending (coordinator-owned post-land verification).
Current-head CI classification
Run 39324475402, attempt 1, head
a1f95b9c505ca389bb00235312250bcc51e2058e, actual tested merge0ee4e16ea617466677ff3a2c25bf7a14d5138119against main1099ccc1713bda550cbbf04b97b3f6d4299b0415.All 205 checks are terminal: 182 successful, 15 skipped, seven inherited failed jobs plus the aggregate gate. No retry was requested for this head. The seven failures are independently reproduced on main or supported by unchanged-input main proof; native admin admission preserves their failed status.
board.widget.put, before grant-revocation assertions. Sixteen recorded inputs unchanged per side; prior exact-main original-file reproduction and platform/readiness limits are retained.createDeferredCoreand resulting implicit-any errors, plusprefer-promise-reject-errorsin the same unchanged test. The original checker and canonical lint rule were run without source edits.Historical local failures remain recorded in native review; passing replays do not erase them. The main/PR identity and fixture differences are retained in the evidence. Native admin admission is used for the verified inherited failures; failed CI is not represented as green.
The three inherited local UI max-lines findings are
ui/src/pages/chat/components/chat-message.test.tsx,ui/src/pages/config/config-page-state.ts, andui/src/pages/sessions/sessions-page-state.ts. Clean main also reproduces six generated Mermaid Knip assets:assets/mermaid.min-DhdZyIsV.js,frame.js, andnative.jsunder bothapps/shared/OpenClawKit/Sources/OpenClawChatUI/Resources/Mermaid/andapps/shared/mermaid/assets/mermaid/.Size
+3,896 net production lines, or +3,870 excluding the generator (+26), against the rebase base above. Full diff: 29,532 changed lines across 518 files, below ClawSweeper's 50,000-line limit. Complete Swift/TS cutover, custody, receipt/source binding, old-client fencing, and rollback support account for growth beyond the +1,500–2,200 estimate.