Skip to content

feat(telegram): pin incoming user message for duration of agent turn#28539

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6063e704
May 19, 2026
Merged

feat(telegram): pin incoming user message for duration of agent turn#28539
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6063e704

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #26636 (@indigokarasu). Adds automatic pinning of incoming Telegram messages for the duration of an agent turn. When a user sends a message, it's pinned at the start of processing and unpinned when the agent finishes its response — visual indicator that the message is being worked on.

Authorship preserved via cherry-pick. 41/41 thread-fallback tests passing.

indigokarasu and others added 2 commits May 18, 2026 22:57
When a user sends a message on Telegram, the incoming message is now
automatically pinned at the start of processing and unpinned when the
agent finishes its turn. This gives the user a visual indicator that
their message is being worked on, and keeps the conversation anchored.

Changes:
- telegram.py: Added pinChatMessage in on_processing_start and
  unpinChatMessage in on_processing_complete. Restructured both
  hooks so pin/unpin runs independently of the reactions feature
  (reactions are optional; pinning is always on).
- telegram.py: Pass message_id through SessionSource so it's
  available in the session context.
- session_context.py: Added HERMES_SESSION_MESSAGE_ID context var.
- run.py: Pass source.message_id through set_session_vars.

Pinning is silent (disable_notification=True) and failures are
logged at debug level without interrupting message processing.
Only the user's incoming message is pinned -- never the agent's
replies. Auto-resume events (which have no message_id) are
correctly skipped.
@teknium1 teknium1 merged commit 6265b3a into main May 19, 2026
@teknium1 teknium1 deleted the hermes/hermes-6063e704 branch May 19, 2026 05:57
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-6063e704 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8951 on HEAD, 8951 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4701 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/feature New feature or request platform/telegram Telegram bot adapter comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have labels May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have platform/telegram Telegram bot adapter type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants