Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

fixed telegram replies not being able to access context

Alishahryar1368671dfe500
diff --git a/messaging/handler.py b/messaging/handler.py
index 65ab9bdf..f5ca7e89 100644
--- a/messaging/handler.py
+++ b/messaging/handler.py
@@ -100,6 +100,10 @@ class ClaudeMessageHandler:
# Determine session ID for queuing
if session_id_to_resume:
queue_session_id = session_id_to_resume
+ # Index this message immediately so replies to IT work even while pending
+ self.session_store.index_message(
+ queue_session_id, incoming.message_id, incoming.platform
+ )
else:
# New session - use temp ID
queue_session_id = f"pending_{incoming.message_id}"
diff --git a/messaging/session.py b/messaging/session.py
index f7e84b48..eec582fa 100644
--- a/messaging/session.py
+++ b/messaging/session.py
@@ -153,6 +153,28 @@ class SessionStore:
key = self._make_key(platform, str(chat_id), str(msg_id))
return self._msg_to_session.get(key)
+ def index_message(
+ self, session_id: str, msg_id: str, platform: str = "telegram"
+ ) -> None:
+ """
+ Index an additional message ID for a session.
+
+ Args:
+ session_id: Claude session ID
+ msg_id: Message ID to index
+ platform: Messaging platform name
+ """
+ with self._lock:
+ if session_id not in self._sessions:
+ logger.warning(f"Session {session_id} not found for indexing message")
+ return
+
+ record = self._sessions[session_id]
+ key = self._make_key(platform, record.chat_id, str(msg_id))
+ self._msg_to_session[key] = session_id
+
+ logger.debug(f"Indexed extra message {msg_id} for session {session_id}")
+
def update_last_message(self, session_id: str, msg_id: str) -> None:
"""
Update the last message ID for a session.