plugins/phonic: preserve tool calls and outputs across mid-session reset - #6702
Draft
arunwpm-work wants to merge 1 commit into
Draft
plugins/phonic: preserve tool calls and outputs across mid-session reset#6702arunwpm-work wants to merge 1 commit into
arunwpm-work wants to merge 1 commit into
Conversation
Render the continued-conversation history with tool calls and their outputs (XML tags, matching the JS plugin) instead of text-only. livekit core commits realtime function_call items to the agent chat context but not their function_call_output, so remember observed outputs and re-inject them (right after their call) in _build_turn_history; skip when the ctx already carries the output. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
When the Phonic realtime session is reset mid-session (e.g. an agent handoff), the plugin rebuilds the conversation history from the agent chat context via
_build_turn_history. Two changes:<tool_call>/<tool_output>), matching the JS plugin — previously the Python renderer was text-only and dropped tool calls and outputs entirely.Why
onToolExecutionCompletedin the realtime generation path commits thefunction_callto the agent chat context but not thefunction_call_output(that only happens on the interrupted path). Providers whose server keeps its own context across the session are unaffected, but Phonic rebuilds the server context from the agent chat context on reset — so the un-persisted output was lost, leaving the model with a tool call and no result after a handoff.Notes
role: text. This brings the Python plugin to parity with the JS plugin.