Skip to content

Read an App Server turn to its end in one place - #7568

Merged
max-sixty merged 1 commit into
mainfrom
app-server-follow-turn
Nov 28, 2026
Merged

max-sixty merged 1 commit into
mainfrom
app-server-follow-turn

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

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 its TurnStream class, 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_turn takes both a deadline (inference, and the interrupt wait that holds the user's request open) and a silence bound (the hosted turn, whose length is open-ended). Each caller keeps the timing it had.
  • Inference now keeps the notifications that arrive behind its turn/start response, where it used to drop them, and waits for the turn that response names.
  • The hosted follower's turn_first_notification record drops its buffered field, which nothing read.

The developer codex_task.Task stays 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-adapter agent 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).

This was written by Claude Code on behalf of max-sixty

`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.
@max-sixty
max-sixty merged commit 7de8f24 into main Nov 28, 2026
7 checks passed
@max-sixty
max-sixty deleted the app-server-follow-turn branch November 28, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants