Skip to content

fix: reject history-rewriting handoffs with server-managed conversation#2746

Closed
sztoplover-bit wants to merge 1 commit intoopenai:mainfrom
sztoplover-bit:fix/server-managed-handoff
Closed

fix: reject history-rewriting handoffs with server-managed conversation#2746
sztoplover-bit wants to merge 1 commit intoopenai:mainfrom
sztoplover-bit:fix/server-managed-handoff

Conversation

@sztoplover-bit
Copy link

Summary

  • reject handoff input filtering when using server-managed conversation
  • reject handoff history nesting when using server-managed conversation
  • add regression tests covering conversation_id, previous_response_id, and auto_previous_response_id

Why

Fixes #2151.

When conversation_id, previous_response_id, or auto_previous_response_id is enabled, the server owns conversation history. Handoff input filters and nested handoff history rewrite the local history, which makes the next request diverge from the server-managed transcript.

Instead of allowing that mismatch to surface later as a confusing API error or incorrect behavior, this change fails fast with a clear UserError.

Testing

  • .venv/bin/pytest tests/test_agent_runner.py -k 'server_managed_conversation'
  • .venv/bin/pytest tests/test_run_step_processing.py -k 'handoff_can or missing_handoff_fails or multiple_handoffs_doesnt_error'

@seratch
Copy link
Member

seratch commented Mar 21, 2026

Thanks for suggesting this change. We've been receiving this type of fail-fast validation for this issue, but I don't believe that could resolve the issue (I agree it could mitigate the issue by preventing data issue tho). I came up with an alternative #2747; if you have any feedback, it'd be appreciated

@seratch seratch marked this pull request as draft March 21, 2026 06:18
@seratch seratch closed this Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nest handoff: Handoff is incompatible with server-managed conversation

2 participants