Repository navigation
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: blocked before merge. Reviewed October 6, 2026, 9:19 AM ET / 13:19 UTC (Revision 11). ClawSweeper reviewWhat this changesThe PR adds explicit shared-store ownership to credential migration plans, routes writes to that store, and introduces revision-2 plans that older CLIs reject. Merge readiness⛔ Blocked before merge - 3 items remain Keep open: the shared-store migration remains necessary, and both retained findings are resolved. An explicit maintainer hold still covers the proposed shared-write contract; approval of the earlier warning-only change did not authorize it. Priority: P1 Review scores
Verification
How this fits togetherThe secrets CLI converts stored credentials into references to secret providers. Configure discovers credential candidates, and apply validates a saved plan before updating the selected auth store and reporting changes. flowchart TD
A[Agent and shared credentials] --> B[Configure candidate discovery]
B --> C[Operator selects credential]
C --> D[Plan with explicit store owner]
D --> E[Validate protocol and targets]
E --> F[Update selected auth store]
F --> G[Audit remaining plaintext]
Decision needed
Why: A verified maintainer expressly withheld approval for shared-target and protocol changes; technical correctness cannot lift that hold. Before merge
Agent review detailsSecurityNone. PR surfaceSource +191, Tests +716, Docs +12, Other -1. Total +918 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Adopt an explicitly approved shared-migration contract that preserves saved agent-local plan intent and safely rejects shared plans on older readers. Do we have a high-confidence way to reproduce the issue? Yes: current-main source deterministically routes auth-profile plans to the agent store, and the supplied real CLI comparison demonstrates shared plaintext remaining unchanged before the fix. This read-only review did not execute the CLI. Is this the best way to solve the issue? Yes, technically: explicit ownership preserves legacy plan intent and avoids inferred routing, while revision 2 prevents silent misuse by old readers. Product acceptance remains governed by the recorded maintainer hold. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 08af7f8a1424. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review The PR body now carries the requested real |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
249dd45 to
372c722
Compare
|
@clawsweeper re-review - revision 372c72240ef: shared plans now emit protocol revision 2 so released readers reject them (agent-local stays 1), owner discriminator added to picker keys, raw residue cleanup detection fixed, branch rebased onto main. Owner re-ran the scoped suites (70 passed). |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
819fb6d to
71d9cf6
Compare
|
Rebased and rebuilt onto Old CI on the rebuilt head: run 37461166346 finished with exactly one failing lane — Diff-scoped local checks on the new head: secrets suites |
71d9cf6 to
590c6fe
Compare
|
Pushed P2 — real warning logger in the output regression ( P3 — CLI guide for shared targets and revision-2 plans ( Local: The P1 revision-2 contract acceptance and the repository security approval remain open maintainer decisions. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Status update so this doesn't go stale: the branch was rebuilt onto |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Still reproduces on current @vincentkoc, on #133843 you ruled out inferring shared ownership from a v1 |
What Problem This Solves
Fixes #143262 (P1,
impact:security).secrets apply— and the configure planner that feeds it — resolved every auth-profile SecretRef target to theper-agent auth-profile database and ignored
auth.sharedStore. With a shared store configured, writing a credential for a shared auth profile silentlylanded the SecretRef in the agent-scoped DB: the command reported success while the shared store the rest of the runtime reads from stayed empty, which
surfaces later as auth-provider failures that look like a missing credential.
The planner now carries an explicit store owner for every auth-profile candidate —
authProfileStore: "shared"for shared-store targets, absent for thelegacy agent database — candidate ordering and labels derive from that owner, and apply routes each SecretRef to the store the target was discovered from
instead of defaulting to the agent DB.
Evidence
src/secrets/plan.ts,src/secrets/configure-plan.ts— candidates carry the discovered store owner; ordering and labels include it.src/secrets/apply.ts— apply routes by that owner; a shared-store target is written to the shared DB and an agent target still goes to the agent DB.--maxWorkers=1 --no-file-parallelism, at head33fff93ea86rebased onmain3943149f8ac):src/secrets/apply.test.ts src/secrets/configure-plan.test.ts src/secrets/configure.test.ts src/secrets/plan.test.ts src/secrets/configure.output.test.ts→
Tests 63 passed | 3 failed (66)src/secrets/apply.test.tsalone on a second run →Tests 38 passed | 2 failed (40)EBUSY: resource busy or locked, unlink …openclaw.sqlite/ENOTEMPTY: rmdir), with zeroassertion failures, and the failing set differs between runs. Both affected tests exist on
mainand are not part of this change.Closes #143262
PR #144065 — real CLI evidence:
configure → apply → auditcleans the selected shared row and leaves agent-local credentials aloneopenclaw/openclaw, worktreeD:/code/wt-oc-143262, branchfix/oc-143262-descr.249dd45e2692(PR change itself =33fff93ea86"fix(secrets): route explicit shared auth-profile targets to the shared state database").OPENCLAW_HOME/OPENCLAW_STATE_DIRpoint at%LOCALAPPDATA%/Temp/ocproof-144065/{home,state}. The real user profile is never touched.git push, no PR edit, no repo file added. Worktree restored and left clean:git status --porcelain→ empty (verified after both legs).Claim under test (ClawSweeper): "does not show this branch's real configure → apply → audit flow cleaning the selected shared row while preserving agent-local credentials."
1. What is real, what is synthetic
Real:
node --import file:///D:/code/wt-oc-143262/scripts/tsx.mjs D:/code/wt-oc-143262/src/entry.ts secrets …(same entry as
dist/entry.js; bannerOpenClaw 2026.9.3 (249dd45)).secrets configureruns interactively under a real PTY (winpty), so the real@clack/promptsoption list, the realSecret source/Provider alias/Secret id/Configure another credential?prompts and the real preflight all execute. Keystrokes sent:j(down),Enter,n.secrets apply --fromandsecrets auditare plain non-interactive CLI runs.node:sqlite.configure(--plan-out) and consumed byapply.Synthetic (fixture only):
%LOCALAPPDATA%/Temp/ocproof-144065/seed-fixture.ts(scratch, not in the repo) using the repo's own writers:writePersistedAuthProfileStoreRaw(shared row + agent row) andwriteConfigMachineState("auth.sharedStore", {location:"state-db"})— the exact key/value the shippedshared-auth-store-state-dbdoctor migration commits (src/infra/state-migrations.shared-auth-store.ts).…-PLAINTEXT-144065), not real secrets. No provider, gateway or network call is exercised; the SecretRef target is the built-inenvprovider.--skip-provider-setup(env/store providers are built in, so no provider config is needed) and--json(suppresses the interactive "apply this plan now?" confirm so thatapplyis a separate, observable CLI step).CODEX_API_KEYas the suggested env id is the CLI's own suggestion for thisopenaiprofile.2. Fixture (re-seeded fresh for each leg)
state/state/openclaw.sqlite,authProfiles.store)openai:sharedOPENAI-SHARED-SELECTED-PLAINTEXT-144065← selected for migrationgoogle:untouchedGOOGLE-SHARED-UNTOUCHED-PLAINTEXT-144065← not selectedstate/agents/main/agent/openclaw-agent.sqlite,auth_profile_store)anthropic:localANTHROPIC-AGENT-LOCAL-PLAINTEXT-144065← must survive3. Rerunnable steps
The three CLI commands under test (after leg):
4. AFTER (branch HEAD
249dd45e2692)Interactive
configure— real rendered option list (raw transcript excerpt):Plan written by the CLI (
plan-after.json, target only), preflight included in the same output:{ "type": "auth-profiles.api_key.key", "path": "profiles.openai:shared.key", "pathSegments": ["profiles","openai:shared","key"], "ref": { "source": "env", "provider": "default", "id": "CODEX_API_KEY" }, "agentId": "main", "authProfileStore": "shared", "authProfileProvider": "openai" } … "preflight": { "mode": "dry-run", "changed": true, "changedFiles": ["…\\ocproof-144065\\state\\state\\openclaw.sqlite"], "checks": { "resolvability": true, "resolvabilityComplete": true } }secrets apply --from plan-after.json --json:{ "mode": "write", "changed": true, "changedFiles": ["C:\\Users\\Administrator\\AppData\\Local\\Temp\\ocproof-144065\\state\\state\\openclaw.sqlite"], "checks": { "resolvability": true, "resolvabilityComplete": true }, "refsChecked": 1 }→ writes the canonical shared state DB, not the agent DB. (Human-mode run renders
Secrets applied. Updated 1 file(s).; seelogs/run1-human-after/4-apply.txt.)secrets auditbefore → after:Row-level dump after (verbatim from
logs/after/6-after-dump.txt):5. BEFORE (same four PR source files at
33fff93ea86~1)git checkout 33fff93ea86~1 -- src/secrets/{apply,configure,configure-plan,plan}.ts, same fixture, same CLI:configurecandidate list — the shared rows are not offered at all:No plan can be generated for the shared row, so the pre-fix leg is applied the plan the branch's own configure produced (same operator intent):
secrets apply --from plan-after.json --json:{ "mode": "write", "changed": true, "changedFiles": ["C:\\Users\\Administrator\\AppData\\Local\\Temp\\ocproof-144065\\state\\agents\\main\\agent\\openclaw-agent.sqlite"], "checks": { "resolvability": true, "resolvabilityComplete": true }, "refsChecked": 1 }→ the SecretRef is written to the agent-scoped database while the command reports success.
secrets auditafter apply:plaintext=3— unchanged; the sharedopenai:sharedplaintext is still reported.Row-level dump after (verbatim from
logs/before/6-after-dump.txt):6. Two-sided difference
33fff93ea86~1)249dd45e2692)configuregoogle:untouched,openai:shared(label… (auth profile, shared store))profiles.openai:shared.key,authProfileStore: "shared"apply --jsonchangedFilesstate\agents\main\agent\openclaw-agent.sqlitestate\state\openclaw.sqlitekeykeyRef {env/default/CODEX_API_KEY}, nokeysecrets auditplaintext countRaw evidence (both legs, unedited):
%LOCALAPPDATA%/Temp/ocproof-144065/logs/after/and…/logs/before/(
0-seed,1-before-dump,2-before-audit,3-configure.txt+3-configure-transcript.txt,3b-plan.json,4-apply.txt,5-after-audit.txt/.json,6-after-dump.txt). Human-mode apply/audit runs from the firstpass are kept in
logs/run1-human-{after,before}/.7. Conclusion
The branch's own
configure → apply → auditflow routes the selected shared auth-profile SecretRef into the canonical shared state DB (shared row cleaned, audit finding disappears), leaves the unselected shared row and the agent-local credential row byte-identical, whereas the pre-fix sources cannot select the shared row at all and instead write the ref into the agent-scoped DB while leaving the shared row plaintext.Re-ran by the author
Both legs re-run by hand on this branch (
249dd45e2692), isolated scratch home, real CLI PTY:Revision
372c72240ef- findings addressed + rebased onto current mainprotocolVersion: 2; agent-local plans stay at revision 1. The validator accepts1|2and enforces shared target <=> revision 2, so a released v2026.9.4 reader (revision 1 only, ignoresauthProfileStore) rejects a copied shared plan instead of silently applying it to the agent database. New tests emulate the released validator (accepts agent-local, rejects shared).auth-profiles:agent:<agentId>:<path>vsauth-profiles:shared:<path>, built by a single exported key builder used for picker values, the selection map and sort order. New tests: an agent namedsharedwith the same profile id in both stores keeps 2 distinct keys/targets, and selecting the shared row resolves to the shared store.readPersistedAuthStoreRaw()inspects the persisted row before change detection, so selecting a profile and keeping its unchanged ref still cleans the raw plaintext (keynext to identicalkeyRef->changed=true). Same-reference regression added.03c70bad04e(pre-rebase tip preserved asbackup-oc-143262-descr); conflicts were fixture-level inconfigure.test.ts/configure.output.test.ts(main moved fixtures tocreateAuthProfileStoreFixture).Red -> green (owner re-run): per-finding source reverts each reproduced red (residue:
changed=false; picker: duplicate keys resolving to the agent candidate; revision: shared rejected); after -> scoped suites 70 passed / 2 failed, the 2 being Windows temp-dirEBUSYteardown flakes with no assertion involved (identical at the rebase tip). Full secrets shard delta vs rebase tip: +2 flaky teardown failures, zero new assertion failures.tsgoclean (core + services/config-cli/other shards),oxfmt --checkclean,oxlintclean.