Preserve forwarded message provenance - #43477
Conversation
|
Reviewed by Hermes Agent — deferred to team for product sign-off. Feature PRs ( Hermes Agent triage |
|
Thanks @austinpickett. Best way to get a maintainer on these? |
|
Thanks for the comprehensive forwarding-context implementation. The premise is confirmed on current main: Telegram event construction does not extract Problems
Suggested changes
Automated hermes-sweeper review. |
…tion The /queue handler rebuilds the inbound MessageEvent field-by-field but omitted context_refs, so forwarding a message via /queue dropped its [Forwarded message] origin block when the queued turn ran. Copy context_refs into the reconstructed event (fresh list to avoid aliasing the source event's list), matching the media/reply payload handling already present. Add a focused runtime regression test driving the real /queue handler and asserting the refs survive. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Addressed the Verification:
Thank you for catching the secondary reconstruction path. |
|
@teknium1 The sweeper-requested |
Summary
Fixes #43397.
This preserves forwarded-message provenance in gateway inbound events instead of treating forwarded content as ordinary pasted text.
MessageContextRefmodel onMessageEvent.forward_origin/is_automatic_forwardmetadata into context refs.@context-reference preprocessing so untrusted forwarded metadata cannot trigger@file/@urlexpansion.Tests
Focused local verification with dev dependencies via
uv run --extra dev:uv run --extra dev python -m pytest \ tests/gateway/test_forward_context_rendering.py \ tests/gateway/test_telegram_forward_context.py \ tests/gateway/test_telegram_text_batching.py \ tests/gateway/test_active_session_text_merge.py \ tests/gateway/test_session_race_guard.py \ -q -o addopts=''Result:
60 passed in 9.94sin the feature worktree;60 passed in 9.71safter cherry-picking into Tyler'styler/livebranch.Busy-session preservation smoke after local live cherry-pick:
uv run --extra dev python -m pytest \ tests/gateway/test_busy_session_ack.py \ tests/gateway/test_busy_session_buttons.py \ tests/gateway/test_busy_session_auth_bypass.py \ tests/gateway/test_busy_session_runner.py \ tests/gateway/test_telegram_busy_controls.py \ tests/gateway/test_running_agent_session_toggles.py \ tests/cli/test_busy_input_mode_command.py \ tests/cli/test_cli_steer_busy_path.py \ -q -o addopts=''Result:
90 passed in 1.77s.Review
Codex review was run against the feature diff. It initially found merge-path and metadata sanitization gaps; those were fixed and covered by tests. Final Codex review result:
APPROVED.Notes
This PR intentionally avoids exposing Telegram handles as literal
@handlestrings inside synthetic provenance headers, because those headers share the same prompt surface as user-authored text.Independent review
Codex CLI (
gpt-5.6-sol, ultra reasoning) reviewed follow-up commit503aca350and reported no blocking findings: “The change correctly preserves forwarded-message context while avoiding list aliasing. Relevant queue, rendering, batching, and session tests passed.”