You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Partition live execution, pending, deletion, and history state by the platform user key.
Partition SSE streams, resilient task IDs, multi-turn input/precondition IDs, and process-local recovery references by user without changing public response IDs.
Allow different users to execute the same public response ID independently; reject duplicate active or retained-replay IDs within the same user partition with 409 response_id_conflict (not POST idempotency).
Require provider authorization before persisted SSE replay; not-found and provider errors never fall through to cached events.
Preserve reservations until request cleanup, including store=False requests before record publication.
Reconstruct stream ownership from durable user context during recovery.
Compatibility and companion fix
Persistent provider partitioning is implemented separately in #49025. This PR requires a provider that enforces the supplied PlatformContext; it does not independently fix the existing built-in persistent providers. Deploy both fixes for complete built-in provider and runtime isolation.
Identified users do not adopt legacy shared task/replay state. Drain active tasks and retained replay state before upgrading. Anonymous identifier format is preserved. Identity headers must come from trusted platform authentication.
Validation
1,574 tests passed, 6 skipped across unit, contract, integration, conformance, and recovery reconstruction suites, including a rerun after rebasing onto current main.
Coverage includes concurrent same-ID user streams, cancellation/deletion independence, replay after eviction, persisted-owner versus foreign-live access, reservation-only creates, fail-closed provider errors, file replay rehydration, and reconstructed streaming tasks with durable user identity.
Pylint, MyPy, Black, and diff whitespace checks passed.
Bounded security review found no new vulnerabilities in the lifecycle changes; this is not hosted end-to-end or actual process-crash verification.
Restart-safe retained replay
Core stream lookup now restores existing persisted logs under the same per-ID lock used for creation/deletion, without creating absent replay files. Cold deletion also removes retained logs.
Same-user POST collisions still return 409 after restart; authorized GET replay and DELETE use the same scoped lookup. Missing, expired, locked, and inaccessible log cases have regression coverage.
Core is versioned at 2.2.1 (unreleased), and the Responses dependency requires that version so this fix cannot silently run with the old registry.
Additional validation: 1,581 Responses tests passed (7 skipped), 123 Core streaming tests passed (1 skipped), both packages passed Pylint and Linux-platform MyPy, and the bounded cold-replay security review found no new vulnerabilities. Restart tests reconstruct registries and release file handles; they do not simulate a real process crash.
Azure Pipelines:
Successfully started running 1 pipeline(s).
10 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.
After an actual process restart, the registry's _slots map is empty even when a file-backed replay log still exists. _StreamsRegistry.get() only checks _slots; rehydration occurs in get_or_create(). Therefore this reservation succeeds for an ID whose replay is still retained on disk, and the subsequent stream creation reopens the old closed log instead of returning the promised 409 response_id_conflict. The registry needs a non-creating persisted-stream probe/rehydration API (or equivalent) so admission can distinguish a retained file from a genuinely new ID.
This issue also appears on line 1466 of the same file.
Restore existing replay logs under the registry lifecycle lock for lookup and deletion without creating missing logs. Require Core 2.2.1 for restart-safe response admission and replay.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: abe83751-b37b-4b0a-ade2-715927c28cc2
The package's developer-facing streaming/streaming-internals.md:41-49,64-80 still says files are named from the public response_id and recovery calls get_or_create(response_id). For identified users this change instead requires the hashed lifecycle ID, so extension authors following that document will inspect or open the wrong stream. Update that architecture document to describe anonymous compatibility and user-scoped lifecycle keys.
Propagate file cleanup failures before installing tombstones. Keep response ownership until replay cleanup succeeds, and return errors rather than successful deletion on cleanup failure.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: abe83751-b37b-4b0a-ade2-715927c28cc2
Every missing get(id) now inserts an asyncio.Lock into _id_locks, but production code never removes these entries. The Responses admission path calls get() for every POST, including non-streaming and store=False requests that never create a stream slot, so ordinary traffic permanently grows this dictionary by one entry per response ID. Use ref-counted/transient per-ID locks (removing an idle lock only after all waiters are done) or another bounded synchronization strategy.
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
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.
Summary
409 response_id_conflict(not POST idempotency).store=Falserequests before record publication.Compatibility and companion fix
Persistent provider partitioning is implemented separately in #49025. This PR requires a provider that enforces the supplied
PlatformContext; it does not independently fix the existing built-in persistent providers. Deploy both fixes for complete built-in provider and runtime isolation.Identified users do not adopt legacy shared task/replay state. Drain active tasks and retained replay state before upgrading. Anonymous identifier format is preserved. Identity headers must come from trusted platform authentication.
Validation
Restart-safe retained replay