Repository navigation
feat(auth): publish shared and agent credential authority - #170583
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
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. |
|
|
Codex review: needs real behavior proof before merge. What this changesThis PR publishes shared and agent credential writes to the existing retained authority owner while preserving the final SQL credential guard. Example: A session pins login-discovery-fixture:owner while its provider catalog refresh is awaiting a response.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 12 items remain This maintainer-directed first slice has clear value, but a catalog-read regression, broken wrapper dependencies, and confirmed test defects block merge. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherCredential writers commit shared or agent SQLite rows and publish receipts to Gateway-held authority; canonical reads seed that authority, while Codex inference retains its existing final credential check before upstream HTTP. flowchart LR
W[Credential writers] --> D[Shared and agent SQLite]
D --> P[Commit receipts]
P --> A[Retained credential authority]
R[Canonical credential reads] --> A
R --> G[Existing final SQL guard]
G --> U[Upstream HTTP]
Technical reviewBest possible solution: Keep publication in the existing credential owner, preserve passive catalog reads and final-effect guards, and repair the introduced dependency and test failures. Do we have a high-confidence way to reproduce the issue? Current-main source confirms the retained shared/agent SQL guard, and exact-head CI independently reproduces the introduced catalog, wrapper, and test failures; no target code was executed during this review. Is this the best way to solve the issue? Reusing the existing publication owner and preserving the guard is a sound staged approach, but authority seeding must not turn passive canonical reads into denied external effects. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e18f827efce9. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete authorization bypass was found, but retained shared and agent authority needs final-effect revocation and reassignment proof. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +468, Tests +1237, Other +103. Total +1808 across 33 files. Added test files: 3. View PR surface stats
Review metrics
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 12, 2026, 11:39 PM ET / October 13, 2026, 03:39 UTC. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db7a4f62ee
ℹ️ 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".
| const writes = node.text.matchAll( | ||
| /\b(?:insert\s+(?:or\s+\w+\s+)?into|update|delete\s+from)\s+["`[]?(secret_store_entries|auth_profile_store|config_machine_state|github_(?:(?:personal_|repository_)?publication_requests|publication_session_lifecycles))\b/gi, |
There was a problem hiding this comment.
Recognize SQLite REPLACE statements in the writer guard
Extend this raw-SQL pattern to cover SQLite's REPLACE INTO and UPDATE OR <action> forms. For example, db.exec("REPLACE INTO auth_profile_store ...") currently produces no violation, allowing a new credential writer to bypass the canonical publication sink and leave retained credential authority stale after the write; the repository's own SQL mutation parser already treats these forms as writes.
AGENTS.md reference: AGENTS.md:L67-L70
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 281f6c09c7
ℹ️ 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".
| const guarded = tables.filter( | ||
| (name) => | ||
| guardedTables.has(name) && | ||
| (name !== "config_machine_state" || mayWriteAuthMachineState(node, checker)), |
There was a problem hiding this comment.
Guard Kysely replaceInto credential writes
Extend the Kysely sink detection to recognize replaceInto. A future db.replaceInto("auth_profile_store") or auth-key config_machine_state write never reaches this new guarded-table filter because the earlier call-name check only accepts insertInto, updateTable, and deleteFrom; the writer therefore passes the ratchet while bypassing the canonical credential-publication sink and can leave retained credential authority stale.
AGENTS.md reference: AGENTS.md:L70-L71
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed1123f892
ℹ️ 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".
| while (ts.isPropertyAccessExpression(query.parent) && ts.isCallExpression(query.parent.parent)) { | ||
| const call = query.parent.parent; | ||
| const method = query.parent.name.text; | ||
| if (method === "values" || method === "set") { |
There was a problem hiding this comment.
Inspect conflict updates for credential-key writes
When a Kysely upsert inserts a non-auth key but its conflict handler calls doUpdateSet({ state_key: "authProfiles.store", value_json: ... }), this ancestor-only scan marks selected false from values() and never visits the nested conflict callback, so the new writer passes the ratchet despite modifying the credential row without publishing authority facts. Inspect onConflict/doUpdateSet assignments before excluding this sink.
AGENTS.md reference: AGENTS.md:L70-L71
Useful? React with 👍 / 👎.
|
Reviewed the three writer-ratchet suggestions. They concern syntax a future writer could introduce: raw SQLite |
…70583) Extend the existing credential authority to shared and agent stores. Deny credential writes before commit and publish committed facts before release across native saves, worker updates, catalog tasks, secrets rollback, and offline maintenance. Preserve the final SQL guard while SDK custody and the reader cutover land separately. Unknown write outcomes remain denied until owner restart; metadata-only changes do not revoke credentials. Boundary tests, two Codex review rounds, PR CI, and the published-driver update cell cover the change.
…pins (#172374) Reuse writer-published credential authority for personal OAuth acceptance and remove duplicate account reads, repeated validation, and the personal-accept worker transaction. Prepare provider metadata asynchronously at six native session model-selection callers. Keep live credential checks at physical I/O and retain released synchronous SDK compatibility. Regression coverage verifies fresh credentials and model pins after in-process writes. No schema, configuration, or public SDK changes. Release-note context: personal-account authentication avoids redundant database work and session model selection avoids synchronous fallback reads. Follow-up to #171726, #170583, and #170656.
…pins (openclaw#172374) Reuse writer-published credential authority for personal OAuth acceptance and remove duplicate account reads, repeated validation, and the personal-accept worker transaction. Prepare provider metadata asynchronously at six native session model-selection callers. Keep live credential checks at physical I/O and retain released synchronous SDK compatibility. Regression coverage verifies fresh credentials and model pins after in-process writes. No schema, configuration, or public SDK changes. Release-note context: personal-account authentication avoids redundant database work and session model selection avoids synchronous fallback reads. Follow-up to openclaw#171726, openclaw#170583, and openclaw#170656.
What Problem This Solves
Shared and agent credentials still require a native final read before Codex sends a bearer-authenticated request. The existing personal credential authority cannot yet replace that read because several native and worker writers do not publish their committed facts to the Gateway.
This first slice extends that same authority to shared and agent stores and publishes non-SDK writes. It keeps the final SQL guard until the synchronous SDK custody and generic-key coverage land, followed by the reader cutover.
Design and writer coverage
Credential writes deny authority synchronously before the native effect. Managed transactions install committed postimages before releasing denial; known rollback preserves the old facts, and an unknown outcome remains denied until the owner restarts. Async updates reuse their existing commit grant and receipt transport. Catalog tasks deny the root before dispatch and return committed facts even when the catalog result fails. No new SQL, worker request, or admission handshake is introduced.
The owner uses admitted database identities. A credential write that first creates an agent database also publishes to authority captured while that path was absent. Metadata-only writes do not revoke credentials. Cold loading uses the existing worker and cannot overwrite a newer committed postimage.
CI repair also separates native JSON writes from read-only imports, preserving the existing lightweight wrapper/worker closure. Preparation may run during pending publication, but the final effect reader still denies authority until settlement.
The writer ratchet rejects new direct/raw credential-table sinks, including dynamic machine-state keys that may select the credential row. Synthetic bypass tests cover direct SQL, aliases, key changes, and extra sinks.
Checks and accepted edges
No final security check is removed in this slice. Fingerprint, selected-profile, pending-refresh, fetch, and response-disclosure guards remain unchanged. A catalog task temporarily denies credentials even when it ultimately makes no credential change; a confirmed result releases that denial. An unknown task outcome stays denied until restart. An external request already started before denial may finish; a new effect cannot start while authority is denied.
T1 and SQL
Static T1 may remain after the final guard cutover because the released synchronous SDK reader reaches the same primitives. That compatibility reachability is separate from the intended SQL-free Codex guard.
SQL measurement and attribution
One completed base/candidate pair uses shared harness 2.1.0: base
592b7e4aea9386e05912e6df2d3ba5493e629aaa, candidate1d72cc6e48450f594fdb65d54ea49f40fdecf699. Both completed all 13 top-level turns, the native child, RPCs, cron, compaction, and shutdown. Warmed figures are means over ten turns per run, not repeated-run medians. The interrupted repeat has no completed candidate and is excluded. These are the measured revisions; this table does not claim a later integrated head was remeasured.The individual warmed-turn median is 170 statements / 41 requests in both runs. Individual ranges are base 162–173 / 39–44 and candidate 170–192 / 41–46; these are not repeated-run ranges. The 32-CPU host was loaded (base load 68.9→135.0, candidate 80.8→75.4). No latency claim is made. Foreground cache misses and recap work remain counted; lower whole-workload totals do not erase the warmed increase.
Every listed family has zero warmed MAIN SQL. Direct SQL is identified by its native owner stack; matching requests are distinct logical request IDs carrying those statements or naming that owner. Requests may contain multiple families, so these diagnostic rows must not be summed. Entry-cache snapshots specifically mean
loadSessionEntrySnapshot; an inline projection is not a whole-cache load. Generic machine-state SQL is not classified as auth from its shape alone.The complete warmed difference is +33 statements / +4 requests across ten turns. Entry-patch preparation and effect requests contribute +16 / +4; one bounded transcript hydration contributes +12 / +1; activity-summary source contributes +6 / +1; retained exact-entry lookup contributes +1 / +1. These are offset by ordered exact-entry lookup -1 / -1, auth row lookup -1 / -1, and actor requests 0 / -1. This accounting preserves every foreground execution.
Provider traces show 16 ordinary inference calls and two compaction calls on each revision. Activity recap calls differ, 12→15, while both consume the same 26 note strings in the same order (SHA-256
d18a428e96b4290e4d8889e9b3169848c6504f86d9f40703f54d0aed98c4d52e). The base's first recap batches seven notes; the candidate begins with one-note batches. The unchanged recap owner commitsactivitySummarythrough an entry patch with a transcript predicate. Whole-workload entry-patch preparation/effect counts rise 53→56 / 71→74, matching the three extra recaps. Native predicate stacks independently identify recap-guard watermark and projection SQL rising 12→15 overall, including 8→10 in warmed causal work. Thus recap batching accounts for both extra warmed watermarks and two of the three extra warmed projections; it does not establish why scheduling differed between revisions.The remaining warmed projection is one extra bounded transcript hydration at
session-transcript-hydration.ts:412, after no usable retained context is found. Its request carries 12 statements. The trace does not record the cache-miss reason. In candidate turn 02, the two hydration requests were sent at +6,520ms and +7,639ms; the recap commit was sent later, at +13,049ms. That later recap cannot explain the preceding hydration miss. Whole-workload watermark reads rise 15→21: recap guards +3, background row-facts reads +2, and a background anchor read +1. Whole-workload projections rise 44→47: recap guards +3, bounded hydration +1, and activity-summary source fallback -1. Background reads stay included in whole-workload totals.Whole-workload auth is 54→55 statements / 29→30 requests. The only added auth statement is the existing union-row helper, 23→24 reads: first turn +1, warmed turns -1, second session +1, other causal phases unchanged. New authority observation consumes rows already returned by that helper and adds no persistence request. Its trace ends at the generic worker boundary, so the higher-level caller and cache-miss cause of the extra read are unproved. The measured source revisions leave auth persisted-row caching, auth write-token policy, session hydration/cache modules, and writer-queue arbitration unchanged. In-memory authority processing can still affect scheduling. This pair therefore supports operation-level attribution, but does not prove strict per-operation no-growth or a warmed-turn saving.
The shared mock-provider workload does not exercise the Codex bearer-authenticated final guard. Its SQL-free security boundary must be established by the dedicated boundary test and baseline guard probe, not inferred from this whole-workload pair.
Evidence
Validation
Exact annotation-head PR CI is complete and successful: 55 jobs passed, 26 skipped, none failed or cancelled, including
openclaw/ci-gate. The raw PR head is86b94e00719d292e335761e697d441cb99172c9a; CI checked out GitHub merge703a2998into main74c7b3d72589755d14ba630b85e049d671e81a48. All selected test and static jobs passed. The published-driver update job was skipped in this PR workflow and is tracked separately below.All 22 changed test files (278 tests) passed for PR head
281f6c09c722, with all 21 selected compact/boundary changed-test jobs successful. Every supporting test job checked out GitHub merge4238a37e(281f6c09c722into mainc6ee92366b56).86b94e00719dchanges only an existing mock-isolation comment. Its complete baseline-ratchet lane now passes, including the marker that failed previously, the T1 no-growth check, and the dialect ratchet. All selected static jobs now pass for the annotation head, including production types, all core/extension lint, architecture, and every test-type stripe. The current core-4 log records GitHub merge703a2998(86b94e00719dinto main74c7b3d72589) and every TypeScript leaf exits zero.Passed static checks at
281f6c09c722: production types; core and extension lint; source contracts; extension/package boundaries; all test-type stripes except the inherited core-4 error below; Madge (zero cycles); Kysely guardrails; T1 no growth; and dialect mechanical0→0, design0→0, engine maintenance2→2. The comment-only head preserves the tested production code.The credential authority suite covers deny-before-commit and publish-before-observer for shared and agent stores, cold parity, metadata-only writes, deletion/restoration, and unknown outcomes staying denied. Catalog tests cover committed credentials on failed tasks, publication before error release, mismatched worker results, and unknown outcomes. Publication tests cover nested rollback, cross-domain commit publication, stale receipts, and publisher failures. The writer custody guard’s 41 tests passed, including synthetic bypass cases. Every changed test/mock file has completed proof; none is waiting on the long E2E job.
Every changed test file, result, and CI timing
“Test sum” totals printed individual test durations. “Shard wall” is the enclosing Vitest shard, which may contain other files; neither column claims a dedicated per-file run wall time.
src/agents/auth-profiles.sqlite-read-pool.test.tssrc/agents/auth-profiles/credential-authority.test.tssrc/agents/auth-profiles/external-auth.test.tssrc/agents/auth-profiles/oauth-manager.test.tssrc/agents/auth-profiles/oauth.peer-settlement.test.tssrc/agents/auth-profiles/shared-store-bootstrap.async.test.tssrc/agents/auth-profiles/source-check.async.test.tssrc/agents/auth-profiles/store-update.test.tssrc/agents/auth-profiles/store.async-read.test.tssrc/agents/auth-profiles/upsert-with-lock.sqlite.test.tssrc/agents/embedded-agent-runner/model.auth-read-race.test.tssrc/agents/embedded-agent-runner/run/auth-profile-shared-usage.worker.test.tssrc/agents/plugin-model-catalog-auth.test.tssrc/agents/prepared-model-catalog-worker.authority.test.tssrc/agents/prepared-model-catalog-worker.directory.test.tssrc/agents/prepared-model-catalog-worker.oauth-peers.integration.test.tssrc/agents/prepared-model-catalog-worker.secrets.test.tssrc/commands/doctor-auth-flat-profiles.test.tssrc/infra/state-migrations.shared-auth-store.lifecycle.test.tssrc/secrets/apply.test.tssrc/state/state-domain-publication.test.tstest/scripts/personal-credential-writer-guard.test.tsThe annotation-head long E2E job also completed successfully: 19 tests across six suites, with a total job wall time of 691 seconds. Suite wall times were Doctor auth-profile consumers 156.63s (3 tests), inference authority 10.21s (1), native approval receipt 49.86s (1), quota reset 223.24s (9), isolated quota reset 35.78s (2), and OAuth refresh authority chain 66.32s (3). These are suite durations, not individual-test sums.
Two inherited-from-base static findings were observed at
281f6c09c722:config-preflight-snapshot.test.ts:41imports unexportedreadConfigPreflightSnapshot(TS2724). Implementation and test have identical Git blobs on integrated main17929e42d182dand the candidate.ui/src/components/board/board-widget-cell-render.ts: renderBoardWidgetError. The UI tree and Knip configurations are identical to integrated main17929e42d182d; that symbol has only its declaration. Production/full-tree unused-file scans and the script export scan passed with zero entries.These are source-identical findings, not matching-main-CI execution claims, and neither failing check is represented as green. Current main
633acc213dae4has since repaired both: the test no longer references the private function, and the unused Board file/symbol is gone. Annotation-head PR CI already incorporates a newer main merge and passes core-4. The full dispatch’s pinned281f6c09c722Knip failure remains historical evidence; Knip was not selected by the annotation-head PR workflow, so no green Knip result is claimed.The published-driver × candidate update cell passed on production head
281f6c09c722a42094db6951b125078faf7bf589, including the real update to the candidate package. The later annotation head changes only a comment. Current-main integration is complete ated1123f89241df9212a7fc3e4dcafe5eea0e6685, with parent maine65c0bd16568f168257e2000276aa1b5f07e44c8, and had no conflicts. It includes both static fixes. The earlier candidate Knip scan is reused under the inherited-static exception: its only finding was the identical main-owned UI export, now deleted by main; the intervening lane change is a test annotation. This is not a claim of a fresh-head green Knip run. Per compute conservation, no duplicate local scan or broad dispatch is run for that repaired inherited finding. Integration-head PR CI completed successfully ated1123f89241df9212a7fc3e4dcafe5eea0e6685: 55 jobs passed, 26 skipped, none failed or cancelled, including the final selected E2E job, all selected static/type/lint/ratchet lanes, andopenclaw/ci-gate. Security-sensitive review, dependency review, and Opengrep also passed on this head.Independent Codex review: two P0/P1 rounds, both scoped clean; the second covers the CI repairs. One SQL harness pair is recorded above. An extra baseline was interrupted under the compute-conservation rule; no second comparison is claimed. No latency claim is made on the loaded host.
LOC against integrated main: 43 files, production/ratchet +920/−343; tests and test helpers +1264/−12. No schema or public SDK signature changes.