Skip to content

Commit 5c3b25d

Browse files
committed
fix(memory-core): direct leaked-key remediation to auth-profile rotation
Auth profiles resolve before env-var fallback, so suggesting GEMINI_API_KEY/ OPENAI_API_KEY/VOYAGE_API_KEY env-only rotation can leave a stale profile winning. Drop env-var hints; point to `openclaw configure` plus gateway restart. Addresses Codex P2 finding on #75951.
1 parent b3a98eb commit 5c3b25d

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

extensions/memory-core/src/cli.runtime.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,33 +81,25 @@ function resolveEmbeddingErrorKind(error: string): "leaked" | "quota" | "invalid
8181
return null;
8282
}
8383

84-
function resolveEmbeddingErrorRemediation(error: string, provider?: string): string | null {
84+
function resolveEmbeddingErrorRemediation(error: string): string | null {
8585
const kind = resolveEmbeddingErrorKind(error);
8686
if (!kind) {
8787
return null;
8888
}
8989
switch (kind) {
9090
case "leaked": {
91-
const keyEnvHint =
92-
provider === "gemini" || provider === "google"
93-
? "GEMINI_API_KEY"
94-
: provider === "openai"
95-
? "OPENAI_API_KEY"
96-
: provider === "voyage"
97-
? "VOYAGE_API_KEY"
98-
: null;
9991
const steps = [
10092
"Your API key was flagged as leaked by the provider.",
10193
"1. Generate a new API key from your provider's console.",
102-
`2. Update it: openclaw configure (or set ${keyEnvHint ?? "the API key env var"} and restart the gateway).`,
94+
"2. Rotate the stored auth profile: openclaw configure (env-var fallback alone is unreliable while a stale auth profile is selected).",
10395
"3. Restart the gateway: openclaw gateway restart",
10496
];
10597
return steps.join(" ");
10698
}
10799
case "quota":
108100
return "Embedding provider quota exhausted. Wait and retry, or switch provider via: openclaw configure";
109101
case "invalid_key":
110-
return "API key is invalid or expired. Update it via: openclaw configure";
102+
return "API key is invalid or expired. Update the stored auth profile via: openclaw configure";
111103
default:
112104
return null;
113105
}
@@ -890,7 +882,7 @@ export async function runMemoryStatus(opts: MemoryCommandOptions) {
890882
lines.push(`${label("Embeddings")} ${colorize(rich, stateColor, state)}`);
891883
if (embeddingProbe.error) {
892884
lines.push(`${label("Embeddings error")} ${warn(embeddingProbe.error)}`);
893-
const remediation = resolveEmbeddingErrorRemediation(embeddingProbe.error, status.provider);
885+
const remediation = resolveEmbeddingErrorRemediation(embeddingProbe.error);
894886
if (remediation) {
895887
lines.push(`${label("Fix")} ${muted(remediation)}`);
896888
}

0 commit comments

Comments
 (0)