Hermes fleet messaging token isolation
When
Setting up Bitwarden Secrets Manager (or any bulk secret source) across multiple Hermes hosts/profiles that use Telegram/Discord/Slack bots, or any credential that must differ per host.
Hard rule
Never store a single shared TELEGRAM_BOT_TOKEN (or other messaging bot token) in a fleet-wide vault project that every host pulls with override_existing: true.
That pattern makes every gateway the same bot → Telegram getUpdates Conflict → one host "wins," others go silent, and crons/DMs cross-wire (host B's cron replies appear as host A's bot).
Correct pattern (Hermes-native)
Hermes auto-aliases profile-scoped credential secrets:
- Vault keys:
TELEGRAM_BOT_TOKEN_<PROFILE>(profile name uppercased,-→_) - Active profile
work→TELEGRAM_BOT_TOKEN_WORKis applied asTELEGRAM_BOT_TOKEN - Profile name
defaultdoes not get a suffix alias — use an unsuffixed local.envvalue, or run a named profile.
Shared vault is still fine for secrets that should be identical (provider API keys, etc.).
Per-host secret aliasing gotchas
- Aliasing applies only to credential-shaped names (ending in
_API_KEY,_TOKEN,_SECRET,_KEY, or_PASSWORD). A vault secretFOO_<PROFILE>is applied asFOOfor the active profile. - A generic
FOOin the same project blocks the alias. An alias never shadows a variable some source supplies under its real name, so every host silently gets the generic value. For per-host keys (messaging tokens, a per-host memory API key), store onlyFOO_<PROFILE>entries and delete the genericFOO. - Bitwarden secrets apply after
~/.hermes/.envwithoverride_existing: trueby default, so a stale vault value beats.env. Fix the vault value; don't disable override.
Checklist
- One Telegram bot per messaging identity / host (BotFather).
- Store
TELEGRAM_BOT_TOKEN_<PROFILE>per profile in Bitwarden — not bareTELEGRAM_BOT_TOKENin a shared project. - Confirm on gateway start: log line
applied profile-scoped TELEGRAM_BOT_TOKEN_… as TELEGRAM_BOT_TOKEN. - Smoke:
getMeusername matches the intended bot; noConflict: terminated by other getUpdates. - Only one process may poll a given bot token (no second gateway/sidecar on the same token).
- For every per-host credential, confirm the vault has no generic entry with the bare name.
Recovery if already broken
- Fingerprint each host's live bot via Telegram
getMe(never print tokens). - Restore correct tokens from pre-sweep
.envbackups. - Delete the shared vault
TELEGRAM_BOT_TOKEN(and any other generic per-host key); create per-profile keys. - Clear
bws_cache.jsonTelegram entries; restart gateways gracefully; re-verify.