Repository navigation
Read an App Server turn to its end in one place - #7568
Merged
Merged
Conversation
`app_server.follow_turn` reads one thread's notifications, buffered ones first, until a turn of it ends, and returns that turn. It replaces three loops that each did this with their own buffering, timing and completion check: Codex inference's answer read, the website's hosted-turn follower (and its `TurnStream` class), and the website's wait for an orphaned turn it interrupted to stop. A deadline bounds the wait for inference and for the interrupted turn; the hosted follower bounds silence between notifications, as before. Inference now keeps the notifications that arrive behind its `turn/start` response instead of dropping them, and waits for the turn that response names. The hosted follower's `turn_first_notification` record no longer carries `buffered`, which nothing read, and counts only the thread's own notifications. The follower now waits on the socket for the whole silence bound instead of waking each second to check it.
leaf-agent
approved these changes
Nov 28, 2026
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.
Adds
app_server.follow_turn, which reads one thread's notifications (buffered ones first) until a turn ends and returns that turn. It replaces three loops that each did this with their own buffering, timing and completion check: Codex inference reading its answer, the website's hosted-turn follower with itsTurnStreamclass, and the website's wait for an orphaned turn it interrupted to stop. The diff is line-neutral (+124/−123). The gain is one home for reading a turn to its end, so a change to how turns end lands once.What a reviewer should weigh:
follow_turntakes both adeadline(inference, and the interrupt wait that holds the user's request open) and asilencebound (the hosted turn, whose length is open-ended). Each caller keeps the timing it had.turn/startresponse, where it used to drop them, and waits for the turn that response names.turn_first_notificationrecord drops itsbufferedfield, which nothing read.The developer
codex_task.Taskstays as it is: it watches every turn of a thread across clients, not one turn to its end.Max asked for this as open item #4 of the Codex harness simplification (#7552). Tests: the website follower, dispatch and answer tests, the inference and title tests, a live Codex inference request, and the
website-adapteragent journey (passed on a rerun; in the first run the hosted turn ran to its own final answer, but the agent replied without publishing its edit).