fix(streaming): add missing f-prefix to phase_id on agent pause#192
Open
Osamaali313 wants to merge 1 commit into
Open
fix(streaming): add missing f-prefix to phase_id on agent pause#192Osamaali313 wants to merge 1 commit into
Osamaali313 wants to merge 1 commit into
Conversation
Three finish() calls pass phase_id="{self._context.iteration}-final" without
the f-string prefix, so the literal text "{self._context.iteration}-final" is
sent instead of the interpolated "<iteration>-final". phase_id becomes the
emitted SSE chunk's id (OpenAIStreamingGenerator.finish -> _create_base_chunk),
so the terminal chunk on every clarification/answer pause ships a constant,
invalid id. The correct sibling call in base_agent.py (the finally-block
finish) already uses f"{self._context.iteration}-final", proving intent. Add
the f prefix at the three sites (base_agent.py and dialog_agent.py x2).
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.
Problem
Three
streaming_generator.finish(...)calls passphase_idas a plain string that was meant to be an f-string:at
sgr_agent_core/base_agent.py:249andsgr_agent_core/agents/dialog_agent.py:65and:76. Missing thefprefix, so the literal text{self._context.iteration}-finalis sent verbatim instead of the interpolated<iteration>-final.phase_idbecomes the emitted SSE chunk'sid(OpenAIStreamingGenerator.finish→_create_base_chunk, inherited byOpenWebUIStreamingGenerator). So the terminal streaming chunk on every agent pause/hand-off — the clarification path (BaseAgent._execution_step) and the DialogAgentClarificationTool/AnswerTool"pass turn to user" paths (every DialogAgent turn) — ships a constant, invalidid.The correct sibling in the same file proves intent —
base_agent.py:308(thefinally-block finish) already uses:Reproduction
With
self._context.iteration == 3:id='{self._context.iteration}-final'(literal)id='3-final'Fix
Add the
fprefix at the three sites:python -m py_compilepasses for both files. (tests/test_dialog_agent.pyalready executes thedialog_agent.py:76pause path but doesn't assertphase_id, which is why the literal slipped through.)