Reconcile API streams from State#2027
Open
AlexCheema wants to merge 11 commits into
Open
Conversation
d7c62aa to
caa300d
Compare
Base automatically changed from
codex/worker-custom-cards-state
to
codex/custom-model-cards-state
May 7, 2026 07:14
5592e65 to
e119e57
Compare
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.
Why
The API was still closing active streams by reacting directly to
InstanceDeleted. That violates the event-sourcing boundary: after snapshot bootstrap, the API may receive State that already reflects a deleted instance without replaying the deletion event.How
InstanceDeletedside-effect path.State.TaskCreatedhas not reached State yet, so the reconciler does not prematurely close fresh requests.Tests
uv run pytest src/exo/api/tests/test_instance_deleted_stream_cleanup.pyuv run pytestuv run ruff check src/exo/api/main.py src/exo/api/tests/test_instance_deleted_stream_cleanup.pyuv run basedpyrightnix fmt