Repository navigation
feat: prepare local client credential storage and recovery - #174294
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
eb68a62 to
9c028be
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb68a6276d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| canonicalSource?.role === "client" && | ||
| tableExists(database, "native_exec_socket_credentials") |
There was a problem hiding this comment.
Preserve socket redaction across downgrade backups
When the later cutover creates this store and a user rolls back to a build predating this commit, that build's classifyBackupSqliteSource treats client/credentials.sqlite as an unknown opaque SQLite file, while backup-create.ts archives opaque files byte-for-byte and excludes their transient sidecars. Such a backup bypasses this new transform, can capture an inconsistent database, and restores the installation-local socket token that this code explicitly requires regenerating. The format/location needs a downgrade-safe contract—for example, ensure future activation invalidates socket material restored by legacy opaque backups rather than relying solely on this version-aware sanitizer.
AGENTS.md reference: AGENTS.md:L57-L57
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesThis PR adds an independent local credential store with TypeScript and Swift operations, backup sanitization, and update recovery support. Example: Back up client/credentials.sqlite containing device synthetic-device and socket token synthetic-socket-secret.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: this maintainer-authored preparation has a clear purpose, but two introduced tooling integration defects block merge. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe local SQLite store receives identity, cached-token, and native socket operations; backup and update owners capture it separately from Gateway state, while production clients retain their existing credential stores. flowchart TD
A[Existing production clients] --> B[Existing shared credential storage]
C[Prepared TypeScript and Swift operations] --> D[Local credential SQLite store]
D --> E[Sanitized user backup]
D --> F[Exact update recovery capture]
Technical reviewBest possible solution: Retain the approved preparatory scope and repair the wrapper extraction inventory and SQLite guard registration before merging. Do we have a high-confidence way to reproduce the issue? Exact-head CI supplies the missing-module failure trace, and source inspection independently establishes both tooling defects; no local execution was performed. Is this the best way to solve the issue? The separately versioned local owner and recovery preparation fit the maintainer-approved split, provided the tooling integrations are completed. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6e8bb0f3aebf. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1102, Tests +743, Docs +51, Other +23. Total +1919 across 32 files. Added test files: 3. View PR surface stats
LabelsLabel changes:
Label justifications:
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 Reviewed October 16, 2026, 10:32 AM ET / 14:32 UTC. |
9c028be to
b21aa93
Compare
076a955 to
8505991
Compare
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…4584) The new native credential suite passed a raw macOS TMPDIR path to an owner that requires a resolved client root. SQLite's no-follow open rejects the /var alias with SQLITE_CANTOPEN_SYMLINK, before any credential operation. Resolve only the newly created fixture root and retain its existing cleanup. Production path guards, credential operations and all assertions are unchanged. The unchanged current-main suite reproduced all 13 hourly issues through /var and passed all 10 tests through the same physical /private/var root. The patched suite passes all 10 through the original aliased TMPDIR under an OS sandbox (1.508s tests, 3.755s process). Package build and format pass; strict lint retains the same two baseline findings. No app was launched, no operator credentials were accessed, and no CI rerun was requested. The fixture and preparatory adapter were introduced by 4706053 (#174294); the PR explicitly enables no production credential consumers. Independent P2 review of the tracked test patch was scoped-clean.
Owner refactors left unused exports and moved deprecated outbound test calls into a scanned shared helper. Use the supported durable send API while keeping the prior queue default, result arrays, and error behavior. Remove dead helpers, internalize local implementations, and keep catalog discovery with its owner. Keep the public quota type for declaration emission and check the marker at its producer. Receipt tests use the canonical file reader with unchanged byte assertions. The client credential API is intentionally staged by #174294; model its entry until cutover instead of deleting the unactivated owner. No Knip ignores or credential implementation changes. Proof: deadcode dependencies/exports/unused-files and deprecated API guards pass; core/scripts/UI and affected test types, declaration emission, targeted lint/boundary lint/format, and P2 review pass. Focused quota/Doctor tests pass (53.0s wall), as do 49 completion tests (160.21s wall), using maxWorkers=1. Remaining importer proof and inherited architecture findings are recorded in the PR. The full architecture command reaches four unchanged legacy sentinel references from #174489; no baseline or assertion is weakened.
* fix(ci): restore dependency and runtime hygiene checks Owner refactors left unused exports and moved deprecated outbound test calls into a scanned shared helper. Use the supported durable send API while keeping the prior queue default, result arrays, and error behavior. Remove dead helpers, internalize local implementations, and keep catalog discovery with its owner. Keep the public quota type for declaration emission and check the marker at its producer. Receipt tests use the canonical file reader with unchanged byte assertions. The client credential API is intentionally staged by #174294; model its entry until cutover instead of deleting the unactivated owner. No Knip ignores or credential implementation changes. Proof: deadcode dependencies/exports/unused-files and deprecated API guards pass; core/scripts/UI and affected test types, declaration emission, targeted lint/boundary lint/format, and P2 review pass. Focused quota/Doctor tests pass (53.0s wall), as do 49 completion tests (160.21s wall), using maxWorkers=1. Remaining importer proof and inherited architecture findings are recorded in the PR. The full architecture command reaches four unchanged legacy sentinel references from #174489; no baseline or assertion is weakened. * fix(ci): preserve live GitHub digest and localize unused helpers Main d25d32d (#173712) added an Enterprise session-reader consumer after the original audit base. The first PR merge build failed with MISSING_EXPORT/TS2305 because the hygiene commit removed its helper. Restore factoryGitHubRequestDigest exactly as on main and rebase for the named build failure, preserving request binding and authorization checks. The current export scan also finds three helpers used only by their own modules: sessionGitHubRepositoryUrl, copyProgressDraftLineMetadata and cloneBoardSnapshot. Make them private; keep all implementations intact. The progress snapshot consumer was retired deliberately in #174559. Proof: CI artifact build passes (377.09s); 39 Enterprise consumer tests pass (95.55s, --maxWorkers=1). Four visibility suites pass (347.37s, --maxWorkers=1); export scan passes with zero findings (202.10s). Fresh P2 review is scoped-clean. Additional local type, lint and importer proof is recorded in the PR. * chore(ci): leave UI helper cleanup to focused peer fix READY PR #174625 now covers the exact openNewSessionPlusMenu deletion. Restore this file to the base version so this branch contains only the remaining hygiene repairs. No UI code or assertions differ from main. The duplicate guard verified the peer's diff and fresh OPEN/non-draft state. P2 review of this scope reduction is clean; existing runtime, export, type and owner-test proof remains valid for the retained changes. * chore(ci): defer parser fixture cleanup to existing PR The final duplicate guard found READY PR #174631 with the exact observeJsonParse deletion. Restore the fixture to the base version so this PR no longer overlaps that active cleanup. Its importing tests and assertions are unchanged and had already passed locally. Fresh P2 review is clean. Retained runtime changes keep their completed build, focused test, type, lint and declaration proof.
…174586) * test(build): include client catalog in service relay closure PR #174294 intentionally adds local client credential schema facts to the shared lazy SQLite catalog reader. The service anchor's lineage writer retains that reader, so its emitted closure includes the client catalog. Keep the exact artifact inventory and all unresolved-import assertions. Current-main baseline: 56 passed, one exact seventh-asset mismatch. After: 57 passed (122.56 s wrapper / 118.15 s Vitest). Targeted tsgo, type-aware lint, format, and P2 autoreview pass. * fix(sessions): keep history readers independent of host acquisition PR #174360 correctly requires the agent engine to revalidate retained maintenance authority, including ordinary forward opens. Importing that guard through the lease owner also pulled host state acquisition into the read-only history graph. Move the existing strict guard and its single AsyncLocalStorage context to a private leaf. Migrate every strict-guard consumer and the existing fault-injection spies. Lease identity, expiry and scope checks are unchanged. Baseline: history import boundary fails with engine -> lease -> host state. After: all 42 focused history, maintenance and migration tests pass; wrapper source closure 3/3 passes. Targeted types, lint, formatting and P2 review pass. PostgreSQL migration execution remains PR CI proof (no local server). * test(gateway): drain agent resources before removing resume fixture CI finished the first resume case but root removal raced asynchronous agent-database resource retirement and failed with ENOTEMPTY. The synchronous close API starts that retirement without joining it. Await the existing async owner before the shared fixture removes its root. Keep every assertion and deadline unchanged. All six file cases pass locally (38.36 s wrapper); targeted types, type-aware lint, format and isolated P2 review pass. The CI failure is not claimed to be a regression caused by the history import repair.
…174294) * feat: prepare local client credential storage and recovery * fix(db): complete local credential preparation checks * refactor(update): keep credential preparation within version owner * refactor(update): own schema contract without circular imports
…nclaw#174584) The new native credential suite passed a raw macOS TMPDIR path to an owner that requires a resolved client root. SQLite's no-follow open rejects the /var alias with SQLITE_CANTOPEN_SYMLINK, before any credential operation. Resolve only the newly created fixture root and retain its existing cleanup. Production path guards, credential operations and all assertions are unchanged. The unchanged current-main suite reproduced all 13 hourly issues through /var and passed all 10 tests through the same physical /private/var root. The patched suite passes all 10 through the original aliased TMPDIR under an OS sandbox (1.508s tests, 3.755s process). Package build and format pass; strict lint retains the same two baseline findings. No app was launched, no operator credentials were accessed, and no CI rerun was requested. The fixture and preparatory adapter were introduced by a67871a (openclaw#174294); the PR explicitly enables no production credential consumers. Independent P2 review of the tracked test patch was scoped-clean.
* fix(ci): restore dependency and runtime hygiene checks Owner refactors left unused exports and moved deprecated outbound test calls into a scanned shared helper. Use the supported durable send API while keeping the prior queue default, result arrays, and error behavior. Remove dead helpers, internalize local implementations, and keep catalog discovery with its owner. Keep the public quota type for declaration emission and check the marker at its producer. Receipt tests use the canonical file reader with unchanged byte assertions. The client credential API is intentionally staged by openclaw#174294; model its entry until cutover instead of deleting the unactivated owner. No Knip ignores or credential implementation changes. Proof: deadcode dependencies/exports/unused-files and deprecated API guards pass; core/scripts/UI and affected test types, declaration emission, targeted lint/boundary lint/format, and P2 review pass. Focused quota/Doctor tests pass (53.0s wall), as do 49 completion tests (160.21s wall), using maxWorkers=1. Remaining importer proof and inherited architecture findings are recorded in the PR. The full architecture command reaches four unchanged legacy sentinel references from openclaw#174489; no baseline or assertion is weakened. * fix(ci): preserve live GitHub digest and localize unused helpers Main faa7f43 (openclaw#173712) added an Enterprise session-reader consumer after the original audit base. The first PR merge build failed with MISSING_EXPORT/TS2305 because the hygiene commit removed its helper. Restore factoryGitHubRequestDigest exactly as on main and rebase for the named build failure, preserving request binding and authorization checks. The current export scan also finds three helpers used only by their own modules: sessionGitHubRepositoryUrl, copyProgressDraftLineMetadata and cloneBoardSnapshot. Make them private; keep all implementations intact. The progress snapshot consumer was retired deliberately in openclaw#174559. Proof: CI artifact build passes (377.09s); 39 Enterprise consumer tests pass (95.55s, --maxWorkers=1). Four visibility suites pass (347.37s, --maxWorkers=1); export scan passes with zero findings (202.10s). Fresh P2 review is scoped-clean. Additional local type, lint and importer proof is recorded in the PR. * chore(ci): leave UI helper cleanup to focused peer fix READY PR openclaw#174625 now covers the exact openNewSessionPlusMenu deletion. Restore this file to the base version so this branch contains only the remaining hygiene repairs. No UI code or assertions differ from main. The duplicate guard verified the peer's diff and fresh OPEN/non-draft state. P2 review of this scope reduction is clean; existing runtime, export, type and owner-test proof remains valid for the retained changes. * chore(ci): defer parser fixture cleanup to existing PR The final duplicate guard found READY PR openclaw#174631 with the exact observeJsonParse deletion. Restore the fixture to the base version so this PR no longer overlaps that active cleanup. Its importing tests and assertions are unchanged and had already passed locally. Fresh P2 review is clean. Retained runtime changes keep their completed build, focused test, type, lint and declaration proof.
…penclaw#174586) * test(build): include client catalog in service relay closure PR openclaw#174294 intentionally adds local client credential schema facts to the shared lazy SQLite catalog reader. The service anchor's lineage writer retains that reader, so its emitted closure includes the client catalog. Keep the exact artifact inventory and all unresolved-import assertions. Current-main baseline: 56 passed, one exact seventh-asset mismatch. After: 57 passed (122.56 s wrapper / 118.15 s Vitest). Targeted tsgo, type-aware lint, format, and P2 autoreview pass. * fix(sessions): keep history readers independent of host acquisition PR openclaw#174360 correctly requires the agent engine to revalidate retained maintenance authority, including ordinary forward opens. Importing that guard through the lease owner also pulled host state acquisition into the read-only history graph. Move the existing strict guard and its single AsyncLocalStorage context to a private leaf. Migrate every strict-guard consumer and the existing fault-injection spies. Lease identity, expiry and scope checks are unchanged. Baseline: history import boundary fails with engine -> lease -> host state. After: all 42 focused history, maintenance and migration tests pass; wrapper source closure 3/3 passes. Targeted types, lint, formatting and P2 review pass. PostgreSQL migration execution remains PR CI proof (no local server). * test(gateway): drain agent resources before removing resume fixture CI finished the first resume case but root removal raced asynchronous agent-database resource retirement and failed with ENOTEMPTY. The synchronous close API starts that retirement without joining it. Await the existing async owner before the shared fixture removes its root. Keep every assertion and deadline unchanged. All six file cases pass locally (38.36 s wrapper); targeted types, type-aware lint, format and isolated P2 review pass. The CI failure is not claimed to be a regression caused by the history import repair.
What Problem This Solves
Prepare the local credential owner and its recovery support before the atomic client cutover. This is PR1a of the R0 native-ownership design, whose split ownership Peter approved on 2026-10-14.
The independently versioned SQLite store is
<resolved-client-root>/client/credentials.sqlite(version 1). It holds exact client identities, device/Gateway token caches, native socket credentials, and migration receipts. The TypeScript owner and Swift adapter provide bounded operations under exclusive custody: a running macOS app owns its store; other clients use its local operations, and failed IPC never falls back to a second writer. App-absent and iOS/extension operations acquire and release custody per operation. Maintenance drains and closes the active owner before capture or restore. No timestamp reconciliation is introduced.This PR enables no production credential reader or writer, performs no migration, retires no shared table, and changes no approval-policy semantics. Update/Doctor include the local family in exact capture/restore, including absence. Ordinary backups retain identity/cache records and remove the socket token so local socket authentication regenerates after restore. The archive records private client-directory permissions before its database entry.
Update and rollback contract
client/credentials.sqlite.The shared state schema stays at v25. PR1b takes the next free version at landing: 26 if it lands before the session-state-heads change, otherwise 27; the second lane renumbers and regenerates PostgreSQL artifacts and schema docs. Its table-scoped capture is exactly
[device_identities, device_auth_tokens, gateway_origin_device_tokens, exec_approvals_config], plussqlite_stat1/sqlite_stat4if indexes change.Evidence
Local proof uses synthetic isolated state and Homebrew PostgreSQL 17, without Docker or launching/installing the app. Retained proof includes 7 TypeScript credential owner contracts; 32 Swift NativeState tests and the final 10-test credential suite; strict Swift lint/format; the canonical macOS app build; SQLite backup/restore and CLI migration checks. Published
2026.10.4and2026.10.10-beta.1capture/restore experiments restored exact canonical shared credential rows with an ignored local orphan. The separate native-root retirement failure led to the approved copy-only contract above.After rebasing over the merged memory-catalog and retained-agent changes, generated catalogs were regenerated from main, preserving both memory and client expectations. Final checks cover PostgreSQL catalogs/generators (144 catalog + 21 generator tests), core typecheck, touched lint/format, eager import closure (19 tests), wrapper source closure (3 tests), Kysely guard, native schema guard, database dialect/worker and line-cap ratchets. The backup sanitizer has its offline classification; raw SQLite bootstrap statements have narrow admission annotations; inactive Swift declarations have explicit preparatory Periphery annotations; client catalogs are in the wrapper inventory. The version/alias publication helper and its schema/type now live in the existing versions owner without changing behavior; the previous type export remains available without a circular dependency.
The final focused run passed 16 tests, including the combined retained-PG-agent/local-identity/token/socket restore after candidate failure, both local schema visibility modes, nine schema inspection cases, and ordinary backup sanitization. Four namespaced-path tests are Windows-only and skipped on macOS. The unchanged original-baseline sealing case rejects the external volume's mode-0775 ancestor; its trust guard walks all ancestors, so a private child cannot satisfy it. This is a local environment limitation, separate from the passing candidate rollback case; no host permission or product guard was changed. Source-seal verification and cleanup completed.
The full PR diff was independently reviewed with no actionable P0–P2 findings before the final schema/type relocation. CI then exposed a type-only Madge cycle from the helper move; the unchanged version schema and inferred type now belong to the existing versions module. Both cycle checks, core typecheck, lint, formatting, and the line-cap ratchet pass. The subsequent focused repair review is also clean. The touched version/schema run passed 31 tests; its external-file-link case initially inherited the checkout package root through an in-repository temporary directory and passed when repeated with a task-private sibling temporary root. No product guard changed.
Previously verified inherited on clean base
c5aabc24a6ed9c2c235440d04e2966c3b6ae3ccf: the three UI max-lines findings (ui/src/pages/chat/components/chat-message.test.tsx,ui/src/pages/config/config-page-state.ts,ui/src/pages/sessions/sessions-page-state.ts); generated Mermaid Knip assetsmermaid.min-DhdZyIsV.js,frame.js, andnative.jsin both shared Mermaid resource trees; and theapplyProviderAuthConfigPatchwrapper inventory finding. Current-head CI is reported separately and is not presumed green from earlier proof. A local worktree-provision test hit its existing 120-second APFS timeout (15 passed, 1 platform skip, 1 timeout); no timeout or assertion was relaxed.Production delta against the pinned main base: +1,125/-50, net +1,075 across 15 production files (33 files total). Generated outputs, docs, tests, and wrapper inventory are excluded from production LOC. Exact-head CI is reported separately. Growth is the independently versioned owner, matching Swift adapter, and recovery support; the preparatory split is design-sanctioned and LOC is reported, not a stop condition.
Landing CI exceptions
Head
8505991367231a97da568cc19ce7bd967307271b, CI run 38943145883, attempt 1. Peter authorized the native admin exception for the verified runner/inherited failures below; the completed run has 65 successful jobs, including typechecks, source contracts and additional boundaries. PostgreSQL conformance is not green: its three failures are also proven inherited and are included under the operator's relaxed inherited-failure rule.ios-screenshotschecks-node-changed-compact-small-15src/sessions/session-state-events.worker-control.test.tsalso fail in scheduled main run 38940084041, job 117105699839. The failing four-file Bun subshard is disjoint from this PR; the test and session-event producer files are unchanged between the tested baseline and merge.PostgreSQL conformancesrc/infra/database-engine/matrix-roots.postgres.test.tsalso fail in scheduled main run 38940084041, job 117105697665: the pendingmatrix/matrix-inbound-dedupe-to-claimable-dedupemigration and the dependent zero-versus-two assertions.openclaw/ci-gateThe conflict-only rebase preserved both independent imports in the backup snapshot owner and regenerated the worker inventory. The focused local credential backup/restore test, formatting, and diff checks passed after rebase. No product fix push, production credential cutover, or changelog edit was made.