Fix stale previous_response_id after user interruption#48
Merged
Conversation
When a user presses stop after the AI returns tool calls, the stored previous_response_id points to a response with unanswered tool calls. Subsequent messages fail with "No tool output found for function call". Clear the response ID in add_partial_assistant_message(), which is called exactly when the user interrupts via /save_partial_response.
The client now always calls /save_partial_response on stop, even with an empty buffer. The route accepts empty text and forwards it to all APIs. The base class skips appending empty content to history but the Responses API override still clears the stale previous_response_id.
…le-response-id # Conflicts: # static/routes.py
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
get_current_canvas_state), the_previous_response_idremains pointing to a response with pending unanswered tool calls. Every subsequent message fails withNo tool output found for function call call_...until the conversation is reset.add_partial_assistant_message()inOpenAIResponsesAPIto clear_previous_response_idwhen called (this method is invoked exactly when the user interrupts via/save_partial_response).clear_previous_response_id()public method for explicit ID clearing.Test plan
test_clear_previous_response_id— direct method testtest_clear_previous_response_id_noop_when_none— no-op when already Nonetest_add_partial_message_clears_previous_response_id— core bug fix scenariotest_partial_message_still_appends_to_history— verifies super() delegationstatic/openai_responses_api.py🤖 Generated with Claude Code