fix(telegram,discord): respect STATE_DIR env vars in skill prompts#977
Open
snemesh wants to merge 2 commits intoanthropics:mainfrom
Open
fix(telegram,discord): respect STATE_DIR env vars in skill prompts#977snemesh wants to merge 2 commits intoanthropics:mainfrom
snemesh wants to merge 2 commits intoanthropics:mainfrom
Conversation
The /telegram:access and /telegram:configure skills hardcode ~/.claude/channels/telegram/ in 12 places. When TELEGRAM_STATE_DIR is set (multi-project setups), the skills read/write the wrong directory — pairing codes are not found, tokens are saved to the wrong .env, and allowlists don't match the running server. Both skills now resolve $STATE_DIR from the environment variable before any file operations, falling back to the default path when unset. No behavior change for single-channel setups. Fixes anthropics#931
|
The same issue is happening with DISCORD_STATE_DIR ;) |
Same fix as Telegram: replace 11 hardcoded ~/.claude/channels/discord/ paths in access and configure skills with $STATE_DIR resolved from DISCORD_STATE_DIR env var (fallback to default when unset). Fixes multi-bot setups where pairing codes, tokens, and allowlists were written to/read from the wrong directory. Reported by @gtapps in PR review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PR #792 added
TELEGRAM_STATE_DIRsupport toserver.ts, and Discord'sserver.tssimilarly supportsDISCORD_STATE_DIR. But the skill files for both channels were not updated — they hardcode~/.claude/channels/{telegram,discord}/paths.When running multiple bots (e.g. per-project), the server writes state to the correct directory via the env var, but the skills always read/write the default path. This means:
/access pair <code>looks up the code in the wrongaccess.json/configure <token>saves the token to the wrong.env/accessstatus shows the wrong allowlistFix
Both Telegram and Discord skills now resolve
$STATE_DIRfrom their respective env vars before any file operations, falling back to the default path when unset.No behavior change for single-channel setups (env var is unset → same default path).
Changes
Telegram (commit 1):
skills/access/SKILL.md— replaced 6 hardcoded paths, added state dir resolution blockskills/configure/SKILL.md— replaced 5 hardcoded paths, added state dir resolution blockDiscord (commit 2, reported by @gtapps):
skills/access/SKILL.md— replaced 6 hardcoded paths, added state dir resolution blockskills/configure/SKILL.md— replaced 5 hardcoded paths, added state dir resolution blockTest plan