Skip to content

fix(gateway): emit silent lifecycle activity without progress bubbles - #75022

Open
pawozakwa wants to merge 3 commits into
NousResearch:mainfrom
pawozakwa:feat/silent-lifecycle-reactions
Open

pawozakwa wants to merge 3 commits into
NousResearch:mainfrom
pawozakwa:feat/silent-lifecycle-reactions

Conversation

@pawozakwa

@pawozakwa pawozakwa commented Jul 30, 2026

Copy link
Copy Markdown

1|## Summary
2|
3|- add an optional platform hook for quiet processing activity
4|- dispatch lifecycle/tool events even when visible progress messages are disabled
5|- use Telegram reactions as a best-effort implementation of that hook
6|- deduplicate and serialize reaction updates so concurrent events cannot race
7|- make terminal reaction state monotonic so late activity cannot overwrite success, failure, or cancellation
8|- bound settled-reaction state and reopen it when a new run starts for the same message
9|
10|## Problem
11|
12|The gateway currently ties tool-event delivery to the visible progress-message path. When both tool_progress and thinking_progress are disabled, a platform adapter cannot provide a quieter status surface even if it supports one.
13|
14|This keeps lifecycle activity separate from progress messages. Platforms that do not implement the optional hook retain the existing behavior.
15|
16|An activity update also requires the original inbound message reference. Turns without that reference remain a no-op because there is no safe message-scoped status surface to update.
17|
18|## Failure and ordering behavior
19|
20|Reaction updates are best-effort. API failures are logged at debug level and do not affect agent execution or final-answer delivery. Repeated identical states are skipped, and reaction writes are serialized.
21|
22|Terminal outcomes are monotonic for a message run: delayed fire-and-forget activity cannot replace completed, failed, or cancelled. The guard is bounded to 1024 message keys and a new processing start reopens lifecycle state for reused message identifiers.
23|
24|## Tests
25|
26|Validated on final head 3f7bdfa8c683ee4f0ecf3dbfe6bade8f696a6d28, rebased onto origin/main:
27|
28|text 29|52 passed in 23.69s (clean detached worktree) 30|ruff: PASS 31|git diff --check: PASS 32|added-lines privacy/security scan: PASS 33|independent blocker-focused review: MERGE-READY 34|
35|
36|The exact-head repository-wide runner completed with 68 failures across 13 files plus one collection/import-error file. A canonical sequential rerun reproduced 64 failures across 10 files plus the same collection error; four timing-sensitive failures (fuzzy_match, transcription, and delegation cleanup) did not reproduce. The only reproduced gateway failure, test_profile_route_and_nonmultiplexed_resolution_preserve_boundaries, also fails unchanged on base c0106e50e7; most other reproductions are optional-integration/lazy-dependency or environment failures. None touches the focused lifecycle/reaction files. This PR does not claim a clean full-suite result; the focused exact-head evidence above remains green, and upstream CI remains authoritative.
37|
38|Coverage includes:
39|
40|- tool lifecycle delivery with tool_progress=false
41|- tool lifecycle delivery with thinking_progress=false
42|- Telegram state mapping and fallback behavior
43|- reaction feature gating
44|- non-fatal API failures
45|- duplicate-state suppression
46|- concurrent duplicate suppression
47|- terminal success, failure, and cancellation cleanup
48|- late activity after terminal completion
49|- bounded terminal-state tracking
50|- reopening state for a new run reusing the same message ID
51|- missing message-reference safety
52|

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins platform/telegram Telegram bot adapter sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 30, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for separating silent activity from visible progress bubbles. The current-main premise is valid: gateway/run.py:4509 leaves tool_progress_callback unset when neither progress, log mode, nor live status is enabled.

Problems

  • plugins/platforms/telegram/adapter.py:9711 stores each successful (chat_id, message_id) reaction state, but the PR only removes entries in _clear_reactions (:9734-9736). Existing terminal success/failure calls use _set_reaction (:9754-9757 on current main), so a reaction-enabled long-running gateway retains one dictionary entry per completed inbound message.
  • tests/gateway/test_telegram_dynamic_reactions.py:46-101 covers duplicate suppression but not terminal cleanup or a storage bound.

Suggested changes

  • Bound or retire reaction state after terminal success/failure while preserving serialization for in-flight activity updates, and add lifecycle cleanup/bounded-store tests.
  • Update website/docs/user-guide/messaging/telegram.md:1197-1223 to describe the new tool-state reactions.

Automated hermes-sweeper review.

Comment thread plugins/platforms/telegram/adapter.py Outdated
@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 30, 2026
@pawozakwa
pawozakwa force-pushed the feat/silent-lifecycle-reactions branch from b9c6062 to 9f06243 Compare August 4, 2026 06:23
@pawozakwa
pawozakwa force-pushed the feat/silent-lifecycle-reactions branch from 9f06243 to 3f7bdfa Compare August 11, 2026 10:13
@pawozakwa

Copy link
Copy Markdown
Author

Rebased onto current main and addressed the sweeper findings on final head 3f7bdfa8c6:

  • terminal success/failure/cancellation now retire active reaction state while preserving a bounded settled guard;
  • delayed fire-and-forget activity cannot overwrite a terminal reaction;
  • the guard is capped at 1024 message keys and a new start reopens state for a reused message ID;
  • Telegram docs now describe silent tool-state reactions;
  • regression coverage includes terminal cleanup, late events, bounded storage, start/reuse, API failures, and missing message references.

Focused gateway/Telegram suite on a clean detached worktree: 52 passed in 23.69s. Ruff, git diff --check, added-lines privacy scan, and an independent blocker-focused review pass. The PR is now conflict-free and ready for maintainer review.

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 comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/telegram Telegram bot adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants