Skip to content

feat: prepare local client credential storage and recovery - #174294

Merged
steipete merged 4 commits into
mainfrom
pgprep/r10-pr1a-credential-store
Oct 16, 2026
Merged

steipete merged 4 commits into
mainfrom
pgprep/r10-pr1a-credential-store

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Published SQLite driver → PR1b candidate: before PR1b, this store does not exist in production. The published driver captures the shared database with its credential tables. Automatic rollback restores that database; old versions ignore an orphaned client/credentials.sqlite.
  • Credentials issued between upgrade and rollback are lost; affected clients re-pair. PR1b must rebuild stale local contents from shared state unless a complete receipt matches the shared database identity, generation, and source hash. It must never merge an orphan back. Shared rows remain authoritative through copy and verification, and retire only under the same custody after verified publication.
  • Independent native/AppSupport sources are copy-only in PR1b and remain byte-identical. They are not retired, marked, checkpointed, or rewritten. The old native reader can use its original source after rollback; no independent-root capture inventory is needed in PR1a.
  • No published release supports PostgreSQL state. Those installations start with the engine-aware driver that includes PR1a's local-family support. The PostgreSQL recovery test exercises this driver capturing and restoring the shared PG families, a retained PG agent, and exact local credential records. Generic future-schema PostgreSQL generation fingerprints and migration-write attribution are a separate R14b prerequisite; this PR does not claim to implement them.

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], plus sqlite_stat1/sqlite_stat4 if 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.4 and 2026.10.10-beta.1 capture/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 assets mermaid.min-DhdZyIsV.js, frame.js, and native.js in both shared Mermaid resource trees; and the applyProviderAuthConfigPatch wrapper 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.

Failure Classification and evidence
ios-screenshots Runner infrastructure: “The watchOS 27.0 simulator runtime is not available.” The iPhone/iPad capture assertions passed. The one authorized retry of the original-head run 38924582019, attempt 2, passed the screenshot job and CI gate; the rebased-head runner reproduced the same missing-runtime error. No further retry was requested.
checks-node-changed-compact-small-15 Inherited: all eight failing cases in src/sessions/session-state-events.worker-control.test.ts also 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 conformance Inherited: all three failures in unchanged src/infra/database-engine/matrix-roots.postgres.test.ts also fail in scheduled main run 38940084041, job 117105697665: the pending matrix/matrix-inbound-dedupe-to-claimable-dedupe migration and the dependent zero-versus-two assertions.
openclaw/ci-gate Aggregate propagation of the three failures above.

The 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.

@clawsweeper

clawsweeper Bot commented Oct 16, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T17:58:21.950272Z 8505991 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes scripts Repository scripts commands Command implementations size: XL labels Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 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: 8505991367231a97da568cc19ce7bd967307271b
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/infra/client-credential-schema.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/infra/client-credential-store.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@steipete
steipete force-pushed the pgprep/r10-pr1a-credential-store branch from eb68a62 to 9c028be Compare October 16, 2026 14:16

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 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".

Comment on lines +375 to +376
canonicalSource?.role === "client" &&
tableExists(database, "native_exec_socket_credentials")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This 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.

  • Before: The file is treated as opaque SQLite data without credential-specific sanitization.
  • After: The backup preserves identity and cached-token records while replacing the socket token with NULL.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The approved foundation has meaningful boundary coverage, but deterministic tooling integration failures make this revision unready.
Proof confidence 🦐 gold shrimp (3/6) Ordinary contributor proof gating is exempt for this maintainer-authored PR; the supplied evidence describes synthetic TypeScript, Swift, archive, and PostgreSQL recovery exercises rather than an installed application run.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Client credentials need local storage and recovery independent of the selected Gateway database.
Reason: The maintainer-authored PR explicitly approves a preparatory stage, keeps existing production consumers intact, and supplies the recovery foundation for the later cutover.

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
Reviewed head: 9c028be7b59733ae4988e39f31b0cbb922d736c1

Before merge

  • Include the new catalog assets in trusted wrapper extraction (P1) - This eager import adds a runtime dependency to the trusted PR wrapper closure, but scripts/pr-lib/wrapper-components.txt includes neither sqlite-client-catalogs.ts nor its JSON catalog. Materialized wrappers therefore fail before provisioning or lease operations with ERR_MODULE_NOT_FOUND. Exact-head CI reproduces this in eager-import-closure.test.ts and pr-wrapper-source-closure.test.ts. Add both assets to the extraction inventory.
  • Register the credential owner's raw SQLite lifecycle operations (P2) - The new db.exec and db.prepare calls match check-kysely-guardrails.mts's production raw-SQL rule, but this owner has neither an allowlist registration nor local exceptions. Consequently lint:kysely rejects the patch, consistent with the failing architecture check. Register these schema, admission, and locking primitives with their lifecycle justification, following the existing daemon runtime-pin owner, while retaining Kysely for ordinary credential queries.

Findings

  • [P1] Include the new catalog assets in trusted wrapper extraction — src/state/postgres-schema.generated/sqlite-catalogs.ts:6
  • [P2] Register the credential owner's raw SQLite lifecycle operations — src/infra/client-credential-store.ts:121-122

Tests

  • Missing end-to-end proof: Supplied validation exercises storage and recovery harnesses; no shipped CLI or app run is shown, and no independent base-versus-head regression run was performed during this review.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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:

  • [P1] Include the new catalog assets in trusted wrapper extraction — src/state/postgres-schema.generated/sqlite-catalogs.ts:6
    This eager import adds a runtime dependency to the trusted PR wrapper closure, but scripts/pr-lib/wrapper-components.txt includes neither sqlite-client-catalogs.ts nor its JSON catalog. Materialized wrappers therefore fail before provisioning or lease operations with ERR_MODULE_NOT_FOUND. Exact-head CI reproduces this in eager-import-closure.test.ts and pr-wrapper-source-closure.test.ts. Add both assets to the extraction inventory.
    Confidence: 1
  • [P2] Register the credential owner's raw SQLite lifecycle operations — src/infra/client-credential-store.ts:121-122
    The new db.exec and db.prepare calls match check-kysely-guardrails.mts's production raw-SQL rule, but this owner has neither an allowlist registration nor local exceptions. Consequently lint:kysely rejects the patch, consistent with the failing architecture check. Register these schema, admission, and locking primitives with their lifecycle justification, following the existing daemon runtime-pin owner, while retaining Kysely for ordinary credential queries.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Native credential compatibility keeps the original intent (2aae816: Allow remote Gateway connections after unrelated local schema upgrades while preserving the exact shared credential-table contract.)
  • Local-store update capture and schema comparison keeps the original intent (b87a1ab: Keep daemon intent in an independent local store while retaining complete capture and legacy caller compatibility.)
  • Backup capture and rollback keeps the original intent (d780fdc: Capture every database before migrations and restore exact pre-migration state after failed candidates.)
  • Native private-directory helper keeps the original intent (b4a0a35: Harden native state permissions; this patch reuses the helper without changing its permission behavior.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit cd9f080 adds apps/shared/OpenClawKit/Sources/OpenClawNativeState/OpenClawNativeStateSQLite.swift:8 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cd9f080183a8; files: apps/shared/OpenClawKit/Sources/OpenClawNativeState/OpenClawNativeStateSQLite.swift)
  • Jason (Json): Raw commit 2aae816 adds apps/shared/OpenClawKit/Sources/OpenClawNativeState/OpenClawNativeStateSQLite.swift:53 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2aae816ac516; files: apps/shared/OpenClawKit/Sources/OpenClawNativeState/OpenClawNativeStateSQLite.swift)
  • Vincent Koc: Raw commit b4a0a35 adds apps/shared/OpenClawKit/Sources/OpenClawNativeState/OpenClawNativeStateSQLite.swift:510 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b4a0a358c253; files: apps/shared/OpenClawKit/Sources/OpenClawNativeState/OpenClawNativeStateSQLite.swift)

PR surface

Source +1102, Tests +743, Docs +51, Other +23. Total +1919 across 32 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 15 1118 16 +1102
Tests 12 746 3 +743
Docs 2 141 90 +51
Config 0 0 0 0
Generated 0 0 0 0
Other 3 23 0 +23
Total 32 2028 109 +1919

Labels

Label changes:

  • add P2: Useful preparatory storage work has normal-priority integration blockers without an active production credential cutover.
  • add merge-risk: 🚨 automation: The new eager catalog import breaks trusted PR wrapper bootstrap when its extraction inventory omits the imported module.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: Useful preparatory storage work has normal-priority integration blockers without an active production credential cutover.
  • merge-risk: 🚨 automation: The new eager catalog import breaks trusted PR wrapper bootstrap when its extraction inventory omits the imported module.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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.

Reviewed October 16, 2026, 10:32 AM ET / 14:32 UTC.

@steipete
steipete force-pushed the pgprep/r10-pr1a-credential-store branch from 076a955 to 8505991 Compare October 16, 2026 17:53
@steipete
steipete merged commit 4706053 into main Oct 16, 2026
158 of 163 checks passed
@steipete
steipete deleted the pgprep/r10-pr1a-credential-store branch October 16, 2026 18:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

steipete added a commit that referenced this pull request Oct 16, 2026
…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.
steipete added a commit that referenced this pull request Oct 16, 2026
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.
steipete added a commit that referenced this pull request Oct 16, 2026
* 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.
steipete added a commit that referenced this pull request Oct 16, 2026
…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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
* 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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts security-sensitive-changed size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant