Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

v5.0.0 upgrade silently loses Telegram bot credentials — Pulse telegram component crash-loops with "No bot token"

Open jmmarkiewicz opened this issue 7 months ago • 1 comments

Summary

Users upgrading from PAI 4.x to 5.0 silently lose their Telegram bot credentials. The 4.x install stored the bot token at ~/.claude/channels/telegram/.env. PAI 5.0 reads from ~/.claude/.env (new path, see PAI/PULSE/pulse.ts:27). Neither the migration nor the installer copies the token across, and ~/.claude/channels/ is removed entirely. Pulse's telegram component then crash-loops every 10 seconds:

{"level":"error","component":"telegram","msg":"No bot token — set bot_token in config or TELEGRAM_BOT_TOKEN in env"}
{"level":"info","msg":"telegram exited cleanly, restarting in 10s"}

Pulse appears healthy at the daemon level (port 31337 binds, /healthz returns 200), so users with [telegram] enabled in PULSE.toml don't notice the channel is dead until they actively look at logs or wonder why a routine notification didn't fire.

Symptom

  • pulse-stdout.log fills with one error every 10 seconds (the restartIntervalMs)
  • All cron jobs with output = "telegram" silently no-op (dispatchSingle checks env presence and returns when missing — no error, no fallback)
  • Two-way Telegram (the in-Pulse polling bot) never starts

Reproduce

On a Mac that previously ran PAI 4.x with ~/.claude/channels/telegram/.env:

ls ~/.claude.backup-*/channels/telegram/.env   # token still here in backup
ls ~/.claude/channels/telegram/.env            # gone after migration
ls ~/.claude/.env                              # also missing — never created
tail -20 ~/.claude/PAI/PULSE/logs/pulse-stdout.log | grep -i telegram   # crash loop

Root cause

  • PAI 4.x: token sourced from ~/.claude/channels/telegram/.env (loaded by an older Pulse env-loader path; also read by the standalone claude-plugins-official/external_plugins/telegram plugin's /telegram:configure skill).
  • PAI 5.0: PAI/PULSE/pulse.ts:27 loads ~/.claude/.env instead.
  • The 5.0.0 release tarball ships no channels/ directory, and the installer (PAI/PAI-Install/engine/actions.ts) does not detect a backup channels/telegram/.env and copy the token across.

Workaround

mkdir -p ~/.claude
cp ~/.claude.backup-*/channels/telegram/.env ~/.claude/.env
# Append the chat ID — read it from the legacy access.json if present
CHAT_ID=$(jq -r '.allowFrom[0]' ~/.claude.backup-*/channels/telegram/access.json 2>/dev/null)
[ -n "$CHAT_ID" ] && printf "TELEGRAM_PRINCIPAL_CHAT_ID=%s\n" "$CHAT_ID" >> ~/.claude/.env
chmod 600 ~/.claude/.env
launchctl kickstart -k "gui/$(id -u)/com.pai.pulse"

Suggested fix

In the installer (or /migrate workflow), detect a backup channels/telegram/.env and migrate two values into the new ~/.claude/.env:

  1. TELEGRAM_BOT_TOKEN from the legacy .env
  2. TELEGRAM_PRINCIPAL_CHAT_ID from the legacy channels/telegram/access.json (allowFrom[0])

chmod 600 the result. Optionally restore ~/.claude/channels/telegram/{access.json,inbox/,approved/} for users still on the legacy plugin path (the /telegram:configure and /telegram:access skills assume those exist).

Sibling to #1141 (skill loss) — same class: silent loss of user state during the 4.x → 5.0 migration.

Environment

macOS 15.x (Darwin 25.5.0), Bun 1.3.9, PAI v4.0.3 → v5.0.0 in-place upgrade.

jmmarkiewicz avatar May 02 '26 18:05 jmmarkiewicz

Hey @jmmarkiewicz, thanks for raising this, and sorry it sat for a while.

We're changing how LifeOS ships. Instead of cloning a full ~/.claude directory and running it as a complete system, LifeOS is becoming a skill you install through an agentic installer. The installer hands integration to your own AI, which reads your actual machine (your OS, your paths, your harness) and wires the hooks and system prompt in where they belong.

That's aimed right at what you hit here. The old "one directory, one layout, hope it matches your setup" approach is exactly what broke for so many people, and the new model should handle it far better because your AI does the integration per machine instead of us guessing.

So we're closing this in prep for that release. If it still bites you once the skill-based version is out, reopen or file a fresh one and we'll jump on it. Appreciate you taking the time.

danielmiessler avatar Jun 21 '26 03:06 danielmiessler