Conversation
|
Independent production confirmation from a Fedora 44 Telegram gateway:
This preserves prior-turn MEDIA deduplication, so it is preferable to an empty-set fallback. Thanks for including real branch coverage here. |
|
Independent macOS/Telegram confirmation: an ordinary text-only streamed reply completed successfully with No attachment directive was required to trigger the failure, so this affects ordinary streamed text replies as well as MEDIA-bearing replies. The model/provider request had already succeeded. Latest #72321’s history-derived fix preserves the existing cross-turn deduplication contract and is preferable to an empty-set fallback. |
08115f2 to
0a29780
Compare
0a29780 to
ef7c1de
Compare
what does this PR do?
Fixes a gateway crash in the post-stream delivery path. When a streamed agent result has
already_sent=Trueand a non-empty final response,_handle_message_with_agentpassed_history_media_paths, which is only bound inside_run_agent_inner's nestedrun_syncfunction. The outer handler therefore raisesNameErrorafter the model request succeeds, turning an otherwise-complete reply into a generic platform error.This happens for ordinary streamed text replies as well as responses containing
MEDIA:directives, because the post-stream attachment-delivery helper is invoked for any non-empty response.The fix derives the existing history-media dedup set from the handler's loaded transcript. This resolves the crash without disabling cross-turn MEDIA deduplication.
This is deliberately limited to the gateway fix and its regression coverage. The related open #72228 also modifies unrelated desktop performance/debug files; its fallback-to-empty-set guard avoids the exception but drops the existing dedup context.
related issue
No filed issue. Related PR: #72228.
type of change
changes made
gateway/run.py: derive prior delivered MEDIA paths from the transcript before post-stream delivery.tests/gateway/test_42039_duplicate_user_message.py: exercise the realalready_sentbranch with an ordinary text reply and assert prior MEDIA paths reach the delivery helper.how to test
main, drive_handle_message_with_agentwithalready_sent=True, any non-empty response, and a platform adapter. It raisesNameError: name '_history_media_paths' is not definedafter the streamed response completes.checklist
_history_media_pathsin auto-resume path #72228 is the only exact open overlap and this PR does not duplicate its unrelated desktop changes.pytest tests/ -qand all tests pass. Full hermeticscripts/run_tests.shis running separately; the targeted canonical suite above passed.