Skip to content

fix(secrets): route auth-profile SecretRefs to the store they were discovered in, not always the agent DB - #144065

Open
Finn763 wants to merge 2 commits into
openclaw:mainfrom
Finn763:fix/oc-143262-descr
Open

Finn763 wants to merge 2 commits into
openclaw:mainfrom
Finn763:fix/oc-143262-descr

Conversation

@Finn763

@Finn763 Finn763 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

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 the
per-agent auth-profile database and ignored auth.sharedStore. With a shared store configured, writing a credential for a shared auth profile silently
landed 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 the
legacy 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.
  • Suites (--maxWorkers=1 --no-file-parallelism, at head 33fff93ea86 rebased on main 3943149f8ac):
    • 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.ts alone on a second run → Tests 38 passed | 2 failed (40)
    • Every failure is a Windows temp-directory teardown lock (EBUSY: resource busy or locked, unlink …openclaw.sqlite / ENOTEMPTY: rmdir), with zero
      assertion failures, and the failing set differs between runs. Both affected tests exist on main and are not part of this change.
  • Surface: 9 files, +501/−75; no new dependencies.

Closes #143262


PR #144065 — real CLI evidence: configure → apply → audit cleans the selected shared row and leaves agent-local credentials alone

  • Repo: openclaw/openclaw, worktree D:/code/wt-oc-143262, branch fix/oc-143262-descr.
  • HEAD under test: 249dd45e2692 (PR change itself = 33fff93ea86 "fix(secrets): route explicit shared auth-profile targets to the shared state database").
  • Isolation: OPENCLAW_HOME / OPENCLAW_STATE_DIR point at %LOCALAPPDATA%/Temp/ocproof-144065/{home,state}. The real user profile is never touched.
  • Discipline: no 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:

  • The CLI is the repo's own entrypoint, not a test harness:
    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; banner OpenClaw 2026.9.3 (249dd45)).
  • secrets configure runs interactively under a real PTY (winpty), so the real @clack/prompts option list, the real Secret source / Provider alias / Secret id / Configure another credential? prompts and the real preflight all execute. Keystrokes sent: j (down), Enter, n.
  • secrets apply --from and secrets audit are plain non-interactive CLI runs.
  • Both auth stores are real SQLite databases with real rows; the row-level dumps are read straight out of the DB files with node:sqlite.
  • The plan JSON is produced by the CLI's own configure (--plan-out) and consumed by apply.

Synthetic (fixture only):

  • The initial state is seeded by %LOCALAPPDATA%/Temp/ocproof-144065/seed-fixture.ts (scratch, not in the repo) using the repo's own writers: writePersistedAuthProfileStoreRaw (shared row + agent row) and writeConfigMachineState("auth.sharedStore", {location:"state-db"}) — the exact key/value the shipped shared-auth-store-state-db doctor migration commits (src/infra/state-migrations.shared-auth-store.ts).
  • Credential values are marker strings (…-PLAINTEXT-144065), not real secrets. No provider, gateway or network call is exercised; the SecretRef target is the built-in env provider.
  • Flags used, and why: --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 that apply is a separate, observable CLI step). CODEX_API_KEY as the suggested env id is the CLI's own suggestion for this openai profile.

2. Fixture (re-seeded fresh for each leg)

store row value before
shared (canonical state DB state/state/openclaw.sqlite, authProfiles.store) openai:shared plaintext OPENAI-SHARED-SELECTED-PLAINTEXT-144065 ← selected for migration
shared (same row) google:untouched plaintext GOOGLE-SHARED-UNTOUCHED-PLAINTEXT-144065 ← not selected
agent-local (state/agents/main/agent/openclaw-agent.sqlite, auth_profile_store) anthropic:local plaintext ANTHROPIC-AGENT-LOCAL-PLAINTEXT-144065 ← must survive

3. Rerunnable steps

%LOCALAPPDATA%/Temp/ocproof-144065/
  seed-fixture.ts      # writes the fixture above (repo writers, real SQLite)
  dump-dbs.ts          # row-level dump of both databases (node:sqlite, read-only)
  run-configure.py     # PTY driver: real `openclaw secrets configure` prompt flow
  flow.sh after        # reset+seed → audit → configure → apply → audit → dump
  flow.sh before       # same, with configure limited to the candidate list
  flow-before.sh       # git checkout 33fff93ea86~1 -- <4 PR files>; flow.sh before; restore
  logs/{after,before}/ # full transcripts and outputs (see §6)

The three CLI commands under test (after leg):

node --import "file:///D:/code/wt-oc-143262/scripts/tsx.mjs" D:/code/wt-oc-143262/src/entry.ts \
  secrets configure --skip-provider-setup --json --plan-out <scratch>/plan-after.json
node --import … src/entry.ts secrets apply --from <scratch>/plan-after.json --json
node --import … src/entry.ts secrets audit

4. AFTER (branch HEAD 249dd45e2692)

Interactive configure — real rendered option list (raw transcript excerpt):

!  Shared auth-profile store has 2 plaintext credential(s). Select a shared-store candidate below
   to migrate it with an explicit shared owner. Run `openclaw secrets audit` to review them.
*  Select credential field
|  > profiles.anthropic:local.key (auth profile, agent main) (auth profile store)
|    profiles.anthropic:local.token (auth profile, agent main)
|    profiles.google:untouched.key (auth profile, shared store)
|    profiles.google:untouched.token (auth profile, shared store)
|    profiles.openai:shared.key (auth profile, shared store)
|    profiles.openai:shared.token (auth profile, shared store)
|    Create auth profile mapping
*  Secret source / * Provider alias (default) / * Secret id (CODEX_API_KEY)
*  Configure another credential?   →  No

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).; see logs/run1-human-after/4-apply.txt.)

secrets audit before → after:

before: plaintext=3 … state\state\openclaw.sqlite:profiles.openai:shared.key   PLAINTEXT_FOUND
        plaintext=3 … state\state\openclaw.sqlite:profiles.google:untouched.key PLAINTEXT_FOUND
        plaintext=3 … state\agents\main\agent\openclaw-agent.sqlite:profiles.anthropic:local.key PLAINTEXT_FOUND
after : plaintext=2 … (the openai:shared finding is gone; the other two remain by design)

Row-level dump after (verbatim from logs/after/6-after-dump.txt):

canonical state DB  openai:shared     = {type: api_key, provider: openai,
                                         keyRef: {source: env, provider: default, id: CODEX_API_KEY}}   ← plaintext `key` cleaned
                    google:untouched  = {type: api_key, provider: google, key: GOOGLE-SHARED-UNTOUCHED-PLAINTEXT-144065}  ← untouched
agent-local DB      anthropic:local   = {type: api_key, provider: anthropic, key: ANTHROPIC-AGENT-LOCAL-PLAINTEXT-144065} ← byte-identical

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:

configure candidate list — the shared rows are not offered at all:

!  Shared auth-profile store has 2 plaintext credential(s). `secrets configure` edits the selected
   agent's local store only and cannot migrate shared credentials. Run `openclaw secrets audit` …;
   a shared-store SecretRef migration path is tracked separately.
*  Select credential field
|  > profiles.anthropic:local.key (auth profile, agent main) (auth profile store)
|    profiles.anthropic:local.token (auth profile, agent main)
|    Create auth profile mapping

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 audit after apply: plaintext=3 — unchanged; the shared openai:shared plaintext is still reported.

Row-level dump after (verbatim from logs/before/6-after-dump.txt):

canonical state DB  openai:shared     = {type: api_key, provider: openai, key: OPENAI-SHARED-SELECTED-PLAINTEXT-144065} ← NOT cleaned
agent-local DB      anthropic:local   = {…key: ANTHROPIC-AGENT-LOCAL-PLAINTEXT-144065}                                ← preserved, but…
                    openai:shared     = {type: api_key, provider: openai, keyRef: {env/default/CODEX_API_KEY}}       ← new agent-scoped row written

6. Two-sided difference

observation BEFORE (33fff93ea86~1) AFTER (HEAD 249dd45e2692)
shared-store rows offered by configure none google:untouched, openai:shared (label … (auth profile, shared store))
plan for the shared row impossible to select profiles.openai:shared.key, authProfileStore: "shared"
apply --json changedFiles state\agents\main\agent\openclaw-agent.sqlite state\state\openclaw.sqlite
selected shared row after flow still plaintext key keyRef {env/default/CODEX_API_KEY}, no key
agent-local DB after flow 2 rows (original + wrongly added shared ref) 1 row, byte-identical to the fixture
secrets audit plaintext count 3 → 3 3 → 2

Raw 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 first
pass are kept in logs/run1-human-{after,before}/.

7. Conclusion

The branch's own configure → apply → audit flow 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:

$ bash flow.sh after
plan:   profiles.openai:shared.key (auth profile, shared store)   -> apply: changedFiles = state/state/openclaw.sqlite
shared DB   : openai:shared -> keyRef{source:env,id:CODEX_API_KEY}   (plaintext cleared)   google:untouched unchanged
agent-local : anthropic:local unchanged (byte-identical)
audit plaintext 3 -> 2

$ bash flow-before.sh          # four PR source files at 33fff93ea86~1, restored on exit
configure: no shared candidate ("cannot migrate shared credentials")
apply    : plan written into state/agents/main/agent/openclaw-agent.sqlite -> an extra openai:shared row pollutes the
           agent-local store; the shared row keeps its plaintext key; audit stays 3
git status --porcelain after restore: (clean)

Revision 372c72240ef - findings addressed + rebased onto current main

  • P1 shared plans are now rejectable by older readers. Shared targets emit protocolVersion: 2; agent-local plans stay at revision 1. The validator accepts 1|2 and enforces shared target <=> revision 2, so a released v2026.9.4 reader (revision 1 only, ignores authProfileStore) 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).
  • P2 owner discriminator. Candidate keys are now auth-profiles:agent:<agentId>:<path> vs auth-profiles:shared:<path>, built by a single exported key builder used for picker values, the selection map and sort order. New tests: an agent named shared with the same profile id in both stores keeps 2 distinct keys/targets, and selecting the shared row resolves to the shared store.
  • P2 raw residue cleanup. readPersistedAuthStoreRaw() inspects the persisted row before change detection, so selecting a profile and keeping its unchanged ref still cleans the raw plaintext (key next to identical keyRef -> changed=true). Same-reference regression added.
  • Merge conflicts resolved. Branch rebased onto current main 03c70bad04e (pre-rebase tip preserved as backup-oc-143262-descr); conflicts were fixture-level in configure.test.ts / configure.output.test.ts (main moved fixtures to createAuthProfileStoreFixture).

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-dir EBUSY teardown 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. tsgo clean (core + services/config-cli/other shards), oxfmt --check clean, oxlint clean.

@Finn763
Finn763 requested a review from a team as a code owner September 10, 2026 13:18
@clawsweeper

clawsweeper Bot commented Sep 10, 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.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 6, 2026, 9:19 AM ET / 13:19 UTC (Revision 11).

ClawSweeper review

What this changes

The 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
Reviewed head: 590c6fe105a8366ddb3b857f51fa455e4ba336e9
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful implementation with real CLI evidence and resolved prior findings; outstanding maintainer approvals do not reduce patch quality.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The hash-matched body supplies historical Windows PTY evidence through the real configure → apply → audit owners and real SQLite stores: selected shared plaintext is removed while other credentials remain unchanged. Current source retains that behavior and adds guarded revision-2 encoding; existing credential schemas remain unchanged, legacy agent plans remain supported, and actual released-reader source verifies rejection of revision 2.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The hash-matched body supplies historical Windows PTY evidence through the real configure → apply → audit owners and real SQLite stores: selected shared plaintext is removed while other credentials remain unchanged. Current source retains that behavior and adds guarded revision-2 encoding; existing credential schemas remain unchanged, legacy agent plans remain supported, and actual released-reader source verifies rejection of revision 2.
Evidence reviewed 9 items Pinned introduced change: Reviewed the merge-base-to-head production, documentation, test, and baseline changes. Raw test-merge records independently confirm the pinned base parent followed by the exact PR head; base-only changes were not attributed to this PR.
Current main still lacks shared target routing: Fetched main's plan contract remains revision 1 without authProfileStore, and its auth-profile apply resolver constructs an agent-local target unconditionally. The proposed shared-write behavior is not implemented there.
Released reader compatibility: The latest supplied release, v2026.9.8, requires protocolVersion 1. The branch preserves revision 1 for agent-only plans and requires revision 2 exactly when an auth-profile target selects shared ownership, preventing old readers from silently misrouting those plans.
Findings None None.
Security None None.

How this fits together

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

Decision needed

Question Recommendation
Should this explicit shared-store migration design and its revision-2 plan boundary replace the existing hold on shared credential writes? Approve explicit shared migration: Accept revision-2 shared plans while preserving revision-1 agent-local intent, then complete the separate exact-head security approval.

Why: A verified maintainer expressly withheld approval for shared-target and protocol changes; technical correctness cannot lift that hold.

Before merge

  • Resolve merge risk (P1) - Shared plans require a revision-2-capable applying CLI; existing released revision-1 CLIs reject them, and the explicit maintainer hold has not authorized this shared-write contract.
  • Complete next step (P2) - Obtain explicit approval lifting the shared-target/protocol hold, and complete the repository security approval for head 590c6fe.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +191, Tests +716, Docs +12, Other -1. Total +918 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 4 276 85 +191
Tests 5 766 50 +716
Docs 2 16 4 +12
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 12 1058 140 +918

Review metrics

Metric Value Why it matters
Plan compatibility 1 owner field added; 1 protocol revision added Shared plans introduce a documented applying-CLI requirement while agent-only plans retain revision 1.
Production and test growth production +191 net lines; tests +716 net lines Production growth implements explicit owner propagation, routing, and residue cleanup; tests cover their distinct compatibility and output contracts.

Stored data model

Persistent data-model change detected: serialized state: config/test-mock-exports-baseline.txt, serialized state: src/secrets/configure.ts, unknown-data-model-change: src/secrets/apply.ts, unknown-data-model-change: src/secrets/configure.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #133296
Summary: This PR is a candidate implementation for the canonical shared credential migration problem; runtime materialization in the Windows report is additional scope.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Accept the guarded revision-2 boundary (recommended)
    Explicitly approve shared migration requiring a capable applying CLI while retaining existing agent-local plans unchanged.
  2. Pause shared migration
    Retain the current diagnostic-only behavior until the shared-write contract is sponsored.

Technical review

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The hash-matched body supplies historical Windows PTY evidence through the real configure → apply → audit owners and real SQLite stores: selected shared plaintext is removed while other credentials remain unchanged. Current source retains that behavior and adds guarded revision-2 encoding; existing credential schemas remain unchanged, legacy agent plans remain supported, and actual released-reader source verifies rejection of revision 2.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: Operators still lack supported migration of shared plaintext credentials, with reported provider-auth failures and wrong-store writes.
  • merge-risk: 🚨 compatibility: Shared plans become unusable on released revision-1 CLIs, and the maintainer has not accepted the new contract.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The hash-matched body supplies historical Windows PTY evidence through the real configure → apply → audit owners and real SQLite stores: selected shared plaintext is removed while other credentials remain unchanged. Current source retains that behavior and adds guarded revision-2 encoding; existing credential schemas remain unchanged, legacy agent plans remain supported, and actual released-reader source verifies rejection of revision 2.
  • proof: sufficient: Contributor real behavior proof is sufficient. The hash-matched body supplies historical Windows PTY evidence through the real configure → apply → audit owners and real SQLite stores: selected shared plaintext is removed while other credentials remain unchanged. Current source retains that behavior and adds guarded revision-2 encoding; existing credential schemas remain unchanged, legacy agent plans remain supported, and actual released-reader source verifies rejection of revision 2.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head production, documentation, test, and baseline changes. Raw test-merge records independently confirm the pinned base parent followed by the exact PR head; base-only changes were not attributed to this PR. (7691f5ce37d9)
  • Current main still lacks shared target routing: Fetched main's plan contract remains revision 1 without authProfileStore, and its auth-profile apply resolver constructs an agent-local target unconditionally. The proposed shared-write behavior is not implemented there. (src/secrets/apply.ts:466, 08af7f8a1424)
  • Released reader compatibility: The latest supplied release, v2026.9.8, requires protocolVersion 1. The branch preserves revision 1 for agent-only plans and requires revision 2 exactly when an auth-profile target selects shared ownership, preventing old readers from silently misrouting those plans. (src/secrets/plan.ts:68, fc23bc864e45)
  • Explicit maintainer compatibility hold: vincentkoc's MEMBER-associated comment explicitly approves only the warning-only diagnostic and states that no protocol-version or target-contract change is approved. It preserves existing agentId intent and leaves shared migration open: fix(secrets): warn on shared auth-profile plaintext in configure #133843 (comment).
  • Retained findings resolved: The output regression retains Clack's actual logger, stubs only interactive prompts, and captures both real output streams. The CLI guide now explains shared discovery regardless of agent selection, agent-local creation, and the revision-2 applying-CLI requirement. These satisfy both retained findings and rank-up moves. (src/secrets/configure.output.test.ts:23, 590c6fe105a8)
  • Real CLI and existing-state proof: The complete retrieved body matches captured SHA-256 de58e00a07d6de8112dd894064d9fb3869f8ce5dd55d09c4a56511b09f338950, including omitted ranges. Its Windows PTY configure → apply → audit transcript at historical head 249dd45e2692 shows real SQLite shared plaintext becoming keyRef, the audit count decreasing from 3 to 2, and unselected shared and agent-local credentials remaining unchanged. Later source and discussion preserve that routing behavior; this is historical runtime proof, not execution of the current head. (249dd45e2692)

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • SunnyShu0925: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-13T15:41:51.993Z sha 249dd45e2692baba6b6818f496b525902f631cfa :: blocked before merge. :: [P1] [P1] Make shared plans rejectable by older readers | [P2] [P2] Separate shared-owner keys from agent IDs | [P2] [P2] Preserve raw residue when deciding whether a shared write is needed
  • reviewed 2026-09-13T21:22:02.471Z sha 372c72240ef707785fe807e187797ed9c1e847c4 :: blocked before merge. :: none
  • reviewed 2026-09-23T18:04:55.735Z sha 12b7f6971208fc463b63e2bc4928f060f809e25d :: blocked before merge. :: [P3] Update CLI guidance for shared-store targets
  • reviewed 2026-09-23T18:17:42.315Z sha 6abdc4539d0761bc3d37bc76cfbddabb4d959896 :: blocked before merge. :: [P3] Update the CLI secrets guide for shared-store plans
  • reviewed September 23, 2026, 2:30 PM ET / 18:30 UTC (Revision 7) sha unknown :: blocked before merge. :: [P3] Update the CLI guide for shared targets and revision-2 plans
  • reviewed 2026-10-04T19:45:04.656Z sha 6abdc4539d0761bc3d37bc76cfbddabb4d959896 :: blocked before merge. :: [P3] [P3] Update the CLI guide for shared targets and revision-2 plans
  • reviewed 2026-10-06T12:14:55.222Z sha 819fb6d6067196d40ec3189dbbd68244e992f508 :: blocked before merge. :: [P2] [P2] Keep the real warning logger in the output regression | [P3] [P3] Update the CLI guide for shared targets and revision-2 plans
  • reviewed 2026-10-06T12:30:44.895Z sha 71d9cf611399867a63d6ccebf71c27c563af36ee :: blocked before merge. :: [P2] Keep the real warning logger in the output regression | [P3] Update the CLI guide for shared targets and revision-2 plans

@Finn763

Finn763 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The PR body now carries the requested real configure -> apply -> audit evidence, both legs re-run by the author: on this branch the selected shared row is migrated to keyRef (plaintext cleared) and the agent-local credentials stay byte-identical; on the parent revision configure offers no shared candidate, apply writes the plan into the agent-local store (polluting it with an extra openai:shared row) and the shared row keeps its plaintext.

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 13, 2026
@Finn763
Finn763 force-pushed the fix/oc-143262-descr branch from 249dd45 to 372c722 Compare September 13, 2026 21:15
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: XL and removed size: L labels Sep 13, 2026
@Finn763

Finn763 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

@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).

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 13, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Maintainer security review required

This external contributor PR changes sensitive security components. A maintainer must review these changes before merging.

Current SHA: 590c6fe105a8366ddb3b857f51fa455e4ba336e9

These sensitive security changes were made:

  • src/secrets/apply.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/secrets/configure-plan.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/secrets/configure.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/secrets/plan.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

After reviewing the changes, post a new PR comment containing only approval commands, each on its own line:

/allow-security-sensitive-change

A later push requires a fresh approval comment.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 6, 2026
@Finn763
Finn763 force-pushed the fix/oc-143262-descr branch from 819fb6d to 71d9cf6 Compare October 6, 2026 12:21
@Finn763

Finn763 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Rebased and rebuilt onto main @ b2fab204731; new head is 71d9cf61139 (previous head 6abdc4539d07 superseded). mergeable: true — the PR no longer conflicts. Two empty re-trigger commits were dropped during the rebuild, and the secretref semantics are unchanged (shared-store authProfileStore routing, protocol revision 2 gating, owner-discriminated picker keys, raw-row residue cleanup). Test fixtures were adapted to main's refactored picker flow (select now resolves candidate objects instead of picker keys).

Old openclaw/ci-gate red (run 35900582302, 2026-09-23) — aggregate-gate noise, not this diff: the gate log only echoes checks-node-core-test-nondist-shard and check-shard as failures at gate-evaluation time; both lanes were re-run afterwards and now report success. The other red lanes on that head were the upstream flake already documented above (check-test-types TS2345 in extensions/qa-lab/src/control-ui-openclaw-delegation.real-gateway.e2e.test.ts and checks-node-compact-large-30/31 subagent-registry assertions). None are reachable from this diff (docs/gateway/secrets-plan-contract.md + src/secrets/*).

CI on the rebuilt head: run 37461166346 finished with exactly one failing lane — checks-fast-baseline-ratchets: check:test-mock-exports flagged the updated ../agents/auth-profiles/persisted.js mock factory in src/secrets/configure.test.ts. That is fixed in 71d9cf61139 via the documented escape hatch (adjacent // mock-isolation: note + pruning the now-stale baseline row, 10582→10581; the ratchet passes locally). All other lanes in that run passed. New run 37462899742 is in progress on 71d9cf61139.

Diff-scoped local checks on the new head: secrets suites plan, configure, configure-plan, configure.output pass (26 tests); oxlint clean; tsgo clean for tsconfig.core.json and the core.test.other / core.test.agents-tools shards; check:test-mock-exports clean. (apply.test.ts completes its assertions, but its temp-dir cleanup hits a Windows-only EBUSY on unlink that reproduces identically on a clean origin/main checkout — CI runs Linux.)

@Finn763
Finn763 force-pushed the fix/oc-143262-descr branch from 71d9cf6 to 590c6fe Compare October 6, 2026 13:03
@Finn763

Finn763 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Pushed 590c6fe105a addressing the two retained findings from revision 10.

P2 — real warning logger in the output regression (src/secrets/configure.output.test.ts)
The @clack/prompts mock no longer replaces log. Only confirm/select/text are stubbed and the real logger runs, so the regression now goes through production log.warn(..., { output: process.stderr }). The real stdout stream is captured too, so a warning that loses that routing is visible rather than silently swallowed. Guard validated by locally deleting { output: process.stderr } from configure.ts: the test fails on stderr not containing the warning.

P3 — CLI guide for shared targets and revision-2 plans (docs/cli/secrets.md)
Documented that shared-store candidates are discovered regardless of --agent, that new-profile creation stays agent-local, that a plan with any authProfileStore: "shared" target is serialized as protocolVersion: 2 and needs a revision-2-capable CLI to apply, and that apply may write to the shared state database.

Local: configure.output, configure, configure-plan, plan pass under vitest.secrets.config.ts; check:test-mock-exports ratchet OK (10581). Remaining local reds in that shard are Windows-only environment classes (EPERM on temp-dir cleanup, fs-safe POSIX permission mode, file-lock, proxy CA), none reachable from this diff.

The P1 revision-2 contract acceptance and the repository security approval remain open maintainer decisions.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 6, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Oct 8, 2026
@Finn763

Finn763 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Status update so this doesn't go stale: the branch was rebuilt onto main @ b2fab204731, and the two retained findings from revision 10 were addressed in 590c6fe105a8. On that head all CI workflows and the security review completed green; the only remaining gate is the required maintainer approval of the current revision for this security-sensitive change (the ci-gate / security-sensitive-review statuses). Nothing is pending on our side — it is ready whenever a maintainer can take the approval.

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Oct 9, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@stealthybear

Copy link
Copy Markdown
Contributor

Still reproduces on current main (993d0b7) and on 2026.11.10: a token saved with openclaw models auth paste-token lands in the shared auth store, and openclaw secrets audit reports it as plaintext. A secrets apply plan for that profile can't move it, because resolveAuthStoreForTarget in src/secrets/apply.ts only ever opens the agent-local store. The dry run fails with "Cannot create auth profile". Given a provider, it would create a second, agent-local copy and leave the plaintext one in the shared store. So users who follow the audit's advice have no supported way to clear this finding.

@vincentkoc, on #133843 you ruled out inferring shared ownership from a v1 agentId, and this PR's explicit owner field follows that. Is an explicit owner on the plan target an acceptable contract change in principle? If so, and @Finn763 has no time to rebase, I'm glad to send a rebased version that keeps their authorship.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-review-required security-sensitive-changed size: XL stale Marked as stale due to inactivity status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

4 participants