You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: Fixes #1490: the local viewer in apps/memos-local-openclaw was reading openclaw.json directly in three paths (handleTestModel, serveFallbackModel, runMigration) without expanding ${VAR} env-var literals. Users who stored secrets in their config as "apiKey": "${MY_API_KEY}" saw 401s because the literal placeholder ended up in the Bearer header. resolveConfig() already had a deepResolveEnv() helper, but it was private and only applied to the in-memory plugin context.
The fix exports deepResolveEnv / resolveEnvVars from src/config.ts, adds readPluginConfigResolved / readOpenClawResolvedConfig helpers in ViewerServer, and routes every "about-to-call-the-network" string (apiKey/endpoint/baseUrl in the migration summarizer, fallback model probe, and embedding/chat test endpoints) through the resolver. serveConfig is intentionally left raw so the UI can still display ${VAR} literals for editing — secrets never round-trip back into the file.
Test plan: added tests/viewer-env-resolution.test.ts (4 cases) covering test-model env expansion, fallback-model env expansion, the new resolved-config helper, and the raw-passthrough property of serveConfig. All 4 pass. Full vitest suite: 226 pass / 5 fail, where the 5 failures (accuracy, skill-auto-install, task-processor, update-install) reproduce identically on unmodified dev-20260615-v2.0.20 (confirmed via git stash baseline) and depend on the local huggingface embedding cache / fake-timer process.kill timing — unrelated to this change. tsc build passes clean.
Activity
[-]fix: 本地viewer不会解析配置文件[/-][+]fix: 本地viewer不会解析配置文件的环境变量[/+]fix(openclaw): resolve environment variables in Viewer config API
fix(openclaw): resolve environment variables in Viewer config API
MaiHHConnect commentedon Apr 19, 2026
Memtensor-AI commentedon Jun 30, 2026
🤖 AutoDev has picked up this issue and started working on it.
Task ID:
750b19581f7f5526Working branch:
bugfix/autodev-1490Target branch:
latest dev* branchWorkflow: opsp (analysis → coding → testing → PR)
I will post the PR link here once done. If I need more information, I will ask in the comments.
fix(viewer): resolve ${VAR} env vars in local viewer config paths
Memtensor-AI commentedon Jun 30, 2026
✅ AutoDev task
750b19581f7f5526completed.Summary: Fixes #1490: the local viewer in
apps/memos-local-openclawwas readingopenclaw.jsondirectly in three paths (handleTestModel,serveFallbackModel,runMigration) without expanding${VAR}env-var literals. Users who stored secrets in their config as"apiKey": "${MY_API_KEY}"saw 401s because the literal placeholder ended up in the Bearer header.resolveConfig()already had adeepResolveEnv()helper, but it was private and only applied to the in-memory plugin context.The fix exports
deepResolveEnv/resolveEnvVarsfromsrc/config.ts, addsreadPluginConfigResolved/readOpenClawResolvedConfighelpers inViewerServer, and routes every "about-to-call-the-network" string (apiKey/endpoint/baseUrl in the migration summarizer, fallback model probe, and embedding/chat test endpoints) through the resolver.serveConfigis intentionally left raw so the UI can still display${VAR}literals for editing — secrets never round-trip back into the file.Test plan: added
tests/viewer-env-resolution.test.ts(4 cases) covering test-model env expansion, fallback-model env expansion, the new resolved-config helper, and the raw-passthrough property ofserveConfig. All 4 pass. Full vitest suite: 226 pass / 5 fail, where the 5 failures (accuracy,skill-auto-install,task-processor,update-install) reproduce identically on unmodifieddev-20260615-v2.0.20(confirmed viagit stashbaseline) and depend on the local huggingface embedding cache / fake-timer process.kill timing — unrelated to this change.tscbuild passes clean.Base branch:
mainBranch:
bugfix/autodev-1490Commit:
5386365PR: #1984
Assigned to: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
Reviewers: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
Fix #1490: fix: 本地viewer不会解析配置文件的环境变量 (#1984)