Skip to content

perf(auth): read native credential and health cells together - #179261

Merged
steipete merged 2 commits into
mainfrom
dbasync/nplus1
Oct 21, 2026
Merged

steipete merged 2 commits into
mainfrom
dbasync/nplus1

Conversation

@steipete

@steipete steipete commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Native auth loads read credentials and health separately, including both native catalog refreshes in the measured workload. The auth persistence owner already has a paired reader.

User Impact

A healthy non-borrowed auth load reads both cells with one statement. Retained read callbacks still observe subsequent owner writes. Credential validation, migration refusal, malformed-state classification, and borrowed write-connection behavior remain unchanged.

Why This Change Was Made

Route paired and scalar reads through the same existing database selection logic, then use the paired reader inside the retained native readStore callback. Prepared worker rows keep their existing path. Borrowed writer handles keep lazy health loading and native SQL errors; ordinary scalar callers continue reading only their requested cell. No new cache, invalidation owner, transaction, request, schema, or generation is introduced.

The non-borrowed paired path reads health eagerly even when credentials are absent or invalid. Its existing classification preserves the returned result/refusal; a missing credential row still needs one statement. Legacy damaged-table fallback remains because older persisted agent data is a supported contract.

Evidence

Acceptance rule, set before measurement: three alternating baseline/candidate pairs with frozen SQL harness v3.1.3 (the campaign-approved successor with unchanged counting and recorded startup-sidecar retries), all active phases and warm turns included, idle/settle zero in both arms. Require healthy native auth loads to use one paired read instead of two scalar reads, with no attributed request or MAIN increase and no warm regression. Report statements/requests/MAIN medians with ranges and per-operation deltas. Loaded-host elapsed time is not a latency claim.

Shape Owner Executions/request, before → after Requests
Credential/state point reads → paired IN preparedModelCatalog.refreshAuthStore 2 → 1 projected 2 in census
Agent credential/state point reads → paired UNION ALL native auth loader 2 → 1 projected unchanged

The change is implemented and formatted on base bbfdaf4795f8f803a142a4ecdad5b95c388f1f0f. Production +61/-32 lines (net +29), tests +218/-20 (net +198), including host registration. The growth extracts the existing routing once so scalar and paired readers share it. No defensive/security check is removed.

The amended existing shared-loader test checks one SQL read and latest credentials/health through the retained callback after two owner writes. The existing legacy-agent classification case checks the healthy agent UNION path; a borrowed-handle case retains lazy loading and native state-column failures. Formatting, whitespace checks, and focused syntax lint pass. Type-aware lint stopped in SDK declaration preparation at its unchanged five-minute timeout, before checking the files; exact-head CI will supply types and type-aware lint. The permanent PostgreSQL conformance test drives the native public loader and retained callback for both config-selected PG agent and shared state: current credentials plus health after two owner writes, missing credentials, and malformed credential JSON. Its observer requires one successful auth SELECT per retained read. Each kind has its own existing fixture lifecycle so deliberate corruption cannot leak into the next case. The original implementation review was scoped-clean through P2; the second and final review found that fixture-isolation defect, which is corrected. Both reviews completed source verification. Both permanent PostgreSQL cases passed locally on the final head (shared-state 4.39 s, agent 9.81 s; test file 115.89 s including 92.23 s transform time). Final-head supplemental CI 39568968840 executed and passed both new permanent PostgreSQL cases (2/2, no skips) in PG shard 2: shared-state 917 ms, agent 1,560 ms. This satisfies the PostgreSQL review condition. All 38 typecheck leaves, five semantic lint stripes, formatting, source contracts, T1/dialect ratchets, Madge (zero cycles), and all five Knip scans (zero findings) have passed on this head. The SQLite baseline executes the new assertions and fails exactly twice: shared and agent reads each issue 2 SELECTs instead of 1; the borrowed-handle case passes. Final-head CI passes all 16 tests in the changed SQLite file (job 119118499669), including both count regressions and borrowed-handle behavior. The ordinary final-head CI run 39568929810 completed successfully. All 12 required changed-file, owner, scalar-caller, full-module mock, and PostgreSQL test files have actual passing execution on the final head or its ordinary PR merge revision. This includes persisted rows (9), store updates (20), source checks (9), credential authority (53), shared-store routing (4), read pooling (10), publication ownership (25), Doctor preservation (3), startup preparation (23), local-account secrets (1), changed SQLite loading (16), and native PostgreSQL loading (2). The frozen comparison is incomplete after the shared workload setup failure described below. The supplemental run also has non-required Swift, UI translation, and recovery/UI test failures outside this change; no claim of inherited failure or an entirely green supplemental run is made. No measured whole-workload or latency saving is claimed.

Frozen workload closeout

Merged as ac7109377409762eaa5928989dd0295a99975f74; actual parent 930ece0c5f142d92a524d7da566c8496c96b3eec, expected merge tree, main ancestry, and all five reviewed file blobs were verified.

The requested three alternating frozen pairs are unrun. The preceding auth PR's candidate encountered the unchanged 120-second synthetic-account setup timeout, then failed identically on its single unchanged replay after disk clearance and artifact verification. Both failures preceded measured turns. The serial measurement batch stopped, its processes settled, and the checkout returned clean to this merge. The harness was frozen v3.1.3, with unchanged counting and separately recorded startup-sidecar retries. No aggregate saving, latency improvement, or warm nonregression is claimed.

The catalog projection four target SELECTs across two requests → two concerns credential/health reads only, not the entire catalog operation. The committed SQLite base-red/candidate-green cases and actually executed permanent PostgreSQL cases prove 2 SELECTs → 1 per healthy native read, including current state after owner writes. The borrowed-writer lazy/error contract remains intact. The frozen end-to-end comparison remains an explicit proof gap.

@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

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

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-21T08:40:15.273124Z 7232045 PR opened
ℹ️ 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.

@github-actions

github-actions Bot commented Oct 21, 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: 39ad9cd55c41752f237b625fb154b9e613c0fa87
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/auth-profiles/sqlite.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/store.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 merged commit ac71093 into main Oct 21, 2026
305 of 313 checks passed
@steipete
steipete deleted the dbasync/nplus1 branch October 21, 2026 08:48
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 22, 2026
…w#179261)

Read native auth-profile credentials and health with the existing paired query through one read-only routing owner. Healthy retained reads use one SELECT and still observe later owner writes. Borrowed write handles retain lazy health loading and native errors; prepared rows, schema, transactions, requests, and authority checks are unchanged.

Permanent PostgreSQL conformance executes both selected-agent and shared-state cases, including fresh writes, missing credentials, and malformed JSON. Frozen whole-workload measurements follow separately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant