Skip to content

refactor(secrets): move providerless refs to Doctor - #163350

Merged
steipete merged 12 commits into
mainfrom
refactor/lg-config-secretref-runtime
Oct 3, 2026
Merged

steipete merged 12 commits into
mainfrom
refactor/lg-config-secretref-runtime

Conversation

@steipete

@steipete steipete commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Runtime readers still supplied missing providers for legacy SecretRef config and auth rows. The published 2026.9.7 SDK can write providerless auth refs, so deleting those readers requires a durable migration. A providerless ref with extra fields also exposed a repair bug: adding provider while retaining the extra fields produced an object rejected by the canonical three-field parser.

User Impact

Doctor now owns normalization of registered legacy credential inputs. Config credentials receive their source-specific configured provider; stored auth refs retain their historical default provider independently of config defaults. Core runtime consumes canonical refs and supported environment shorthand. Active providerless core inputs require Doctor; opaque plugin data and inactive missing-plugin inputs stay intact. The generated models.json environment-marker contract remains unchanged.

Registered providerless refs containing extra fields normalize to exactly source, provider, and id. Doctor reports the normalization without logging removed values, and existing config/database backup or source-archive owners preserve the original bytes before writing. Opaque neighbors, other auth-profile fields, and rotation state remain intact. Repeated repair is idempotent.

Public SDK input coercion and string-read contracts remain compatible, including configured-input resolvers, channel collectors/builders, and unknown-valued web-provider credential callbacks. Public auth save/updater/upsert boundaries canonicalize supported providerless refs before persistence and runtime snapshot publication. New SDK writes of extended refs fail before mutating caller input, persisted rows, or published snapshots; the error tells callers to preserve metadata separately and explicitly invoke the unchanged public coercer. No public entrypoint or export is retired, and no schema is widened.

Manifest config signals use their documented presence contract for opaque nonempty objects instead of guessing that undeclared source/id metadata is a SecretRef. Canonical refs still require provider/environment availability. The main-only storage callback also consumes canonical refs; storage locations postdate 2026.9.7.

Why This Change Was Made

Providers were introduced by 4e7a833a24e on 2026-02-25, but a supported published SDK writer still emits providerless refs. Their migration therefore remains supported under the retention policy. Node-host Cloudflare Access has canonical write ingress since its 2026-08-17 introduction (2d3aaaa0d59) and in 2026.9.7; removing provider filling there changes no supported stored bytes.

Auth repair reuses #162958 (9b0a90e3b9e): ordinary field repair runs with an empty alias map, verifies its SQLite backup, and revalidates database generation/raw preimages before writing. Config marker normalization moves into src/commands/doctor/shared; the lg-doctor owner remains responsible for persistence and backup. There is no parallel migration scaffold.

The rebase preserves main's overlapping owner changes: #163974 keeps existing named channel accounts and shared root policy/token, while #164019 retains cast-free persisted-store construction and the simplified external-profile save condition. Parsing, local-save shaping, and Doctor config metadata have focused owners; lazy external lookup and backup/report ordering remain intact.

Production against rebased base 5f6ee754f6f17978651e5c19d6001c5d8901de91: +648/-497/net +151 across 55 production files under src/** and extensions/**, excluding tests, test support/helpers/utils, e2e, and fixtures. Retained public SDK adapters and durable normalization safeguards account for growth. Commit d39c08bdb7da364546879bacb5fd9113afaf8c6e removes only the obsolete assertion-baseline row for the deleted src/secrets/legacy-secretref-env-marker.ts. Follow-up e1e2bd8ad9c05c2b6889c2532584a26a54abfecc gives internal canonical resolvers distinct names and cuts over all five internal callers, SDK imports, and the core test. Public SDK names and behavior remain unchanged; no internal compatibility aliases or guard exceptions are added. Final 64b687b838b1bb67b705b618014dd321948b2f58 replaces credential parameter reassignment with an equivalent local const; no behavior or assertions change.

The branch was rebased onto 5f6ee754f6f17978651e5c19d6001c5d8901de91 because GitHub reported a real conflict. Current head is 8660640dccf68196065e3e3f70fa23de3f6588f1. Eleven of twelve patches are identical; the remaining range-diff changes only extraction context. Main's #164240 moved the auth runtime AsyncLocalStorage into runtime-scope.ts, so the resolution preserves that shared singleton and personal-account guard while retaining this PR's store-save.ts options owner. Main's snapshot-clone ownership, protected-store worker reads, and Doctor retired-sidecar preflight remain intact. The resolution passed a fresh independent P2 review.

The successful package/update/Gateway cells below retain their exact 64b687b… source identity. They are not executions on the rebased head. Source comparison shows no main changes in the strict SecretRef type parser, profile credential resolver, runtime preparation, or auth-ref collector owners. The original update cell used env refs and no authored includes, webhook migrations, or retired OAuth sidecars. Focused new-head proof checks the shared-owner integration instead of repeating the full install/update campaign.

Evidence

Rebased-head focused proof passed at 8660640dccf68196065e3e3f70fa23de3f6588f1 against base 5f6ee754f6f17978651e5c19d6001c5d8901de91: 188 tests across seven suites, core typecheck, full SDK API report, and SDK surface budget. Producer: Hetzner lease cbx_53d53730992c, native run run_97f32c587de948cb03caf1af6552e1bb. The fresh-clone/frozen-install phase took 510.10s; native command wall was 517.021s. All 14 recorded commands, including preparation, exited zero. Downloaded artifact SHA256 eecc14833592e066bd5edf41e4045b1a400c7ab1d17fa19480285c71d9eaea81 and exact SDK evidence SHA256 a91b68e232cd1d6871f32cd6111800949b63b730ef8d5140d4105b379e56a13e were independently checked.

Rebased-head suite Passed Command wall Vitest duration
src/agents/auth-profiles/persisted-boundary.test.ts 27 24.20s 21.49s
src/agents/auth-profiles/store.async-read.test.ts 18 21.66s 19.01s
src/plugin-sdk/provider-auth-write-compat.test.ts 5 29.63s 26.83s
src/agents/embedded-agent-runner/run/auth-profile-personal-usage.worker.test.ts 7 35.17s 16.76s
src/secrets/runtime-state.test.ts 62 28.70s 26.09s
src/secrets/runtime-state.store-refs.test.ts 1 20.93s 18.39s
src/commands/doctor-auth-flat-profiles.test.ts 68 71.65s 68.82s

Per-file commands were pnpm test <file> --maxWorkers=1, totaling 231.94s wall. pnpm tsgo:core passed in 14.35s, SDK report generation in 214.98s, and SDK surface check in 5.68s. The full new report retains the same 194 affected export identities: 190 reachable-declaration effects and four signature-text changes, with no entrypoint/export additions or removals. The four wrappers retain the same parameter/result contracts. Compared with the approved prior-64 report, main's internal resolveRuntimePluginRegistry const-to-function declaration is the only new unique internal pair difference; the webhook handler type and memoryFlushTools declarations changed identically on both sides of the report, so they are not changes introduced by this PR.

The maintainer personally inspected the full report and approved digest 98cf306eec6c049352635a135212ec840046982d55a81192d0e24bc60db15e05, bound to the exact evidence-file hash above. Native canonical SDK acknowledgement passed with prefix 98cf306e in Hetzner run run_b9e4892fc7d4deb2ce3a53f197356a7e on lease cbx_53d53730992c. The existing release-evidence owner checked the immutable report in 0.22s (5.899s native command), preserving its original producer and exact bytes; no report regeneration was needed.

Canonical check coverage is complete for the reviewed scope: 11 remaining commands passed on final 64b687b838b1bb67b705b618014dd321948b2f58, retaining 28 earlier passing gates with their original e1e provenance. Final producer: Hetzner lease cbx_2bd50ab12012, native run run_35a48d22cc2790f899661ca651dbe0e2. The final checks phase took 1,073.39 seconds, including preparation; the remaining-command runner took 1,025.34 seconds. All 11 native exit codes were zero.

The continuation verified the exact two-line e1e-to-64 source diff, original native plan/log/source hashes, all 28 prior successes, and equality of the fresh plan except for its head. It used the repository's plan builder, command environments, package-manager wrapper, and managed-child lifecycle for core/extension/script lint and the remaining schema/storage/media/sidecar/import-cycle/webhook/auth guards. The original e1e check phase still records its no-param-reassign failure; that was repaired with a local const. Neither the retained gates nor their original failure status were restamped as a new full-check run.

The prior-64 SDK API report and surface check passed in 276.00 and 7.70 seconds in the same native run. The full diff JSON is identical to the reviewed e1e diff: 194 affected exports, comprising 190 reachable-declaration effects and four signature-text changes, with no entrypoint/export additions or removals. The prior-64 digest was explicitly approved: 3afc44a22d6c5d93386365cab45c8ac3e3041a9c2bf6515362620ed1d4d17898. The exact prior-64 evidence-file SHA256 is 18a1a7c4870e2a33c8679bf52e9a26853849edc99242ec0dd1d1264945445ffd, binding that report to its recorded 64 head/base/workflow. The rebased head receives a separate fresh report and acknowledgement.

Behavior proof and measured cost

At e1e2bd8ad9c05c2b6889c2532584a26a54abfecc, the two affected resolver suites passed 26 cases: 23 core configured-resolver cases and 3 public SDK SecretInput cases. Producer: Hetzner lease cbx_2bd50ab12012, run run_ded4cd3f6841d5f5a8dfe4043518fd01. Command walls were 28.71 and 29.80 seconds (Vitest 25.00 and 26.69 seconds), for 58.51 seconds summed command wall and 123.23 seconds including preparation. The final local-binding correction preserves those results under their original source identity; neither suite is replayed.

Native proof at 042de6ac731b78c6a94e5e97121a95f589892465: 178 passing tests in seven affected files. Producer: Hetzner lease cbx_2bd50ab12012, run run_bdd8354e16a73eada1d2bcedb2f9ff67. Per-file commands were pnpm test <file> --maxWorkers=1; their wall times sum to 269.40 seconds. The complete test phase, including fresh fetch and frozen install, took 314.11 seconds.

File Passed Command wall Vitest duration
src/agents/auth-profiles/persisted-boundary.test.ts 27 30.15 s 26.99 s
src/plugin-sdk/provider-auth-write-compat.test.ts 5 38.03 s 34.74 s
src/commands/doctor-legacy-config.migrations.test.ts 58 49.23 s 46.00 s
src/commands/doctor-legacy-config.secret-inputs.test.ts 6 31.17 s 28.09 s
src/agents/auth-profiles/store.async-read.test.ts 18 25.47 s 22.46 s
src/agents/auth-profiles.sqlite-store.test.ts 16 40.11 s 36.83 s
src/agents/auth-profiles/profiles.test.ts 48 55.24 s 52.12 s

Another 131 cases retain their original c45 source attribution (c45fd8a12a0c3080df941806c2172b653add0a2a): runtime-state 62, store refs 1, Doctor flat profiles 68. Their producer was Hetzner lease cbx_82ecc3069e04, run run_c4ffafdd3284ab92c1089fcad2aee6b2; command walls were respectively 34.37, 22.38, and 74.36 seconds. These results cover retained contracts and are not claimed as executions on the final head. No passing suite was rerun after a baseline-only change. These are remote command costs, not hosted CI seconds; CI cost is not yet recorded.

The extended-ref regression ran against old production b8a8edbe1b759627f99f8a2edf74125f2636dd47, with only the final SecretRef test file applied after a frozen install. Its four source cases all failed with the intended four-field-versus-three-field mismatch; the two marker cases were excluded by name selection. Command wall was 30.41 seconds. The repository's credential reporter redacted stack coordinates after the secret-inputs filename, so the original validator could not match the literal line. A reviewed read-only reconciler bound the exact saved artifacts, source, native IDs, messages, and zero infrastructure errors, and passed in native run run_d76ee7dd7fe534118da20a17cc3a1500 (19.377 seconds). It preserved the original test/validator exit codes and failed phase status. No test rerun or assertion weakening was used.

Earlier deterministic fixture defects were repaired at their owners: a replacement registry enumerated only Discord tokens and hid model-provider targets, so the obsolete 55-line mock was removed; an auth migration assertion now splits grouped note blocks before applying its original exact-count/message checks. No retries, longer timeouts, or broader mocks were added.

Update Behavior

The genuine published-driver npm update succeeded. Native run run_ff152ebc77f76ff720f7506190e84100 on Hetzner lease cbx_2bd50ab12012 installed published OpenClaw 2026.9.7 with npm 11.17.0, created the agent through the published CLI, wrote two legacy config markers and an extended registered config ref through that CLI, and wrote two extended providerless auth refs through the published SDK. The installed driver then ran openclaw update --yes --no-restart --tag file:<sealed-candidate.tgz> --json to prior candidate 64b687b838b1bb67b705b618014dd321948b2f58. The application update 26fc6a21-b9c9-40b9-a165-0dc17c05584c reports status: ok, npm mode, and a succeeded application update record. Package installation/swap and candidate state, Doctor, config, plugin, recovery, and startup checks passed with the unchanged 50,000-entry integrity limit. Update command wall was 452.04 seconds; its internal JSON duration was 357.339 seconds. The original cell phase took 541.26 seconds (native command 550.333 seconds).

The prior-64 package was built and sealed in native run run_b659421ecbc4472162e75c9eb30931a3 on the same lease. Build wall was 706.30 seconds, package wall 90.04 seconds, and complete package phase 843.97 seconds. Tarball SHA256: eb07d83dfd944ad1db1c2f040d5c454270ecd1e251cc2f5ad4346779689d383d; sealed build-info SHA256: bdcfea6f6cd51bd022697ee83e25a1f8da0e80b63b00d55b533a5d4eeed965ff. The continuation also uses the repository's existing upgrade-survivor package-identity owner to compare installed package.json, openclaw.mjs, and the complete dist inventory against this sealed artifact. npm retains ownership of dependency reification.

After the successful update, the original proof cell failed because its expected config omitted Doctor's documented wizard provenance. A reviewed continuation, run_07f71328950cfbe125e909d3fb42d4c5, passed complete config/raw-row/backup verification and public SDK compatibility checks in 0.34 and 0.82 seconds. The expected wizard object has exactly the four observed fields: canonical ISO timestamp within the original update interval, sealed candidate version, command doctor, and mode local. Whole-config equality remains exact elsewhere. It verified source-specific config provider defaults, auth refs' historical default provider, exact original config and auth-row backups, untouched opaque neighbors and health/rotation rows, all three public configured resolvers, and the public channel collector.

The continuation then exposed a second fixture gap: it called the runtime credential reader without activating Secrets. Both base and candidate correctly reject an unpublished SecretRef; the runtime contract requires eager materialization. A subsequent real-Gateway attempt, run_a26ca8604433c9d35245b96937a142b4, reached health and shut down cleanly but its service-only probe never ran because its manifest omitted the documented activation.onStartup: true. Its failed runtime wall was 315.02 seconds, with no assertion timeout increase. The reviewed correction adds that one manifest field. Runtime uses a separate copied config enabling the synthetic service, the same migrated persisted auth store, and public SDK credential APIs after actual Gateway activation. No inline credentials or fabricated snapshots are substituted. It preserves caller input, raw rows and the actual published snapshot when rejecting an extended write, then joins graceful shutdown before full Doctor and exact original-config/backup idempotence checks.

The corrected runtime and remaining update proof passed in native run run_cdf9abc8ec5c1ed142ad122a1b0d1e6f on the same lease. All six phases exited zero. Admission verified 11,446 installed application files against the sealed package. The real Gateway reached health, its normally activated synthetic service resolved all three persisted credentials and proved extended-write rejection left caller input, durable rows and the Gateway-published snapshot unchanged. Every owned command joined, SIGTERM required no escalation, and the native port claim was released. The original config, raw credential/health rows, backup list and every original backup hash matched the retained checkpoint both after Gateway shutdown and after full openclaw doctor --fix --non-interactive, including the exact previous wizard timestamp. Doctor completed with nonblocking isolated-fixture diagnostics; these were not converted into a claim of warning-free operation.

Command walls: admission 3.03s, Gateway runtime 15.72s, preservation 0.32s, full Doctor 15.96s, final idempotence 0.32s, and original-evidence preservation 0.04s. Inner continuation wall was 35.55s; native command wall was 42.041s. Downloaded result archive SHA256 is ec1de3a9d179ddc2d832cb876d5fed156dc83c96a9fe54b47c5c4d6c1c59e11c, independently checked before artifact inspection. The failed manifest-omission run remains failed and is not claimed as this successful execution.

All prior failed statuses, original successful update receipts, and completed verification/SDK results remain hash-bound and attributed to their original native producers; install/update and passing tests are not repeated or restamped. The earlier stderr admission failure is preserved separately: the completed original stderr differed from its early progress capture only by /usr/bin/time's final 35-byte timing suffix, and admission now pins the exact final hash.

The separate pnpm attempt remains a limitation: native run run_3ab8ed6dac8e91dda6b86b5af5127396 failed after candidate checks passed. A confirmed secondary rollback defect in published 2026.9.7 resolves its database-generation worker against the old physical pnpm installation path after replacement, because restoreUpdateDatabaseBackup omits the active root when calling readUpdateDatabaseGenerationsIsolated. The initiating failure was not retained in the original run ledger and remains unknown; the missing rollback worker is not claimed as its primary trigger. No product workaround or package-integrity limit change was added to this PR. The genuine npm route above supplies the successful published-driver update cell.

Product changes and each corrected proof capsule passed independent Codex P2 review. The payload-attribution finding was addressed through the existing package-identity owner; broader dependency re-auditing was rejected in favor of npm's established ownership. Original findings and failed proof statuses remain preserved. No local test, build, or typecheck result is claimed.

Native proof and review gates are complete. Rebased-head integration tests/types/API/surface and canonical SDK acknowledgement passed; exact-head hosted CI and merge remain pending. Package/update/runtime evidence retains its proven prior-64 producer and source attribution; earlier tests and checks retain e1e/042/c45/64 identities. The pnpm initiating failure remains the explicit limitation above; no pnpm success or local test/build/type result is claimed.

Exact-head CI and inherited UI timeout

CI run 37130698716 executed merge 89db55238d766e1b420ded69527f32b7bdfca5dd, whose verified parents are main b94391aa2c5a6e248ea60848cee6394759187f94 and this exact head 8660640dccf68196065e3e3f70fa23de3f6588f1. Full job pagination records 81 successful jobs, 19 skipped jobs, and two failures: UI E2E 2/9 and its aggregate openclaw/ci-gate. No jobs were cancelled. security-fast passed; the separate Security Review publisher completed successfully and projected the CI failure.

The UI job took 424 seconds and reported 82 passing files/392 passing cases, with one 120-second timeout: github-link-hovercard.e2e.test.ts, “waits silently while pending, then shows the result (dark, reduce, 390, fails=true).” The stalled await is not identified; a passing replay is not claimed as a fix.

This is a source-excluded failure, not a SecretRef regression. The entire UI tree, test/helpers/qa-gateway-cleanup.ts, src/gateway/control-ui-contract.ts, and src/shared/control-ui-link-reader.ts are byte-identical between the tested merge and its main parent. The test supplies TEST_LINK_READER and deferred synthetic forge.preview (github-link-hovercard.e2e.test.ts:95–116); control-ui-e2e.ts defaults passthrough prefixes to empty and replaces WebSocket, while control-ui-e2e-controls.ts:108–117 rejects the deferred result through page.evaluate. No actual Gateway, auth store, plugin-manifest credential reader, or changed SecretRef parser runs in this flow. The only UI consumers of the changed types.secrets.ts import the unchanged ENV_SECRET_REF_ID_RE from the untouched secrets/ref-contract.ts.

Landing uses the maintainer-authorized pre-existing-failure exception at the pinned head. The timeout remains an explicit follow-up: no matching fix was verified. Exact reproduction inputs are retained as 688 ordered includes, Vitest shard 2/8, three workers, --configLoader runner, and real-Gateway tests disabled; the job's 2/9 label is not the executable shard count. No CI rerun, retry, longer timeout, or weakened assertion was used.

A separate bounded native comparison ran the original 688-entry selection through Vitest shard 2/8, with 3 workers and the original config loader, assertions, and timeouts, once on clean main 6d05367678fbd3b8f01040eb565184d77b257aaf and once on the exact CI merge 89db55238d766e1b420ded69527f32b7bdfca5dd. Both passed 393/393 cases across the original 83 files, with no selection drift. The formerly timed-out hover-card case passed in 1.095 s and 1.107 s, respectively. Shard process wall times were 369.35 s / 367.97 s; the complete native command took 858.780 s. Producer: Hetzner lease cbx_53d53730992c, run run_fc294ff338225957045ca26ad6325da2; retrieved evidence SHA256 04658f802fdb5ac2efd340fa5c9991a1c7ec53b12f8b41919cbf1dc0c6123aaf was verified. These are single diagnostic runs on unchanged sources, not a repair or repeated-run campaign. The original CI timeout remains recorded, and its stalled await and root cause remain unresolved.

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations agents Agent runtime and tooling size: L labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 3, 2026, 10:50 AM ET / 14:50 UTC (Revision 15).

ClawSweeper review

What this changes

The branch moves normalization of secret references missing a provider into Doctor, makes core readers require canonical references, and preserves published plugin SDK input adapters.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 5 items remain

This PR remains useful, but the previously reported Talk credential-preservation defect is still present. The recorded update, Gateway, and SDK evidence is valuable; it does not resolve that migration-order bug.

Priority: P2
Reviewed head: 8660640dccf68196065e3e3f70fa23de3f6588f1

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong recorded production proof and SDK compatibility evidence accompany a still-blocking migration defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The hash-matched body records published-driver upgrade and real Gateway activation resolving migrated auth refs, preserving backups, and rejecting extended writes without mutation at 64b687b838b1bb67b705b618014dd321948b2f58; focused integration and SDK approval are recorded for the rebased head. Preserve those source identities. Stored-input compatibility remains insufficient because neither Talk map is covered and source proves credential loss.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The hash-matched body records published-driver upgrade and real Gateway activation resolving migrated auth refs, preserving backups, and rejecting extended writes without mutation at 64b687b838b1bb67b705b618014dd321948b2f58; focused integration and SDK approval are recorded for the rebased head. Preserve those source identities. Stored-input compatibility remains insufficient because neither Talk map is covered and source proves credential loss.
Evidence reviewed 8 items Introduced Talk credential deletion: The pinned introduced diff replaces coerceSecretRef with parseSecretRef in the Talk provider normalizer. A providerless object returns null and apiKey is omitted from the rebuilt provider configuration.
Complete migration ordering: The base compatibility pass calls normalizeLegacyTalkConfig, which rebuilds both Talk provider maps using the strict normalizer. migrateLegacySecretInputs runs afterward, when the omitted credentials are no longer discoverable. Both credential maps are registered SecretRef targets.
Defect survives the verified test merge: The test merge records exactly b94391a followed by the pinned PR head as parents. Comparing its Talk result with that main parent confirms the strict-parser change survives merging; it is not base drift.
Findings 1 actionable finding [P1] [P1] Preserve Talk credential refs until Doctor canonicalizes them
Security None None.

How this fits together

Secret references connect configured credentials and stored auth profiles to OpenClaw's secret providers. Doctor prepares older persisted inputs before Gateway and agent runtime readers consume them.

flowchart TD
  A[Existing configuration] --> C[Doctor repair]
  B[Stored auth profiles] --> C
  C --> D[Backed-up canonical state]
  E[Plugin SDK writes] --> F[Input normalization]
  F --> D
  D --> G[Runtime secret resolution]
  G --> H[Gateway and agent credentials]
Loading

Before merge

  • [P1] Preserve Talk credential refs until Doctor canonicalizes them (P1) - For talk.providers.example.apiKey = { source: "env", id: "SYNTHETIC_KEY" }, the new parser returns null and this loop omits apiKey. Doctor calls normalizeLegacyTalkConfig before migrateLegacySecretInputs, so the repair candidate loses the credential instead of adding its provider. talk.realtime.providers uses the same loop. Preserve these inputs until Doctor migration consumes them and cover both maps through the complete repair pipeline. This previously reported blocker remains unresolved.
  • Resolve merge risk (P1) - An update or Doctor repair can remove existing providerless Talk speech and realtime credentials from the repaired configuration; compatibility for those upgrade inputs remains unresolved.
  • Complete next step (P2) - Preserve providerless apiKey inputs in both Talk provider maps until Doctor canonicalizes them, and verify credential preservation through the complete repair and upgrade paths.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P1] [P1] Preserve Talk credential refs until Doctor canonicalizes them — src/config/talk.ts:31-34
Agent review details

Security

None.

PR surface

Source +151, Tests +233, Docs +22, Other -2. Total +404 across 76 files.

View PR surface stats
Area Files Added Removed Net
Source 55 648 497 +151
Tests 17 422 189 +233
Docs 2 22 0 +22
Config 0 0 0 0
Generated 0 0 0 0
Other 2 1 3 -2
Total 76 1093 689 +404

Review metrics

Metric Value Why it matters
Production versus regression coverage production +648/-497, net +151; tests/support +422/-189, net +233 Production growth is explained by retained published SDK adapters and durable normalization safeguards.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-auth-flat-profiles.ts, migration/backfill/repair: src/commands/doctor-auth-profile-config.ts, migration/backfill/repair: src/commands/doctor/shared/legacy-secret-inputs.ts, serialized state: config/assertion-safety-baseline.txt, serialized state: config/max-lines-baseline.txt, serialized state: src/agents/auth-profiles/persisted.ts, and 5 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Preserve Talk inputs before canonicalization (recommended)
    Repair Doctor's ordering or legacy Talk preservation, then verify both provider maps through the complete repair and upgrade paths.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve providerless apiKey objects in both Talk provider maps until Doctor canonicalizes them; add complete-pipeline regression coverage and verify upgrade preservation without restoring runtime coercion or changing public SDK contracts.

Technical review

Best possible solution:

Doctor should preserve legacy Talk credentials through every earlier normalization step and persist their canonical references using the existing backup owner.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: pass a providerless apiKey object in either Talk provider map through normalizeCompatibilityConfigValues; Talk normalization omits it before SecretRef migration. This read-only review did not execute that path.

Is this the best way to solve the issue?

The ownership direction is sound, but the current patch is incomplete: keep runtime parsing strict and repair preservation in Doctor's complete migration pipeline.

Full review comments:

  • [P1] [P1] Preserve Talk credential refs until Doctor canonicalizes them — src/config/talk.ts:31-34
    For talk.providers.example.apiKey = { source: "env", id: "SYNTHETIC_KEY" }, the new parser returns null and this loop omits apiKey. Doctor calls normalizeLegacyTalkConfig before migrateLegacySecretInputs, so the repair candidate loses the credential instead of adding its provider. talk.realtime.providers uses the same loop. Preserve these inputs until Doctor migration consumes them and cover both maps through the complete repair pipeline. This previously reported blocker remains unresolved.
    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 df346f5729d0.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The hash-matched body records published-driver upgrade and real Gateway activation resolving migrated auth refs, preserving backups, and rejecting extended writes without mutation at 64b687b838b1bb67b705b618014dd321948b2f58; focused integration and SDK approval are recorded for the rebased head. Preserve those source identities. Stored-input compatibility remains insufficient because neither Talk map is covered and source proves credential loss.

Label justifications:

  • P2: This is a normal-priority refactor with a bounded pre-merge migration defect, rather than a demonstrated urgent shipped regression.
  • merge-risk: 🚨 compatibility: The introduced Talk parser change can discard existing configuration credentials during Doctor or update repair.
  • merge-risk: 🚨 auth-provider: Dropping Talk apiKey references can leave previously configured speech or realtime providers without credentials.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (logs): The hash-matched body records published-driver upgrade and real Gateway activation resolving migrated auth refs, preserving backups, and rejecting extended writes without mutation at 64b687b838b1bb67b705b618014dd321948b2f58; focused integration and SDK approval are recorded for the rebased head. Preserve those source identities. Stored-input compatibility remains insufficient because neither Talk map is covered and source proves credential loss.
  • proof: sufficient: Contributor real behavior proof is sufficient. The hash-matched body records published-driver upgrade and real Gateway activation resolving migrated auth refs, preserving backups, and rejecting extended writes without mutation at 64b687b838b1bb67b705b618014dd321948b2f58; focused integration and SDK approval are recorded for the rebased head. Preserve those source identities. Stored-input compatibility remains insufficient because neither Talk map is covered and source proves credential loss.

Evidence

Acceptance criteria:

  • [P1] pnpm test src/commands/doctor-legacy-config.secret-inputs.test.ts --maxWorkers=1.
  • [P1] pnpm test src/commands/doctor-legacy-config.migrations.test.ts --maxWorkers=1.
  • [P1] pnpm test src/config/talk.test.ts --maxWorkers=1.
  • [P1] git diff --check.
  • [P1] Exercise the supported published-driver update path with providerless credentials in both Talk maps; verify canonical references, original-byte backups, and repeat-Doctor idempotence.

What I checked:

  • Introduced Talk credential deletion: The pinned introduced diff replaces coerceSecretRef with parseSecretRef in the Talk provider normalizer. A providerless object returns null and apiKey is omitted from the rebuilt provider configuration. (src/config/talk.ts:32, 8660640dccf6)
  • Complete migration ordering: The base compatibility pass calls normalizeLegacyTalkConfig, which rebuilds both Talk provider maps using the strict normalizer. migrateLegacySecretInputs runs afterward, when the omitted credentials are no longer discoverable. Both credential maps are registered SecretRef targets. (src/commands/doctor/shared/legacy-config-core-migrate.ts:154, 8660640dccf6)
  • Defect survives the verified test merge: The test merge records exactly b94391a followed by the pinned PR head as parents. Comparing its Talk result with that main parent confirms the strict-parser change survives merging; it is not base drift. (src/config/talk.ts:32, 89db55238d76)
  • Current main and release boundary: Fetched main still uses coerceSecretRef in Talk normalization, and v2026.9.8 still supplies providers through that coercer. The related merged credential repair establishes the migration infrastructure, but does not implement this PR's providerless-reference cutover. (src/config/talk.ts:32, df346f5729d0)
  • Captured proof body inspected: The full GitHub body matched captured SHA256 69a9a635b2ac05904993547ee1bca4ea59c5c03e24f03557fe295b9e3fc4be51. It records a published 2026.9.7 npm updater installing candidate 64b687b838b1bb67b705b618014dd321948b2f58, original-byte backups, repeat-Doctor idempotence, and a real Gateway resolving persisted credentials while rejecting extended writes without changing input, durable rows, or snapshots. These executions retain their older source identity and do not cover Talk providerless inputs. (64b687b838b1)
  • SDK approval and re-review continuity: The captured body records rebased-head SDK report approval for digest 98cf306eec6c049352635a135212ec840046982d55a81192d0e24bc60db15e05 and report hash a91b68e232cd1d6871f32cd6111800949b63b730ef8d5140d4105b379e56a13e. The prior SDK and published-updater rank-up requests therefore have supplied evidence; the prior Talk finding remains unresolved at the identical reviewed head. (8660640dccf6)

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Repair preservation of providerless credentials in both complete Talk migration paths.
  • Verify the repaired Talk upgrade inputs and record measured regression-suite costs, retaining completed proof for unchanged inputs.

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 (14 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-03T04:09:59.466Z sha c45fd8a :: blocked before merge. :: [P1] Preserve Talk credential refs until Doctor canonicalizes them
  • reviewed 2026-10-03T04:44:21.961Z sha bedddc5 :: blocked before merge. :: [P1] Preserve Talk credential refs until Doctor canonicalizes them
  • reviewed 2026-10-03T05:39:01.874Z sha b8a8edb :: blocked before merge. :: [P1] Preserve Talk credential refs until Doctor canonicalizes them
  • reviewed 2026-10-03T07:07:47.731Z sha 042de6a :: blocked before merge. :: [P1] Preserve Talk credential refs until Doctor canonicalizes them
  • reviewed 2026-10-03T08:36:24.981Z sha d39c08b :: blocked before merge. :: [P1] [P1] Preserve Talk credential refs until Doctor canonicalizes them
  • reviewed 2026-10-03T09:33:04.176Z sha e1e2bd8ad9c05c2b6889c2532584a26a54abfecc :: blocked before merge. :: [P1] [P1] Preserve Talk credential refs until Doctor canonicalizes them
  • reviewed 2026-10-03T10:56:19.586Z sha 64b687b838b1bb67b705b618014dd321948b2f58 :: blocked before merge. :: [P1] Preserve Talk credential refs until Doctor canonicalizes them
  • reviewed 2026-10-03T14:29:36.813Z sha 8660640 :: blocked before merge. :: [P1] Preserve Talk credential refs until Doctor canonicalizes them

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 2, 2026
@steipete
steipete force-pushed the refactor/lg-config-secretref-runtime branch from b8a8edb to 042de6a Compare October 3, 2026 07:01
@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label Oct 3, 2026
@steipete
steipete force-pushed the refactor/lg-config-secretref-runtime branch from 64b687b to 8660640 Compare October 3, 2026 14:23
@steipete
steipete marked this pull request as ready for review October 3, 2026 14:44
@steipete
steipete enabled auto-merge (squash) October 3, 2026 14:44
@github-actions

github-actions Bot commented Oct 3, 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: 8660640dccf68196065e3e3f70fa23de3f6588f1
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/agent-auth-credentials.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/credential-normalize.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/credential-state.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/legacy-flat-credential.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/oauth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/persisted-credential.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/persisted.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/read-only-availability.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/store-save.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.
  • src/agents/model-auth-availability.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/model-auth-model.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/model-auth-provider-config.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/model-catalog-auth-labels.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/models-config.providers.discovery-auth.runtime.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/models-config.providers.secret-helpers.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/config/types.secrets.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/gateway/auth-config-utils.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/auth-surface-resolution.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/auth-token-resolution.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/edge-auth.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/resolve-configured-secret-input-string.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/secrets/command-config.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/secrets/legacy-secretref-env-marker.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/secrets/prepared-plugin-input.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • 15 additional sensitive files; see the workflow summary.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 3, 2026
@steipete
steipete disabled auto-merge October 3, 2026 15:04
@steipete
steipete merged commit 2c0278b into main Oct 3, 2026
241 of 245 checks passed
@steipete
steipete deleted the refactor/lg-config-secretref-runtime branch October 3, 2026 15:04
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
* refactor(secrets): move providerless refs to Doctor

* fix(secrets): preserve public input adapters during canonical cutover

* fix(secrets): guard extended refs before auth writes

* test(doctor): use real SecretRef target discovery

* test(doctor): inspect grouped SecretRef repair notes

* test(secrets): split focused SecretRef migration coverage

* refactor(secrets): separate credential decoding and save preparation

* chore(config): drop stale persisted-auth line exemption

* fix(secrets): canonicalize migrated credential variants

* chore(config): prune retired SecretRef assertion allowance

* refactor(secrets): distinguish canonical core resolvers

* refactor(auth): bind normalized credential locally
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime 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. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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