Skip to content

fix(telegram): refresh topic binding before auto-title after compression - #44781

Closed
McHersheys wants to merge 1 commit into
NousResearch:mainfrom
McHersheys:fix/telegram-topic-autotitle-compression-rename
Closed

fix(telegram): refresh topic binding before auto-title after compression#44781
McHersheys wants to merge 1 commit into
NousResearch:mainfrom
McHersheys:fix/telegram-topic-autotitle-compression-rename

Conversation

@McHersheys

Copy link
Copy Markdown
Contributor

Fixes #44769.

When a Telegram DM topic turn compresses into a child session, refresh the topic binding immediately after the split so the auto-title rename callback sees the child session instead of skipping on a stale parent binding.

Tests:

  • uv run pytest tests/gateway/test_telegram_topic_mode.py -q
  • uv run ruff check gateway/run.py tests/gateway/test_telegram_topic_mode.py

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter P2 Medium — degraded but workaround exists labels Jun 12, 2026
@liuhao1024

Copy link
Copy Markdown
Contributor

Verified this PR — the fix correctly refreshes the Telegram topic binding before maybe_auto_title fires after a compression split, preventing a stale parent binding from causing editForumTopic to skip the rename.

Checklist applied:

  • ✅ Race condition: the compression split changes agent.session_id from parent to child. Without the topic binding refresh, the later auto-title callback reads the old parent binding and safely but incorrectly skips the rename. The fix inserts _sync_telegram_topic_binding at the right point (after session entry update, before auto-title).
  • _sync_telegram_topic_binding is called with reason="run-agent-session-split" for traceability.
  • ✅ The test (test_topic_binding_refreshes_before_auto_title_after_compression_split) sets up the exact scenario: parent session → compression → child session → verify binding refresh was called with the child session ID.
  • ✅ No new imports or dependencies — uses the existing _sync_telegram_topic_binding method.

@teknium1

Copy link
Copy Markdown
Contributor

Closing as superseded by the compression split fix that landed in PR #45529:
#45529

That merged change now syncs compression-created session IDs before failed/no-final-response paths can return, resets the history offset for split failures, and refreshes the Telegram topic binding on the rotated child session. Thanks for the fix/report — the payload here is now covered on current main.

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 P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram topic auto-title skips rename after compression split

4 participants