Skip to content

Python: Scope mixed-pause Host response correlation to the active batch #8573

Description

Description

Split from #8436 after full review of #8518.

Session-backed mixed approval/Host recovery must correlate responses only with the active stored batch. The current candidate conflict handling scans every function_result in the supplied transcript. When an older id-less Host result shares a reused call_id with the active batch, a valid current occurrence-identified Host result can fill the active slot and the historical result is then reported as a conflicting duplicate.

Expected behavior:

  • occurrence-identified Host results reserve their active occurrence before id-less compatibility matching;
  • equivalent duplicates are inert only when attributable to an active Host occurrence;
  • conflicting duplicates for an active occurrence fail closed;
  • completed or abandoned historical Host requests and results remain inert, including when they reuse the active batch's call_id;
  • stateless and session-backed correlation preserve model order and never execute an approval from unrelated response history.

Acceptance criteria:

  • Add a regression with a historical id-less Host result and a current identified result sharing one call_id.
  • Keep the existing identified/id-less equal-payload and conflicting-duplicate regressions.
  • Limit the production change to response ownership/correlation; do not include provider-outbox recovery.
  • Validate the affected function-calling-loop specification scenarios.

Code Sample

# Historical completed Host occurrence
old_result = Content.from_function_result(call_id="reused", result="old")

# Active session-backed mixed batch reuses the provider call_id
current_result = Content.from_function_result(call_id="reused", result="current")
current_result.id = "current-occurrence"

# The historical id-less result must remain inert; it must not conflict with
# or satisfy the active occurrence.

Error Messages / Stack Traces

RuntimeError: Conflicting Host response for mixed pause call_id 'reused'.

Package Versions

agent-framework-core: current main / unreleased

Python Version

All supported Python versions (3.10-3.14)

Additional Context

Original combined issue: #8436

Reviewed implementation: #8518

This issue intentionally covers only Host-result ownership, matching, duplicate handling, and conflict detection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agentsUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions