Repository navigation
fix(transcription): fall back to a user cache when the working directory is not writable - #347
Merged
Merged
Conversation
…ory is not writable The transcript cache defaulted to the relative path data/transcripts. When an MCP client starts the installed telegram-mcp script, the working directory is often / or another read-only folder, the unguarded mkdir raised PermissionError inside voice_attachment_info, and list_messages/get_history/get_messages failed for every chat that contained a voice message or video circle. Without TELEGRAM_TRANSCRIPT_CACHE_DIR, fall back to ~/.cache/telegram-mcp/transcripts when the default cannot be created. An explicitly configured directory still fails loudly. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018Xun6C4mXUAKbVSmiEEh79
chigwell
approved these changes
Oct 21, 2026
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.
Summary
The transcript cache defaults to the relative path
data/transcripts, created eagerly incache_dir(). When an installedtelegram-mcpis launched by an MCP client whose working directory is not writable (/,/usr, a read-only container layer),mkdirraisesOSErrorand every listing that happens to contain a voice message fails.The default path now falls back to
~/.cache/telegram-mcp/transcriptswhen the working directory is not writable; an explicitTELEGRAM_TRANSCRIPT_CACHE_DIRis honored as before and never silently redirected. The 700/600 permission hardening applies to the fallback too. README updated to describe both defaults.Testing
tests/test_transcription.pycovers the read-only-cwd fallback (chdir to a read-only parent, assert the user-cache path is used) and that an explicit env var wins.🤖 Generated with Claude Code