mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 12:07:40 +00:00
Memory: handle SecretRef keys in doctor embeddings (#36835)
Merged via squash.
Prepared head SHA: c1a3d0caae
Co-authored-by: joshavant <830519+joshavant@users.noreply.github.com>
Co-authored-by: joshavant <830519+joshavant@users.noreply.github.com>
Reviewed-by: @joshavant
This commit is contained in:
@@ -135,10 +135,40 @@ describe("noteMemorySearchHealth", () => {
|
||||
await expectNoWarningWithConfiguredRemoteApiKey("openai");
|
||||
});
|
||||
|
||||
it("treats SecretRef remote apiKey as configured for explicit provider", async () => {
|
||||
resolveMemorySearchConfig.mockReturnValue({
|
||||
provider: "openai",
|
||||
local: {},
|
||||
remote: {
|
||||
apiKey: { source: "env", provider: "default", id: "OPENAI_API_KEY" },
|
||||
},
|
||||
});
|
||||
|
||||
await noteMemorySearchHealth(cfg, {});
|
||||
|
||||
expect(note).not.toHaveBeenCalled();
|
||||
expect(resolveApiKeyForProvider).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not warn in auto mode when remote apiKey is configured", async () => {
|
||||
await expectNoWarningWithConfiguredRemoteApiKey("auto");
|
||||
});
|
||||
|
||||
it("treats SecretRef remote apiKey as configured in auto mode", async () => {
|
||||
resolveMemorySearchConfig.mockReturnValue({
|
||||
provider: "auto",
|
||||
local: {},
|
||||
remote: {
|
||||
apiKey: { source: "env", provider: "default", id: "OPENAI_API_KEY" },
|
||||
},
|
||||
});
|
||||
|
||||
await noteMemorySearchHealth(cfg, {});
|
||||
|
||||
expect(note).not.toHaveBeenCalled();
|
||||
expect(resolveApiKeyForProvider).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("resolves provider auth from the default agent directory", async () => {
|
||||
resolveMemorySearchConfig.mockReturnValue({
|
||||
provider: "gemini",
|
||||
|
||||
@@ -6,6 +6,7 @@ import { formatCliCommand } from "../cli/command-format.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { resolveMemoryBackendConfig } from "../memory/backend-config.js";
|
||||
import { DEFAULT_LOCAL_MODEL } from "../memory/embeddings.js";
|
||||
import { hasConfiguredMemorySecretInput } from "../memory/secret-input.js";
|
||||
import { note } from "../terminal/note.js";
|
||||
import { resolveUserPath } from "../utils.js";
|
||||
|
||||
@@ -26,7 +27,7 @@ export async function noteMemorySearchHealth(
|
||||
const agentId = resolveDefaultAgentId(cfg);
|
||||
const agentDir = resolveAgentDir(cfg, agentId);
|
||||
const resolved = resolveMemorySearchConfig(cfg, agentId);
|
||||
const hasRemoteApiKey = Boolean(resolved?.remote?.apiKey?.trim());
|
||||
const hasRemoteApiKey = hasConfiguredMemorySecretInput(resolved?.remote?.apiKey);
|
||||
|
||||
if (!resolved) {
|
||||
note("Memory search is explicitly disabled (enabled: false).", "Memory search");
|
||||
|
||||
Reference in New Issue
Block a user