Repository navigation
feat(messaging): mirror local-surface turns (Desktop/TUI/dashboard) back to the platform chat - #111631
Open
Maziyang2 wants to merge 4 commits into
Open
feat(messaging): mirror local-surface turns (Desktop/TUI/dashboard) back to the platform chat#111631Maziyang2 wants to merge 4 commits into
Maziyang2 wants to merge 4 commits into
Conversation
11 of 12 tasks
Maziyang2
force-pushed
the
feat/telegram-mirror-local-turns
branch
from
September 19, 2026 17:28
b632378 to
737c3e7
Compare
Author
|
Follow-up commit Why this mattersA Desktop/TUI/dashboard turn should not disappear from the platform chat because the standalone send raced a process exit or gateway restart. This keeps the mirror asynchronous while making the delivery obligation durable and recoverable. What changed
Verification
This is intentionally a focused follow-up commit on #111631 rather than adding more scope to #110611. |
Maziyang2
force-pushed
the
feat/telegram-mirror-local-turns
branch
2 times, most recently
from
September 23, 2026 19:35
fd41b18 to
74fae9b
Compare
6 tasks done
…heir chat When a gateway-owned session (state.db source = a messaging platform) is continued from a local surface (Desktop chat, TUI, dashboard), only that surface sees the exchange. With display.platforms.<platform>.mirror_local_turns enabled, every completed turn is forwarded to the session's own chat - the user's message as a quote block, then the reply - through the same standalone sender chain hermes send / cron delivery use (no live gateway needed; silent by default). - tui_gateway/turn_mirror.py (new): decision + composition + detached delivery; fail-closed target lookup from the session row (chat_id/thread_id); synthetic turns and silent replies never mirrored - tui_gateway/prompt_turn.py: dispatch after message.complete (no-op unless enabled) - gateway/display_config.py: mirror_local_turns, _silent, _4096_split, _label - tools/send_message_senders.py + telegram plugin: silent/chunk_indicators kwargs on the standalone sender - docs, cli-config example, tests
Maziyang2
force-pushed
the
feat/telegram-mirror-local-turns
branch
from
October 14, 2026 06:57
74fae9b to
2338ea9
Compare
This branch has not been deployed
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.
Why this matters
Keep the record complete when you continue a messaging conversation from the Hermes Desktop app (or TUI / dashboard).
Hermes sessions are cross-surface: you can reopen your Telegram DM in the Desktop app and keep chatting. But turns served by a local surface exist only on that surface — the platform's own chat never sees them, so the history on your phone has a hole exactly where you kept talking (and the bot cannot replay your side — it can only post as itself).
This PR adds an opt-in mirror: every completed turn served locally for a gateway-owned session is forwarded to that session's own platform chat — your message as a quote block, then the assistant's reply:
display.platforms.<platform>.mirror_local_turns: trueenables it per platform (Telegram shown; any platform whose plugin exposes a standalone sender works).chat_id/thread_idstored on the session row: the same chat the gateway itself delivers to.hermes send/ cron delivery; failures are logged and never affect the turn.disable_notification(configurable), so a phone that already followed along on the desktop isn't pinged twice.[SILENT]) responses are skipped.Companion PR — a two-part messaging upgrade
This is the second half of a coherent messaging/Telegram upgrade; both PRs are designed to land and be used together:
They are split into two PRs only for compatibility / independent reviewability — neither depends on the other's code, and they can merge in any order. The long-text handling here deliberately follows the same parameter semantics introduced in #110611 (
streaming_single_message_4096_split):mirror_local_turns_4096_split: false(default) — keep one message where possible; past the platform cap the remainder paginates (page markers kept)mirror_local_turns_4096_split: true— split into standalone ≤4096 messages (markers stripped)so both features behave consistently when enabled together.
What changed
tui_gateway/turn_mirror.py(new) — decision point, message composition, detached delivery (daemon thread; never blocks or breaks the turn it mirrors).tui_gateway/prompt_turn.py— dispatch aftermessage.complete(no-op unless enabled). One hook covers Desktop + TUI + dashboard, which share this backend.gateway/display_config.py—mirror_local_turns,mirror_local_turns_silent,mirror_local_turns_4096_split,mirror_local_turns_label(+ normalisers).tools/send_message_senders.py—silent+chunk_indicatorskwargs on the standalone Telegram sender;_registry_standalone_sendforwards them only to senders that declare them (other platforms keep their existing call shape).plugins/platforms/telegram/adapter.py—_standalone_sendpass-through.website/docs/user-guide/messaging/index.md),cli-config.yaml.example, tests.How to test
tests/tui_gateway/test_turn_mirror.py— 24 passed (composition, decision table, target resolution, delivery options, contained failures).display.platforms.telegram.mirror_local_turns: true, continue a Telegram session from the Desktop app — each completed turn arrives in the Telegram chat as quote + reply.Tested on macOS (Darwin 27), Python 3.11.
Type of Change
Checklist
Code
Documentation & Housekeeping
cli-config.yaml.example)silent/chunk_indicatorsforwarded only when the sender declares them)