feat(telegram): inject replied message as system context note instead of text prefix (#60055) - #60221
webtecnica wants to merge 1 commit into
Conversation
… of text prefix When replying to a Telegram message, the replied-to text was prepended as a plain [Replying to: "..."] prefix on the user message, which the model often ignored. Now injected as a structured directive block with explicit framing for stronger signal. Closes NousResearch#60055
teknium1
left a comment
There was a problem hiding this comment.
Thanks for targeting reply-context disambiguation; current main still prepends reply text at gateway/run.py:10714.
Problems
- The new strings are not a system-level note.
_prepare_inbound_message_text()returns onemessage_text, and that value is passed as the normal agent message atgateway/run.py:11759; changing the prefix wording does not add a distinct system-role context block. - The branch has no Telegram guard at
gateway/run.py:10714. Signal, WhatsApp Cloud, and Yuanbao also populatereply_to_text, so this changes their reply-context behavior too. - The PR modifies only
gateway/run.py, buttests/gateway/test_reply_to_injection.py:58,:98,:121, and:181assert the legacy output format.
Suggested changes
- Define whether this is a stronger user-message framing or a genuinely structured context mechanism, while preserving the cached system prompt invariant.
- Scope it to Telegram or update the stated scope and coverage for all affected adapters.
- Update the reply-injection tests for the intended output contract.
Automated hermes-sweeper review.
| f'[Prioritize this message as the primary context for your response.]\n\n' | ||
| f"{message_text}" | ||
| ) | ||
| else: |
There was a problem hiding this comment.
This is still text prepended to message_text, not a separate system-role note: current main passes the prepared value as the normal message to _run_agent (gateway/run.py:11759). Please either describe this accurately as stronger user-message framing or implement the intended structured mechanism.
| f'{message_text}' | ||
| ) | ||
|
|
||
| if "@" in message_text: |
There was a problem hiding this comment.
This shared inbound-preparation branch has no Telegram guard. Signal, WhatsApp Cloud, and Yuanbao also set reply_to_text, so this wording changes their reply-context semantics as well. Scope it explicitly or update the PR scope and coverage.
Telegram replied messages are now injected as a structured directive block with [System Note], [Replied message], and [Prioritize] framing — much stronger signal than the old plain [Replying to:] prefix. Closes #60055