Skip to content

Fix stale previous_response_id after user interruption#48

Merged
vl3c merged 3 commits intomainfrom
fix/responses-api-stale-response-id
Feb 21, 2026
Merged

Fix stale previous_response_id after user interruption#48
vl3c merged 3 commits intomainfrom
fix/responses-api-stale-response-id

Conversation

@vl3c
Copy link
Copy Markdown
Owner

@vl3c vl3c commented Feb 21, 2026

Summary

  • When a user presses "stop" after the AI returns tool calls (e.g. get_current_canvas_state), the _previous_response_id remains pointing to a response with pending unanswered tool calls. Every subsequent message fails with No tool output found for function call call_... until the conversation is reset.
  • Override add_partial_assistant_message() in OpenAIResponsesAPI to clear _previous_response_id when called (this method is invoked exactly when the user interrupts via /save_partial_response).
  • Add clear_previous_response_id() public method for explicit ID clearing.

Test plan

  • test_clear_previous_response_id — direct method test
  • test_clear_previous_response_id_noop_when_none — no-op when already None
  • test_add_partial_message_clears_previous_response_id — core bug fix scenario
  • test_partial_message_still_appends_to_history — verifies super() delegation
  • Full server test suite passes (975 passed, 26 skipped)
  • mypy clean on static/openai_responses_api.py

🤖 Generated with Claude Code

vl3c added 3 commits February 21, 2026 18:07
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
@vl3c vl3c merged commit 9106f96 into main Feb 21, 2026
1 check passed
@vl3c vl3c deleted the fix/responses-api-stale-response-id branch February 21, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant