Repository navigation
fix(secrets): surface degradation in logs and doctor - #109792
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7db90ea8d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const hasActiveValue = owner.paths.some( | ||
| (path) => active && getPath(active.config, pathSegments(path)) !== undefined, |
There was a problem hiding this comment.
Preserve stale state for active auth-profile secrets
When an account/auth-profile SecretRef reload fails, the recorded owner path comes from collectAuthStoreAssignments as ${agentDir}.auth-profiles.<profile>.<field>, but this check only looks in active.config. Active auth-profile credentials live under active.authStores, so a failed openclaw secrets reload for an already-active profile is reported as cold even though the gateway is still using the last-known-good credential; that misleads status/doctor about whether the owner is unavailable or stale.
Useful? React with 👍 / 👎.
7db90ea to
bc4f67f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc4f67f501
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| activeDegradedOwners = owners.map(cloneOwner); | ||
| // Any successful activation replaces the last-known-good outage with the | ||
| // new snapshot, while its own unresolved owners remain cold below. | ||
| activeReloadDegradations = []; |
There was a problem hiding this comment.
Preserve reload degradation across rollback activations
When a prior SecretRef reload failure is active, a later secrets.reload can resolve secrets and activate the prepared snapshot, then fail during the channel restart/finalize section in src/gateway/server-aux-handlers.ts; that catch restores the previous snapshot through the normal activation path. Because every activation now clears activeReloadDegradations, the rollback erases the stale-owner inventory and may leave status/doctor reporting no degraded secrets even though the runtime is back on the last-known-good snapshot after the reload failed. The clear needs to happen only after the overall reload/restart transaction commits, or the rollback path needs to restore the previous degradation state.
Useful? React with 👍 / 👎.
bc4f67f to
6006be0
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6006be055f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ); | ||
| registerResolvedValuesForRedaction(resolved); | ||
| applyResolvedAssignments({ assignments: params.assignments, resolved }); | ||
| } catch (error) { |
There was a problem hiding this comment.
Record owners for post-resolution reload failures
If every SecretRef resolves and then the atomic reload later fails during channel restart/finalize, execution never enters this catch, so no owner metadata is associated with the attempted refresh. The aux/reload handlers roll back those already-prepared snapshots without another resolution error, leaving status/doctor with no affected owner paths even though the runtime is back on last-known-good values after a failed reload.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 6:30 AM ET / 10:30 UTC. Summary PR surface: Source +974, Tests +1990, Docs +2. Total +2966 across 34 files. Reproducibility: yes. from source and the supplied focused tests: a failed SecretRef during cold startup or reload reaches the active degraded-owner inventory and then status/doctor. A final-head live reproduction transcript has not been supplied for the complete cold, stale, recovery, and redaction sequence. Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Keep the existing fail-closed secret and generic webhook behavior, then provide a redacted final-head built-Gateway transcript covering cold startup, failed reload with stale retention, recovery, doctor output, and absence of both SecretRef identifiers and resolved values. Do we have a high-confidence way to reproduce the issue? Yes from source and the supplied focused tests: a failed SecretRef during cold startup or reload reaches the active degraded-owner inventory and then status/doctor. A final-head live reproduction transcript has not been supplied for the complete cold, stale, recovery, and redaction sequence. Is this the best way to solve the issue? Unclear. Redacted structured logging plus doctor output is a focused operator-facing solution, but it is not ready to call the best fix until the current head proves that the changed reload attribution and redaction paths behave together safely. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e22c2dfaaa89. Label changesLabel justifications:
Evidence reviewedPR surface: Source +974, Tests +1990, Docs +2. Total +2966 across 34 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (21 earlier review cycles; latest 8 shown)
|
6006be0 to
7296c6b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7296c6bf71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const degradations = classifySecretResolutionErrorDegradations(err); | ||
| if (degradations.length > 0) { | ||
| for (const degradation of degradations) { |
There was a problem hiding this comment.
Preserve degradation state for invalid resolved values
When a SecretRef resolves but the value is invalid for its target, applyResolvedAssignments throws a plain Error (for example messages.tts.providers.elevenlabs.apiKey resolved to a non-string or empty value.), so classifySecretResolutionErrorDegradations(err) returns an empty list here. For reload/restart-check paths with publishFailureAsDegraded: true, the active snapshot is still left on last-known-good, but this guard skips the SECRETS_RELOADER_DEGRADED event/log and never sets secretsDegraded, so operators get no degraded or recovered signal for a real SecretRef outage. Consider falling back to the previous generic degraded event, or recording owner metadata for these post-resolution validation failures.
Useful? React with 👍 / 👎.
7296c6b to
30516e2
Compare
c5f6f87 to
d1efc27
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1efc2742f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| kind: "search", | ||
| providerId: "grok", |
There was a problem hiding this comment.
Track legacy x_search refs in web secret owners
When a shipped legacy tools.web.x_search.apiKey SecretRef resolves successfully, this branch materializes the value but never appends a web-search:grok entry to the new secretOwners inventory; if the same legacy ref later fails during reload, classifySecretOwnerDegradationState() cannot find an active owner/ref match and logs it as cold instead of stale even though the runtime is still using the last-known-good x_search credential. The modern web-search path pushes searchSelection.secretOwners, but legacy-only configs return before that path, as covered by src/secrets/runtime-legacy-x-search.test.ts.
Useful? React with 👍 / 👎.
d1efc27 to
349f921
Compare
349f921 to
49d0bc9
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49d0bc9935
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const resolution = await resolveSecretInputWithEnvFallback({ | ||
| kind: "search", | ||
| providerId: "grok", |
There was a problem hiding this comment.
Handle legacy x_search ref failures
When a shipped legacy tools.web.x_search.apiKey SecretRef is configured but cannot resolve, resolveSecretInputWithEnvFallback() returns a missing result with unresolvedRefReason; this legacy branch only handles resolution.value and otherwise falls through. Because the later modern tools.web.search selection is skipped for x_search-only configs, startup/reload neither fails nor records a degraded web-search:grok owner, so operators get no SECRETS_DEGRADED/doctor signal for the broken explicit SecretRef.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
* fix(secrets): surface degraded owners safely * fix(secrets): preserve degradation ownership across reloads * fix(secrets): require cold ownership for source recovery * refactor(secrets): keep assignment provenance internal * test(secrets): use provider error contract * fix(secrets): attribute provider failures to active co-owners * test(secrets): clarify provider failure fixture * fix(secrets): redact doctor degradation reasons * test(secrets): align reload harness with runtime state * test(secrets): cover atomic source publication * fix(secrets): preserve web owner degradation context * fix(secrets): retain active web degradation co-owners * fix(secrets): keep web provider error internal * refactor(secrets): unify reload degradation state * refactor(config): remove obsolete source snapshot setter
* fix(secrets): surface degraded owners safely * fix(secrets): preserve degradation ownership across reloads * fix(secrets): require cold ownership for source recovery * refactor(secrets): keep assignment provenance internal * test(secrets): use provider error contract * fix(secrets): attribute provider failures to active co-owners * test(secrets): clarify provider failure fixture * fix(secrets): redact doctor degradation reasons * test(secrets): align reload harness with runtime state * test(secrets): cover atomic source publication * fix(secrets): preserve web owner degradation context * fix(secrets): retain active web degradation co-owners * fix(secrets): keep web provider error internal * refactor(secrets): unify reload degradation state * refactor(config): remove obsolete source snapshot setter
Related: #101265
What Problem This Solves
SecretRef degradation can leave one owner cold at startup or keep a stale last-known-good value after reload, but the primary operator signal was easy to miss and could expose low-level resolution text.
Why This Change Was Made
secrets.degradedlog at startup and reload with redacted owner kind, owner id, reason, cold/stale state, and theopenclaw secrets reloadretry hint.unknown:unmapped/ cold metadata without leaking the SecretRef id.Per maintainer decision, this PR adds no
secrets.degraded[]gateway protocol/status field, schema, generated Swift model, protocol version bump, config option, parameter, environment variable, UI, or new capability.User Impact
Operators get a loud signal in the existing web UI log view and a human-readable doctor section. Public webhook requests remain generic
401 unauthorized; secret values and SecretRef ids are not logged.Evidence
49d0bc99355d163c8d2c677cd65c44ddac4e9af1200; cold webhook route401 unauthorized; structured warning and doctor output complete and redacted: https://github.com/openclaw/openclaw/actions/runs/29627775967