Conversation
Contributor
Collaborator
|
Thanks for the focused recovery-path analysis. This is an automated hermes-sweeper review; current
The PR's intended guarantee is therefore already implemented on current main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up from PR #31448 (issue #30770), which fixed the
guardrail_haltexit branch inagent/conversation_loop.pyto emit the synthesized halt message viastream_delta_callbackbefore closing. Two structurally-identical sibling sites had the same gap and were explicitly flagged by #31449:partial_stream_recovery(~L3543) — assignsfinal_response = _recovered(text reconstructed from a partial stream after a<think>block) andbreaks. The recovered text wasn't necessarily streamed in full this turn, so SSE/TUI consumers drained an empty delta queue and rendered a blank bubble.fallback_prior_turn_content(~L3582) — assignsfinal_response = agent._strip_think_blocks(fallback).strip()wherefallbackis the previous turn's content. The previous turn's content was streamed on the prior SSE response, so the current SSE writer also drained an empty queue.This PR mirrors the guardrail-halt emit pattern (callback(text) + callback(None) inside a guarded try/except) at both sites. The blank-bubble symptom is now indistinguishable from a normal response close.
Test Plan
python -m pytest tests/run_agent/test_run_agent.py -q -o 'addopts=' -k 'partial_stream_recovery or fallback_prior_turn'— 5 passed (2 new + 3 existing).test_partial_stream_recovery_emits_to_stream_callback— source-inspection regression that fails if the emit block is removed from thepartial_stream_recoverybranch.test_fallback_prior_turn_content_emits_to_stream_callback— same shape for thefallback_prior_turn_contentbranch.test_partial_stream_recovery_uses_streamed_content,_on_empty_stub,_preempts_prior_turn_fallback) still pass — they cover the recovery happy paths without depending on the new callback assertion.Source-inspection rather than a live behavioral assertion was chosen for the new tests because setting
stream_delta_callbackon the existing fixture changes how the streaming pipeline accumulates_current_streamed_assistant_text(the field the recovery branch reads), so a live-loop assertion races with the streaming finalizer. The source check is durable: it catches anyone removing or relocating the emit block in either branch.Closes #31449