fix(telegram): merge forwarded batch attachments into startup turns - #46101
fix(telegram): merge forwarded batch attachments into startup turns#46101Qwinty wants to merge 2 commits into
Conversation
da68a31 to
a756d0b
Compare
a756d0b to
956dfdd
Compare
5564a0d to
54899f3
Compare
1018f6a to
0147a58
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for consolidating the Telegram startup-media work from #33272. The underlying race is present on current main: text flushes independently at plugins/platforms/telegram/adapter.py:7660-7702, while photo processing downloads and queues separately at plugins/platforms/telegram/adapter.py:7809-7834.
Problems
gateway/run.py:5704is not scoped to Telegram or to a verified batch. Any platform's busy media event now bypasses configured interrupt/steer behavior and the busy acknowledgement.gateway/run.py:5521-5534waits through the grace deadline even when there is no pending media signal, adding the default one-second delay to normal Telegram text-only turns.gateway/run.py:5415addsHERMES_TELEGRAM_STARTUP_MEDIA_GRACE_SECONDS;AGENTS.md:102-106requires non-secret behavioral configuration to useconfig.yaml, not a newHERMES_*variable.
Suggested changes
- Scope the media bypass to verified Telegram startup-batch follow-ups and preserve normal busy-mode semantics otherwise.
- Avoid unconditional startup waiting; use an adapter-observed signal or an adapter-side batch boundary.
- Replace the environment-variable interface with a fixed internal bound or config.yaml-backed setting.
Automated hermes-sweeper review.
9af1d0e to
d34ba72
Compare
|
Rebased onto current
Local verification: python -m pytest -q -o 'addopts=' \
tests/gateway/test_telegram_forwarded_batch_startup_merge.py \
tests/gateway/test_telegram_documents.py \
tests/gateway/test_telegram_text_batching.py \
tests/gateway/test_busy_session_ack.py
# 97 passed |
Late findings follow-upPushed
Local verification: targeted Telegram startup/document suites green. |
CI follow-upFixed the slice failure on
Pushed on top of the late-findings commit. |
Final independent-review follow-upPushed
Local verification: 66 passed; ruff clean. |
5d11f17 to
0cbabe2
Compare
|
Rebuilt this PR as a single focused commit on current Current scope:
Verification on head
|
|
Follow-up after the asynchronous reviews completed: one reviewer reproduced a real 5 ms callback-registration gap that the zero-delay yields did not cover. Pushed
Verification on the new head:
This supersedes my previous “final” status comment; I should have waited for all outstanding async reviews before reporting completion. |
7b3c691 to
9a4ba2d
Compare
c24947f to
667ef73
Compare
|
UP here |
667ef73 to
70504d9
Compare
|
Refreshed onto current |
Summary
Addresses the remaining startup-registration race related to #46100: a normal text turn can begin while a forwarded or standalone attachment is still downloading or waiting for Telegram topic recovery. This is distinct from the existing
media_group_idalbum aggregation already onmain./queueand existing pending turns are never absorbed.BasePlatformAdapter.handle_message()registration, closing the post-download/topic-recovery gap where voice/video/document could otherwise miss the startup collector.filters.VIDEO_NOTEand addsMessageType.VIDEO_NOTE.Fixes #33270
Verification
py_compile, andgit diff --checkpass.Follow-up generation-safe lifecycle hardening across
/stop//new//reset: #81371.