Skip to content

Conversation

@giles17
Copy link
Contributor

@giles17 giles17 commented Jan 20, 2026

Motivation and Context

Fixes stale tool-call routing by preferring the freshest conversation_id propagated via runtime kwargs

Resolves #3304

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings January 20, 2026 22:08
@github-actions github-actions bot changed the title Prefer runtime kwargs for conversation_id in OpenAI Responses client Python: Prefer runtime kwargs for conversation_id in OpenAI Responses client Jan 20, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Jan 20, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework/openai
   _responses_client.py56011779%250, 255, 257–258, 269, 287, 295, 298–305, 307, 311–312, 314–323, 329, 334–338, 340–341, 343, 380, 412, 437, 443, 461–462, 484, 489, 545, 559, 576, 589, 644, 723, 728, 732–734, 738–739, 762, 777–778, 782–784, 831, 853–854, 869–870, 888–889, 978–979, 988–989, 1020–1021, 1037, 1039, 1114–1122, 1145–1151, 1170, 1188–1189, 1198, 1203–1205, 1211–1212, 1225, 1240, 1276–1277, 1279–1281, 1295–1297, 1307–1308, 1314, 1329
TOTAL17437270184% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3176 213 💤 0 ❌ 0 🔥 1m 4s ⏱️

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical bug in tool-call routing by changing the priority order for conversation_id retrieval. The fix ensures that runtime-updated conversation IDs (passed via kwargs during tool execution loops) take precedence over the initial configuration (stored in options dict).

Changes:

  • Modified _get_current_conversation_id to check kwargs before options, ensuring fresh conversation IDs from tool execution loops are used instead of stale initial values

@giles17 giles17 enabled auto-merge January 21, 2026 02:46
@giles17 giles17 added this pull request to the merge queue Jan 23, 2026
Merged via the queue into microsoft:main with commit e8b32ca Jan 23, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: Tool calling not working with Responses API

3 participants