Skip to content

fix(transcription): fall back to a user cache when the working directory is not writable - #347

Merged
chigwell merged 1 commit into
chigwell:mainfrom
axisrow:fix/transcript-cache-dir
Oct 21, 2026
Merged

chigwell merged 1 commit into
chigwell:mainfrom
axisrow:fix/transcript-cache-dir

Conversation

@axisrow

@axisrow axisrow commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Summary

The transcript cache defaults to the relative path data/transcripts, created eagerly in cache_dir(). When an installed telegram-mcp is launched by an MCP client whose working directory is not writable (/, /usr, a read-only container layer), mkdir raises OSError and every listing that happens to contain a voice message fails.

The default path now falls back to ~/.cache/telegram-mcp/transcripts when the working directory is not writable; an explicit TELEGRAM_TRANSCRIPT_CACHE_DIR is 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.py covers 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.
  • Full suite: 1410 passed.

🤖 Generated with Claude Code

…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
chigwell merged commit 56b21b7 into chigwell:main Oct 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants