fix(memos-local-openclaw): resolve SecretRef apiKey in OpenClaw fallb…#1345
Merged
hijzy merged 2 commits intoMemTensor:openclaw-local-plugin-20260324from Mar 25, 2026
Merged
Conversation
…ack config Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
loadOpenClawFallbackConfigreadsopenclaw.jsonto build the final fallback LLM config when the plugin's configured summarizer model fails. Previously, it assumedapiKeyinmodels.providersis always a plain string. However, OpenClaw's credential system also supportsSecretRefformat ({ source: "env", id: "ENV_VAR_NAME" }), which was not resolved — causing either silent fallback skip (when treated as truthy object passing the check but failing HTTP auth) or incorrect availability detection in the viewer.This PR adds
resolveApiKey()to properly handle both plain string and env-sourcedSecretRefAPI keys in three locations:src/ingest/providers/index.ts— Summarizer fallback chainsrc/shared/llm-call.ts— Skill pipeline fallback chainsrc/viewer/server.ts— Viewer fallback model availability checkThe implementation mirrors the existing
resolveApiKeyinsrc/openclaw-api.ts(used by the host model proxy path).Related Issue (Required): Fixes #
Type of change
How Has This Been Tested?
openclaw.jsonwith a SecretRef-style apiKey inmodels.providers:{ "agents": { "defaults": { "model": { "primary": "anthropic/claude-3-haiku-20240307" } } }, "models": { "providers": { "anthropic": { "baseUrl": "https://api.anthropic.com", "apiKey": { "source": "env", "id": "ANTHROPIC_API_KEY" } } } } }ANTHROPIC_API_KEYin environment.Checklist
Reviewer Checklist