fix(doctor): avoid crash on SecretRef memory API keys#35491
fix(doctor): avoid crash on SecretRef memory API keys#35491dingn42 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes a crash in Key changes:
One minor coverage gap worth noting: the Confidence Score: 5/5
Last reviewed commit: b1ae802 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1ae80234d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const resolved = resolveMemorySearchConfig(cfg, agentId); | ||
| const hasRemoteApiKey = Boolean(resolved?.remote?.apiKey?.trim()); | ||
| const remoteApiKey = resolved?.remote?.apiKey; | ||
| const hasRemoteApiKey = typeof remoteApiKey === "string" && remoteApiKey.trim().length > 0; |
There was a problem hiding this comment.
Treat SecretRef memory API keys as configured
noteMemorySearchHealth now only treats remote.apiKey as present when it is a string, so a valid SecretRef object on agents.*.memorySearch.remote.apiKey is classified as missing and falls through to hasApiKeyForProvider(...). In setups that rely on SecretRef-backed memory credentials (supported by the config schema via SecretInputSchema), openclaw doctor will incorrectly emit the “no API key was found” warning whenever no profile/env key is present, even though memory search is configured. This should use a SecretInput-aware presence check instead of a string-only trim check.
Useful? React with 👍 / 👎.
|
Thanks for the contribution here, and for helping narrow down the SecretRef doctor crash. We merged #36835, which supersedes this PR and fixes the broader doctor/memory SecretRef surface in one place, including the related runtime embedding paths. I’m closing this as superseded by #36835, but I appreciate the fix and the investigation that went into it. |
Summary
openclaw doctorso non-string values do not call.trim()remote.apiKeyobjectsTesting
pnpm test -- src/commands/doctor-memory-search.test.tsFixes #35444