Fix missing isolation kwarg on update_response in bg non-stream finalization#46395
Merged
RaviPidaparthi merged 1 commit intomainfrom Apr 19, 2026
Merged
Fix missing isolation kwarg on update_response in bg non-stream finalization#46395RaviPidaparthi merged 1 commit intomainfrom
RaviPidaparthi merged 1 commit intomainfrom
Conversation
…ization In _run_background_non_stream's finally block, the update_response call was missing the isolation= keyword argument. The _isolation variable was only computed inside the else branch (for create_response) but not used by the if branch (for update_response). When isolation headers are present, Foundry storage creates the response in a scoped partition at response.created time (FR-003). The finalization update_response without isolation headers then targets the unscoped partition, gets 404, the error is silently swallowed, and the record is evicted from memory. All subsequent GET polls hit Foundry's stale in_progress snapshot, leaving the response stuck permanently. Fix: hoist _isolation computation above the if/else so both branches receive it. Includes: - Contract test verifying isolation propagation to update_response - CHANGELOG entry for 1.0.0b2
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Foundry storage partitioning bug in the Responses background non-stream finalization path by ensuring the request’s isolation context is forwarded to the terminal update_response call, preventing stuck in_progress responses when isolation headers are present.
Changes:
- Hoists isolation context computation in
_run_background_non_streamand passesisolation=intoupdate_response. - Adds contract tests to assert isolation propagation to
update_responseacross header combinations. - Documents the fix in the package changelog for
1.0.0b2.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_orchestrator.py | Ensures background non-stream finalization update_response uses the same isolation context as create_response. |
| sdk/agentserver/azure-ai-agentserver-responses/tests/contract/test_bg_isolation_propagation.py | New regression/contract coverage verifying isolation is forwarded to update_response in bg non-stream mode. |
| sdk/agentserver/azure-ai-agentserver-responses/CHANGELOG.md | Adds a bug-fix entry describing the isolation propagation issue and impact. |
vangarp
approved these changes
Apr 19, 2026
RaviPidaparthi
added a commit
that referenced
this pull request
Apr 19, 2026
Version bump for hotfix release: the isolation fix (PR #46395) merged after 1.0.0b2 was already published. CHANGELOG: new 1.0.0b3 section with the bg non-stream isolation bug fix.
RaviPidaparthi
added a commit
that referenced
this pull request
Apr 19, 2026
Version bump for hotfix release: the isolation fix (PR #46395) merged after 1.0.0b2 was already published. CHANGELOG: new 1.0.0b3 section with the bg non-stream isolation bug fix.
fafhrd91
pushed a commit
to fafhrd91/azure-sdk-for-python
that referenced
this pull request
Apr 28, 2026
…ization (Azure#46395) In _run_background_non_stream's finally block, the update_response call was missing the isolation= keyword argument. The _isolation variable was only computed inside the else branch (for create_response) but not used by the if branch (for update_response). When isolation headers are present, Foundry storage creates the response in a scoped partition at response.created time (FR-003). The finalization update_response without isolation headers then targets the unscoped partition, gets 404, the error is silently swallowed, and the record is evicted from memory. All subsequent GET polls hit Foundry's stale in_progress snapshot, leaving the response stuck permanently. Fix: hoist _isolation computation above the if/else so both branches receive it. Includes: - Contract test verifying isolation propagation to update_response - CHANGELOG entry for 1.0.0b2
fafhrd91
pushed a commit
to fafhrd91/azure-sdk-for-python
that referenced
this pull request
Apr 28, 2026
Version bump for hotfix release: the isolation fix (PR Azure#46395) merged after 1.0.0b2 was already published. CHANGELOG: new 1.0.0b3 section with the bg non-stream isolation bug fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
_run_background_non_stream's finally block, theupdate_responsecall was missing theisolation=keyword argument. The_isolationvariable was only computed inside theelsebranch (forcreate_response) but not used by theifbranch (forupdate_response).When isolation headers are present (
x-agent-user-isolation-key/x-agent-chat-isolation-key), Foundry storage creates the response in a scoped partition atresponse.createdtime (FR-003). The finalizationupdate_responsewithout isolation headers then targets the unscoped partition, gets 404, the error is silently swallowed, and the record is evicted from memory. All subsequent GET polls hit Foundry's stalein_progresssnapshot, leaving the response stuck permanently.Affected path:
background=True, stream=False, store=Truewith Foundry storage and isolation keys present.Fix
Hoist the
_isolation = context.isolation if context else Nonecomputation above theif/elsebranch so bothupdate_responseandcreate_responsereceive it.Changes
_orchestrator.py: Move_isolationcomputation before theif _provider_created:branch, addisolation=_isolationtoupdate_responsecalltest_bg_isolation_propagation.py(new): 3 contract tests using a recording provider that captures theisolationkwarg on everyupdate_responsecall — verifies both keys, user-only key, and no-keys scenariosCHANGELOG.md: Bug fix entry for 1.0.0b2