Conversation
…er pod restart - Fresh install: set only gateway.remote.token (gateway uses OPENCLAW_GATEWAY_TOKEN env var directly) - Existing install: sync both gateway.auth.token and gateway.remote.token for backward compatibility - If OPENCLAW_GATEWAY_TOKEN is not set, skip token sync entirely (non-Helm deployments unaffected) Closes #22
|
Thanks—this looks like a solid fix. A few suggestions to make the behavior clearer and easier to operate long-term:
|
…logic gateway uses env-first precedence (OPENCLAW_GATEWAY_TOKEN > gateway.auth.token), so writing auth.token to config is redundant. Remove IS_FRESH distinction and only sync gateway.remote.token on every pod start.
Closes #22
The Problem (Issue #22)
On a fresh Helm install, the init container copies
openclaw.jsonfrom the ConfigMap (which is rendered from.Values.configinvalues.yaml) onto the PVC. The gateway starts fine.But after a pod restart, the init container skips the copy (file already exists on PVC), so
gateway.remote.tokenstays stale or unset — while the gateway process always reads its auth token fresh fromOPENCLAW_GATEWAY_TOKENenv var.Why Only
remote.tokenNeeds SyncingThe gateway resolves its own auth token with env-first precedence:
So
gateway.auth.tokeninopenclaw.jsonis irrelevant whenOPENCLAW_GATEWAY_TOKENis set. Only the CLI needsgateway.remote.tokenin config to know what token to present.The Fix (This PR)
Run the sync on every pod start, not just first start:
Non-Helm deployments are unaffected — the sync block is guarded by
[ -n "$OPENCLAW_GATEWAY_TOKEN" ].Impact
OPENCLAW_GATEWAY_TOKENremote.tokensynced on every pod startOPENCLAW_GATEWAY_TOKENNote: This is a Helm-layer Workaround
The root cause is an asymmetry in the upstream codebase: the gateway reads its auth token from env var, while the CLI reads it from
openclaw.json. The proper fix would be for the CLI to also preferOPENCLAW_GATEWAY_TOKENovergateway.remote.tokenin config (env-first on the client side), eliminating the need for any sync logic here.This PR patches the problem at the Helm layer until upstream adopts that approach. The sync script can be removed from this chart once the upstream CLI supports env-first credential resolution.