Description
The PICOCLAW_GATEWAY_TOKEN environment variable is commonly assumed to control WebSocket authentication for the /pico/ws channel. However, this is misleading:
PICOCLAW_GATEWAY_TOKEN only controls health check and reload endpoints (/health, /reload)
- The
/pico/ws channel authentication is controlled by .security.yml, specifically the channels.pico.token field
- At runtime, PicoClaw applies a token override mechanism that prepends
"pico-" plus a PID-based random token to the configured value
- This dual-token system is undocumented, making it extremely difficult to integrate PicoClaw with external orchestration systems
This caused significant debugging effort in our deployment because all documentation and typical usage patterns suggest PICOCLAW_GATEWAY_TOKEN should be the source of truth for gateway authentication.
Steps to Reproduce
- Deploy PicoClaw with
PICOCLAW_GATEWAY_TOKEN=my-secret-token set
- Attempt to connect to
/pico/ws using the token my-secret-token in the WebSocket handshake
- Connection fails with 401 Unauthorized
- Inspect
.security.yml and .picoclaw.pid files
- Observe that the actual required token is
pico-{random-pid-token}{configured-channel-token}
Expected vs Actual Behavior
Expected: PICOCLAW_GATEWAY_TOKEN is the authoritative token for all gateway authentication (including /pico/ws), or the documentation clearly states which env vars control which endpoints.
Actual: PICOCLAW_GATEWAY_TOKEN only affects health/reload endpoints. The /pico/ws token is constructed at runtime from .security.yml plus a PID-based override, making it impossible to predict without reading generated files.
Suggested Fix
- Update README and config examples to clearly document which env vars control which endpoints
- Document the token override mechanism (
overridePicoToken) and how it constructs the final token
- Consider adding a config option to disable the PID-based token override for external orchestration use cases
Description
The
PICOCLAW_GATEWAY_TOKENenvironment variable is commonly assumed to control WebSocket authentication for the/pico/wschannel. However, this is misleading:PICOCLAW_GATEWAY_TOKENonly controls health check and reload endpoints (/health,/reload)/pico/wschannel authentication is controlled by.security.yml, specifically thechannels.pico.tokenfield"pico-"plus a PID-based random token to the configured valueThis caused significant debugging effort in our deployment because all documentation and typical usage patterns suggest
PICOCLAW_GATEWAY_TOKENshould be the source of truth for gateway authentication.Steps to Reproduce
PICOCLAW_GATEWAY_TOKEN=my-secret-tokenset/pico/wsusing the tokenmy-secret-tokenin the WebSocket handshake.security.ymland.picoclaw.pidfilespico-{random-pid-token}{configured-channel-token}Expected vs Actual Behavior
Expected:
PICOCLAW_GATEWAY_TOKENis the authoritative token for all gateway authentication (including/pico/ws), or the documentation clearly states which env vars control which endpoints.Actual:
PICOCLAW_GATEWAY_TOKENonly affects health/reload endpoints. The/pico/wstoken is constructed at runtime from.security.ymlplus a PID-based override, making it impossible to predict without reading generated files.Suggested Fix
overridePicoToken) and how it constructs the final token