-
Notifications
You must be signed in to change notification settings - Fork 274
Open
Description
Summary
When using project threads mode (group), messages sent to different topics are processed sequentially. This means a long-running Claude task in one project topic blocks all other topics until it completes.
Proposed Change
Enable concurrent message processing so that messages in different project topics are handled in parallel. Each topic/handler gets its own isolated snapshot of thread state (working directory, session ID, thread context) to avoid race conditions.
Key Design Decisions
- Per-update state isolation:
context.user_datais shared per-user, so concurrent handlers for different topics would overwrite each other's values. Thread state is stored in a per-update dictionary on the orchestrator instance, keyed byupdate.update_id. - Note:
telegram.Updateuses__slots__, so arbitrary attributes cannot be set on it directly — an instance-level dictionary is used instead. - Claude Code internal paths: Concurrent processing surfaces more tool-result reads (
~/.claude/projects/,/tmp/claude-<uid>/). These paths need to be whitelisted in_CLAUDE_INTERNAL_SUBDIRSalongsideplansandtodos.
I have an implementation ready at https://github.com/tschuehly/claude-code-telegram/tree/fix/concurrent-topic-processing and can open a PR.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels