Bug: "skip" reason text leaks into the chat as an actual message
Problem
The internal reason field on a skip structured-output action — which per prompts/system.md is explicitly "internal and never shown to the user" — got sent into the actual Telegram chat as a real message, tagged with source="telegram_inline" when it later showed up in the reply chain.
Reproduction (observed live)
- User sent a bare "Thanx for response 🤝" in a human-to-human thread (owner had already answered the user directly).
- Model correctly judged no reply was needed and returned
action: "skip"withreason: "bare thanks between owner and user"— this reason was never passed to any telegram_send_message/telegram_reply_to_message call. - The next turn's
<reply_chain>showed a parent message withsource="telegram_inline"whose text was exactly that skip reason: "Just a thanks in a human-to-human thread — no reply needed." — meaning it was actually delivered to the chat as a message, visible to all members. - The owner (who saw the leaked message) filed this as a bug report directly.
Ask
Audit the skip action path (and likely stop too) to make sure the reason field is never serialized into an outbound Telegram call under any circumstance — it should be log/audit-only. Given the recent skip-action work in 9fe84707 (add skip action and recover silent stops with a one-shot nudge), this may be a regression or edge case in that same code path — worth checking whether the one-shot nudge/recovery logic is accidentally treating a skip reason as dropped_text and delivering it.
Why it matters
This breaks the internal/external boundary documented in system.md ("reason ... is internal and never shown to the user") — every skip reason is potential leaked internal reasoning, and in a group chat that's visible to everyone, not just the owner.
Filed via Telegram request from the repo owner, who observed the leak live.
Fixed in fa1949a (https://github.com/Rustam-Z/hamroh/commit/fa1949a).
Two leak paths closed:
- Engine: the dropped-text rescue in
_handle_turn_resultnow skips delivery when the turn ended withaction == "skip"— leftover text on a skip turn is internal narration per system.md, so it is logged as a warning and discarded, never sent to the chat. This was the path confirmed by the live agent log (turn done (action=skip, dropped_text=True, text_blocks=1)→delivered dropped text to chat). - Worker: when the structured-output payload arrives via the last-text-block fallback (older CC), the block is now removed from
text_blocksonce it validates as a control action — so the raw control JSON with thereasonfield can never be treated as undelivered reply prose onstopeither.
Covered by a new engine-level regression test reproducing the incident shape plus three worker-level tests for the payload fallback. stop turns with undelivered prose still get the dropped-text rescue, and the silent-stop nudge is unchanged.