Repository navigation
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Description
Summary
On macOS (LaunchAgent), openclaw gateway install --force regenerates ~/.openclaw/service-env/ai.openclaw.gateway.env but does not export MINIMAX_API_KEY, even though:
MINIMAX_API_KEYis present and non-empty in~/.openclaw/.envMINIMAX_API_KEYappears inOPENCLAW_SERVICE_MANAGED_ENV_KEYS- Other managed keys (e.g.
MINIMAX_WEBSEARCH_API_KEY,DEEPSEEK_API_KEY,OPENROUTER_API_KEY) are exported correctly
The gateway then crashes immediately on startup:
SecretRefResolutionError: Environment variable "MINIMAX_API_KEY" is missing or empty.
Environment
- OpenClaw version: 2026.6.1 (2e08f0f)
- OS: macOS 26.5 (arm64)
- Node: 22.22.3 (via nvm); LaunchAgent uses
/opt/homebrew/bin/node - Service: LaunchAgent
ai.openclaw.gateway.plist, port 18789
Config context
models.providers.minimax-openai.apiKey uses a proper env SecretRef:
"apiKey": {
"source": "env",
"provider": "default",
"id": "MINIMAX_API_KEY"
}(MINIMAX_WEBSEARCH_API_KEY in the minimax plugin uses the same SecretRef shape and does get exported.)
Reproduction
# Confirm key exists in .env
grep '^MINIMAX_API_KEY=' ~/.openclaw/.env # non-empty
# Regenerate service env
openclaw gateway install --force
# MINIMAX_API_KEY missing from exports:
grep '^export MINIMAX_API_KEY=' ~/.openclaw/service-env/ai.openclaw.gateway.env || echo MISSING
# Gateway fails to start
openclaw gateway restart
openclaw gateway status --deep
# Runtime: stopped, Connectivity probe: failed, ECONNREFUSED :18789Latest stability bundle message:
Startup failed: required secrets are unavailable.
SecretRefResolutionError: Environment variable "MINIMAX_API_KEY" is missing or empty.
Impact
- LaunchAgent enters a crash loop; agent integrations lose connectivity
- Watchdog recovery that only runs
install --forcere-triggers the bug on every attempt - Manual workaround: append
export MINIMAX_API_KEY='...'to service-env after everyinstall --force
Suggested fix
Ensure gateway install exports every key listed in OPENCLAW_SERVICE_MANAGED_ENV_KEYS when a non-empty value exists in ~/.openclaw/.env, with no special-casing that skips MINIMAX_API_KEY.
Reacted by clawsweeper
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Type
Fields
Priority
None yet
Activity
clawsweeper commentedon Jun 4, 2026
Thanks for the context here. I did a careful shell check against current
main, and this is already implemented.Close: current main contains the generic placeholder-filtering fix and regression coverage for the reported macOS LaunchAgent service-env loss, and the fix was released in v2026.6.5.
I found the merged PR that appears to have closed this: #90488: fix service env placeholder collection.
So I’m closing this as already implemented rather than keeping a duplicate issue open.
Review details
Best possible solution:
Keep the merged generic placeholder-filtering behavior and close this report as fixed, with any future service-env regressions filed as fresh issues with current-version proof.
Do we have a high-confidence way to reproduce the issue?
Yes for the original shipped failure: the issue gives exact macOS LaunchAgent steps, and the merged regression test exercises the same service-env planning path with an unresolved
MINIMAX_API_KEYself-reference. On current main, that path now preserves the.envvalue instead of reproducing the failure.Is this the best way to solve the issue?
Yes. The merged generic config-env placeholder filter is the narrow maintainable fix because it avoids MiniMax-specific special casing and prevents unresolved placeholder strings from masking durable
.envsecrets.Security review:
Security review: This is a non-PR issue cleanup; no proposed patch security review is needed here.
AGENTS.md: found and applied where relevant.
What I checked:
AGENTS.md:28, 8682d0701b27)collectConfigEnvVarsByTargetskips values containing unresolved env-var references in bothenv.varsand top-level config env keys, preventing${MINIMAX_API_KEY}from masking the state-dir.envvalue. (src/config/config-env-vars.ts:34, 8682d0701b27)MINIMAX_API_KEYto the state-dir.env, configures an unresolved self-reference plus a MiniMax env SecretRef, plans a Darwin install, and asserts the key is exported withOPENCLAW_SERVICE_MANAGED_ENV_KEYS. (src/commands/daemon-install-helpers.test.ts:1183, 8682d0701b27).env, config env, SecretRef env, exec passEnv, and auth-profile env sources before formatting managed keys and applying the LaunchAgent render policy. (src/commands/daemon-install-helpers.ts:529, 8682d0701b27)git showshows it added the placeholder filtering and the focused regression tests, while its parent lacked the placeholder skip. (src/config/config-env-vars.ts:34, 7ac1eeb12220).envvalues, referencing this issue and the merged fix PR. (5181e4f7c82b)Likely related people:
src/config/config-env-vars.ts,src/config/config.env-vars.test.ts,src/commands/daemon-install-helpers.test.ts)src/commands/daemon-install-helpers.ts,src/daemon/service-env-render-policy.ts,src/daemon/service-managed-env.ts)src/commands/daemon-install-helpers.ts,src/commands/daemon-install-helpers.test.ts)Codex review notes: model internal, reasoning high; reviewed against 8682d0701b27; fix evidence: merged PR #90488, release v2026.6.5, commit 7ac1eeb12220.
fix(container): update image ghcr.io/openclaw/openclaw (2026.6.1 ➔ 20…