fix(gateway-status): downgrade SecretRef warning when gateway probe succeeds#45549
fix(gateway-status): downgrade SecretRef warning when gateway probe succeeds#45549reed1898 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
When the gateway probe succeeds, the CLI-side SecretRef resolution diagnostic is misleading — the secret is resolved at runtime but the CLI process cannot read it (e.g. env var only available to the gateway daemon). This commit: - Introduces auth_secretref_cli_only code for healthy-gateway cases - Displays these diagnostics as muted 'Note:' instead of 'Warning:' - Preserves auth_secretref_unresolved for genuinely broken gateways - Adds test coverage for both healthy and unhealthy probe scenarios
Greptile SummaryThis PR addresses a false-positive Changes:
Points to consider:
Confidence Score: 4/5
|
| @@ -304,13 +314,22 @@ export async function gatewayStatusCommand( | |||
| ); | |||
| runtime.log(colorize(rich, theme.muted, `Probe budget: ${overallTimeoutMs}ms`)); | |||
|
|
|||
| if (warnings.length > 0) { | |||
| const actualWarnings = warnings.filter((w) => w.code !== "auth_secretref_cli_only"); | |||
| const infoNotes = warnings.filter((w) => w.code === "auth_secretref_cli_only"); | |||
There was a problem hiding this comment.
Magic string "auth_secretref_cli_only" repeated in three places
The string "auth_secretref_cli_only" is hardcoded at line 236 (push), line 317 (filter !==), and line 318 (filter ===). A one-character typo in any of the three will silently break the separation logic — notes would appear as warnings or vice-versa, with no compile-time or runtime error. Extracting it to a local or module-level constant eliminates the risk.
const AUTH_SECRETREF_CLI_ONLY = "auth_secretref_cli_only";
// line ~236
code: AUTH_SECRETREF_CLI_ONLY,
// lines ~317-318
const actualWarnings = warnings.filter((w) => w.code !== AUTH_SECRETREF_CLI_ONLY);
const infoNotes = warnings.filter((w) => w.code === AUTH_SECRETREF_CLI_ONLY);Prompt To Fix With AI
This is a comment left during a code review.
Path: src/commands/gateway-status.ts
Line: 235-318
Comment:
**Magic string `"auth_secretref_cli_only"` repeated in three places**
The string `"auth_secretref_cli_only"` is hardcoded at line 236 (push), line 317 (filter `!==`), and line 318 (filter `===`). A one-character typo in any of the three will silently break the separation logic — notes would appear as warnings or vice-versa, with no compile-time or runtime error. Extracting it to a local or module-level constant eliminates the risk.
```ts
const AUTH_SECRETREF_CLI_ONLY = "auth_secretref_cli_only";
// line ~236
code: AUTH_SECRETREF_CLI_ONLY,
// lines ~317-318
const actualWarnings = warnings.filter((w) => w.code !== AUTH_SECRETREF_CLI_ONLY);
const infoNotes = warnings.filter((w) => w.code === AUTH_SECRETREF_CLI_ONLY);
```
How can I resolve this? If you propose a fix, please make it concise.|
Thanks for the PR, @reed1898. Closing this as superseded by #47794. How it relates to your PR:
Appreciate your contribution and the direction you pushed here. |
Problem
When the gateway is running and healthy,
openclaw gateway statusstill shows aWarning:about unresolved SecretRef forgateway.auth.token. This is a false positive — the secret (e.g.,env:GATEWAY_TOKEN) is resolved at gateway runtime but is not readable from the CLI process context (the env var may only be set in the gateway's LaunchAgent/systemd environment).This confuses users into thinking their auth config is broken when everything is actually working fine.
Fix
probe.ok === true), SecretRef diagnostics are downgraded fromauth_secretref_unresolved(Warning) toauth_secretref_cli_only(Note)(gateway is healthy; secrets are resolved at runtime)for clarityauth_secretref_unresolvedwarning is preserved — this is a genuine problemTests
keeps auth_secretref_unresolved code when gateway probe fails— verifies warnings are preserved for unhealthy gatewaysAll 13 gateway-status tests pass locally.