Skip to content

[BREAKING] Python: add Responses conversation ID helper - #7234

Merged
eavanvalkenburg merged 7 commits into
microsoft:mainfrom
eavanvalkenburg:add-hosting-responses-conversation-id
Jul 21, 2026
Merged

[BREAKING] Python: add Responses conversation ID helper#7234
eavanvalkenburg merged 7 commits into
microsoft:mainfrom
eavanvalkenburg:add-hosting-responses-conversation-id

Conversation

@eavanvalkenburg

@eavanvalkenburg eavanvalkenburg commented Jul 21, 2026

Copy link
Copy Markdown
Member

Motivation & Context

App-owned Responses hosting needs a supported way to mint conversation IDs and distinguish stable conversation continuations from previous-response continuations without re-inspecting the request body.

Description & Review Guide

  • What are the major changes? Adds the public create_conversation_id() helper, returning conv_ plus a UUID hex value; changes responses_session_id() to return (session_id, is_conversation_id); and renames the optional session_id keyword on both response converters to the clearer conversation_id. The session flag is True for a conversation ID, False for a previous response ID, and None when no session ID is present. Updates package documentation, tests, and affected samples.
  • What is the impact of these changes? Hosting applications can generate Responses-shaped conversation IDs and branch directly on the returned flag. Existing callers of responses_session_id() must unpack the new tuple return value, and callers supplying a conversation to either response converter must use the renamed keyword.
  • What do you want reviewers to focus on? The tuple semantics, including preserving previous_response_id precedence when both request fields are present, and the narrower conversation-only parameters on the response converters.

Related Issue

No issue was created for this small change, as requested. No duplicate open PR was found.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2dd9980a-b869-4c16-8642-75b7a6d6ebdf
Copilot AI review requested due to automatic review settings July 21, 2026 08:12
@giles17 giles17 added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible labels Jul 21, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2dd9980a-b869-4c16-8642-75b7a6d6ebdf

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the Python agent-framework-hosting-responses helpers to provide a supported way for hosting apps to mint Responses-shaped conversation IDs and to reliably distinguish conversation_id continuation from previous_response_id continuation without re-parsing the request body.

Changes:

  • Added public create_conversation_id() helper (conv_ + UUID hex).
  • Changed responses_session_id() to return (session_id, is_conversation_id) and updated tests, docs, and samples accordingly.
  • Updated sample route logic to use the new tuple semantics.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
python/samples/04-hosting/af-hosting/local_responses/app.py Updates sample route to unpack responses_session_id() and branch using is_conversation_id.
python/samples/04-hosting/af-hosting/local_responses_workflow/app.py Updates workflow sample to unpack the tuple and reject conversation_id continuations.
python/packages/hosting-responses/tests/hosting_responses/test_parsing.py Adds tests for create_conversation_id() and updates responses_session_id() assertions to the tuple return.
python/packages/hosting-responses/tests/hosting_responses/test_http_round_trip.py Updates test server route to unpack the tuple and compute conversation_id via the flag.
python/packages/hosting-responses/README.md Updates documentation and example code to reflect tuple return and new helper.
python/packages/hosting-responses/agent_framework_hosting_responses/_parsing.py Implements create_conversation_id() and updates responses_session_id() signature/behavior to return (id, flag).
python/packages/hosting-responses/agent_framework_hosting_responses/init.py Re-exports create_conversation_id as part of the public package surface.

Comment thread python/packages/hosting-responses/README.md Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 5 | Confidence: 90% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach


Automated review by eavanvalkenburg's agents

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2dd9980a-b869-4c16-8642-75b7a6d6ebdf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2dd9980a-b869-4c16-8642-75b7a6d6ebdf
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/hosting-responses/agent_framework_hosting_responses
   _parsing.py48320657%97, 120, 250, 254, 269–272, 274–279, 281–284, 288–298, 307–311, 342–344, 346–350, 354–357, 359–362, 364–367, 381–412, 476, 490, 510, 513–516, 518, 537–544, 546, 562–564, 578, 590, 602, 617–624, 626, 637–638, 652, 661–663, 673, 678, 687, 691, 695–696, 701–704, 711, 715–723, 727–732, 736–743, 747–751, 755–757, 761–763, 767–769, 774, 776, 781–787, 793–796, 804–808, 814, 816–818, 823–829, 833–836, 916
TOTAL44844510388% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
9141 33 💤 0 ❌ 0 🔥 2m 28s ⏱️

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2dd9980a-b869-4c16-8642-75b7a6d6ebdf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2dd9980a-b869-4c16-8642-75b7a6d6ebdf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2dd9980a-b869-4c16-8642-75b7a6d6ebdf
@eavanvalkenburg
eavanvalkenburg added this pull request to the merge queue Jul 21, 2026
Merged via the queue into microsoft:main with commit a70fe21 Jul 21, 2026
38 checks passed
eavanvalkenburg added a commit to eavanvalkenburg/agent-framework that referenced this pull request Jul 21, 2026
Include the breaking Hosting Responses conversation ID helper changes from microsoft#7234 in the Python 1.12.0 changelog.

Copilot-Session: 2dd9980a-b869-4c16-8642-75b7a6d6ebdf
kartikmadan11 pushed a commit to kartikmadan11/agent-framework that referenced this pull request Jul 21, 2026
* Bump Python package versions for 1.12.0 release

Bump packages represented in the 1.12.0 changelog, promote Foundry Hosting, Azure Content Understanding, Gemini, Mistral, Monty, and Tools to beta, and apply the requested beta cohort date stamp. Root and core move to 1.12.0, released and RC packages use their selected increments, alpha packages including Hosting MCP use the 260721 stamp, and core floors are raised only for proven consumers.

Copilot-Session: 2dd9980a-b869-4c16-8642-75b7a6d6ebdf

* fix version in readme

* Add Responses conversation ID changes to release notes

Include the breaking Hosting Responses conversation ID helper changes from microsoft#7234 in the Python 1.12.0 changelog.

Copilot-Session: 2dd9980a-b869-4c16-8642-75b7a6d6ebdf
This was referenced Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants