Skip to content

feat(gateway): add Telegram temporary tool progress - #18238

Closed
mrcharlesiv wants to merge 1 commit into
NousResearch:mainfrom
mrcharlesiv:feature/telegram-progress-cleanup
Closed

feat(gateway): add Telegram temporary tool progress#18238
mrcharlesiv wants to merge 1 commit into
NousResearch:mainfrom
mrcharlesiv:feature/telegram-progress-cleanup

Conversation

@mrcharlesiv

@mrcharlesiv mrcharlesiv commented May 1, 2026

Copy link
Copy Markdown

What does this PR do?

Adds an opt-in Telegram display setting, display.platforms.telegram.temporary_tool_progress, so Hermes can show temporary work/status visibility while a turn is running and then delete the bot-sent temporary bubbles after the final response is successfully delivered.

This keeps the useful live “working” visibility without leaving Telegram chats cluttered. The implementation is Telegram-gated, default-off, generation-safe, and best-effort: it tracks only current-run bot-sent temporary message IDs, never deletes the final response or user messages, preserves breadcrumbs on failure, and ignores Telegram deletion failures.

Covered temporary messages now include:

  • tool-progress bubbles
  • long-running ⏳ Still working... notices
  • status-callback messages such as context-pressure/compaction notices

This PR is intentionally separate from #18266’s display.ephemeral_system_ttl lifecycle. #18266 deletes slash-command/system notices after a TTL; this PR deletes tracked Telegram progress/status messages only after confirmed final delivery.

Related Issue

N/A — no issue filed.

Potentially related PRs found during duplicate check:

This PR is narrower than the broad auto-delete variants: Telegram-only, default-off, generation-safe, and success-only cleanup for bot-sent temporary tool-progress/status bubbles.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • gateway/display_config.py: adds temporary_tool_progress display setting and supports the older cleanup_tool_progress alias.
  • gateway/platforms/base.py: makes post-delivery callbacks composable and generation-aware so cleanup hooks do not clobber background-review, EphemeralReply, or newer-run callbacks.
  • gateway/run.py: tracks Telegram tool-progress message IDs, long-running Still working... message IDs, and status-callback message IDs, then schedules best-effort cleanup only after successful final/streamed/queued delivery.
  • hermes_cli/config.py: adds the default config key while preserving ephemeral_system_ttl.
  • cli-config.yaml.example: documents the new display-platform override.
  • tests/gateway/test_display_config.py and tests/gateway/test_run_progress_topics.py: add coverage for config resolution, callback composition/generation safety, success cleanup, failure breadcrumbs, background-review composition, queued follow-up behavior, Still working... cleanup, and status-callback cleanup.

How to Test

  1. Enable the setting:
    display:
      platforms:
        telegram:
          tool_progress: all
          temporary_tool_progress: true
  2. Send a Telegram message that causes a tool call or runs long enough to emit a ⏳ Still working... notice.
  3. Confirm temporary progress/status bubbles are visible while the turn runs and disappear after the final response lands.
  4. Confirm that failed runs leave breadcrumbs in place.

Automated verification run locally:

scripts/run_tests.sh \
  tests/gateway/test_status_command.py::test_post_delivery_callback_generation_snapshot_happens_after_bind \
  tests/gateway/test_run_progress_topics.py \
  tests/gateway/test_display_config.py \
  tests/gateway/test_ephemeral_reply.py

Result: 78 passed in 12.14s.

Broad gateway verification run locally:

ulimit -n 4096
scripts/run_tests.sh tests/gateway/ -k 'not test_send_typing and not test_closed_when_http_not_ready and not test_discord_free_channel_skips_auto_thread'

Result: 4667 passed, 10 skipped, 196 warnings in 69.23s.

Additional checks:

  • git diff --check
  • Python AST parse for modified Python files
  • YAML parse for cli-config.yaml.example
  • static scan: no obvious hardcoded secrets / unsafe eval-exec / pickle / SQL formatting patterns
  • independent reviewer pass: no blockers after callback composition fix

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS / Telegram gateway

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

N/A — this PR does not add a skill.

Screenshots / Logs

Focused regression output:

78 passed in 12.14s

Broad gateway output, excluding known unrelated local failures:

4667 passed, 10 skipped, 196 warnings in 69.23s

Notes on unchecked full-suite item:

  • Full pytest tests/ -q was not run after the May 6 rebase.
  • tests/gateway/test_discord_free_response.py::test_discord_free_channel_skips_auto_thread fails isolated on clean origin/main (da6019820) too, so it is not attributed to this PR.
  • The broad gateway run excludes known unrelated/local failures: test_send_typing, test_closed_when_http_not_ready, and the Discord free-response test above.
  • Additional checks passed after the rebase: git diff --check, Python AST parse for modified Python files, YAML parse for cli-config.yaml.example, and a static secret/unsafe-pattern scan.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter labels May 1, 2026
@mrcharlesiv
mrcharlesiv force-pushed the feature/telegram-progress-cleanup branch 2 times, most recently from 5beff77 to 425e144 Compare May 1, 2026 12:08
@mrcharlesiv
mrcharlesiv force-pushed the feature/telegram-progress-cleanup branch from 425e144 to 3c8981e Compare May 6, 2026 21:05
@mrcharlesiv
mrcharlesiv marked this pull request as ready for review May 6, 2026 21:05
@teknium1

teknium1 commented May 7, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution and for building this — the UX win (keep progress visible live, clean up the chat afterward) is a real improvement, and your write-up of the breadcrumb-on-failure behavior was exactly the right default.

I went ahead and merged a salvage rewrite in #21186 (merge commit bf843ad) that lands the same user-visible feature with a lighter footprint:

  • Same config surface: display.cleanup_progress: true (global or per-platform under display.platforms.<plat>.cleanup_progress), default off
  • Same cleanup scope: tool-progress bubble, ⏳ Still working... notices, status-callback messages
  • Same correctness invariants: skip-on-failure (breadcrumbs preserved), success-only deletion, Telegram-gated via delete_message support check

The main difference is on the base.py side — instead of turning the post-delivery-callback slot into a multi-shape list with a dedicated composition helper and 4-shape normaliser, the salvage chains a new callback onto any existing one (with per-callback exception isolation) in register_post_delivery_callback itself. That keeps the existing single-callback + (gen, callback) tuple shapes and lets the cleanup callback coexist with the background-review release hook that's already registered on the same slot.

Net: ~141 LOC production vs your ~235, same behaviour, and your name is in AUTHOR_MAP + the commit's Co-authored-by trailer so future release notes pick this up correctly. Closing this in favour of the merged salvage — really appreciate the idea and the thorough test coverage, both of which informed the rewrite.

@teknium1 teknium1 closed this May 7, 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