Repository navigation
Deliver Codex input inline and unify reply handling - #3368
Merged
Merged
Conversation
Keep main's queued App Server deliveries, canonical response addresses and typed status writer while retaining compact hook envelopes and first-word diagnostics. Update the shared Codex contract and stream evidence coverage for main's progress-opening behavior.
The merged status contract uses None for an absent stream reply. Record the first nonblank publication from that state without dereferencing it, and retain one marker across later text updates. Extend the existing stream lease case to exercise direct first text and marker identity.
Preserve main's turn/start tool-output deliveries while retaining compact Codex hook envelopes, exact acknowledgements and stream diagnostics. Keep the unified Codex reference aligned with that transport and refresh instruction snapshots for progress and failure reports using the active revision.
leaf-agent
reviewed
Oct 20, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The new timing marker can interrupt reply delivery when observations.jsonl cannot be appended. _publish_stream_reply has already written the provisional words to page status, but it propagates the diagnostic write error into the App Server stream fold, which then retries instead of continuing. Keep this observation best effort so a diagnostic file cannot stop the user's answer.
A first-word observation is optional evidence after stream status has published. Report diagnostic I/O failures without aborting the reply, while explicit diagnostic ingestion retains its retryable write errors. Prove a real stream publishes and finishes with a blocked sink, and update remaining hook assertions and instruction snapshot for complete inline Codex input.
leaf-agent
previously approved these changes
Oct 20, 2026
Keep main's direct reply workflow, canonical response evidence and checked-publication return API. Preserve progress and failure reports on the active revision, while revision advice belongs to the first successful reply: failure receipts neither emit nor consume it. Retain bounded inline Codex hooks, explicit receipts, the shared installer and optional first-word diagnostics; move current App Server guidance into the unified Codex reference.
leaf-agent
approved these changes
Oct 20, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 20, 2026
…waiting and working (#3387) Max asked that the reply benchmark record both Leaf's share and the whole reply, and cover two cases: a comment that reaches a waiting harness and one that reaches a working harness. This change makes `leaf-dev journey` and `leaf-dev response-times` report both numbers for every reply. The whole reply is broken into its model calls. The note `notes/user-feedback-responsiveness.md` gets budgets for each number and case, a measured table on current main, and the model calls a small page change should take. ## The benchmark - **One home for a reply's breakdown.** `dev/leaf_dev/reply_phases.py` splits the span from a comment's admission to its reply into phases. `busy` is the harness on other work before it takes the comment, `delivery` runs until the comment is in the agent's context, and the rest is `model`, `tool` and `idle` time between turns. `reply_breakdown` sums the phases into the whole reply and Leaf's share (delivery plus tool phases that run `leaf`). It also groups model phases into the model calls the harness made, each with the tool calls it issued. The journey's old `turn_phases` moved here. - **Harness records carry turns and responses.** Each harness's normalized record marks where a model response ended and where a turn started and ended, using the harness's own signals. Claude Code's transcript gives the last record of each message id, `turnPosition`, `turn_duration` and `interruptedMessageId`. Codex gives `thread/tokenUsage/updated`, `turn/started` and `turn/completed`. Pi gives `turn_end`, `agent_start` and `agent_settled`. - **Two cases in every harness journey.** `journey.CASES` names them. The release ask reaches a waiting harness. The `mid-turn` step now asks for the same small page change, naming a release of its own, while the harness runs the user's 25 s command. Each step requires a revision that names its release. Each sample says which comment asked for which case. - **The table.** `uv run leaf-dev journey-chart --replies` tabulates the kept samples by target and case. - **Real pages.** `leaf-dev response-times` adds the breakdown for inputs that Claude Code answered, reading the transcript it finds by session id. On real pages Leaf's share is an upper bound, because a shell command that runs `leaf` among slower work counts whole. ## Readings on current main Four Claude Code journeys and three each on Codex App Server and Pi, at this branch on main `23acce2b1`. Seconds: | Harness | Case | Whole reply | Leaf's share | After the boundary | Model calls | | --- | --- | --: | --: | --: | --: | | Claude Code | waiting | 21.9–45.2 | 1.1–8.7 | 21.9–45.2 | 4–8 | | Claude Code | working | 35.5–41.9 | 0.9–1.2 | 10.8–17.0 | 2–3 | | Codex App Server | waiting | 14.1–19.4 | 0.5–0.9 | 14.1–19.4 | 4–5 | | Codex App Server | working | 38.6–43.1 | 0.7–0.8 | 13.9–18.4 | 3 | | Pi | waiting | 31.0–33.0 | 1.0–1.5 | 31.0–33.0 | 8–10 | | Pi | working | 40.0–41.7 | 0.7–0.8 | 14.8–16.5 | 6 | In the working case the harness was busy with the user's command for 24.5–25.2 s first, so the working budget counts from that boundary. Leaf's share was 0.5–1.5 s in 19 of 20 replies; the exception ran `leaf page check --render`. The model takes the rest. The proposed budgets are Leaf's share under 2 s in both cases, and a whole reply of Leaf's share plus two model calls. The note says which calls the replies spent beyond two: widget and registry lookups, and reference reads on a session's first comment. It also says why the two cases differ in more than the harness's state. Codex App Server ran main's delivery after the revert of #3357 (#3362) and #3368: Leaf starts a turn for an idle task, and the tool hook delivers inline to a working one. Earlier batches on #3357's queue path, before #3368 and #3372 landed, showed the two calls those changes removed. ## Review An independent Codex review ran over three rounds against real transcripts and the kept runs. It found idle gaps counted as model time, an idle harness read as busy, local commands and compaction summaries starting turns, and `end_turn` blocks ending turns early. All of these are fixed and checked on the page it used. The remaining limit is on real pages: Leaf's share counts a whole shell command that runs `leaf` among other work. The note proposes that each `leaf` command record its own duration. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
Busy Codex hooks currently supply a delivery pointer, leaving the agent another tool/model round trip before it can read the user's input. Supply the complete reader envelope as one compact JSON line when it fits the verified native output bound, with the existing pointer path for larger input. Keep explicit acknowledgement, exact-turn receipt fencing, immutable input and lost-output recovery.
Use one Codex contract driven by the delivery's writer and handling fields, retaining current main's App Server startup through
turn/startand its initialleaf_deliverytool output. Share plugin installation and launcher preparation across the native journey and evaluator. The parent still owns the Leaf conversation and delegates substantive work.Progress and failure replies use the active published revision even when the saved draft is invalid; successful answers still validate and publish it. Failure receipts do not consume revision advice owed by the first successful reply. The unified instructions follow main's direct-final workflow without a separate page-check prerequisite. Record the first streamed final-answer words through the canonical stream writer and read them through the existing response-time query, separately from completed answers. A failure writing this optional observation cannot interrupt reply streaming; explicit diagnostic ingestion retains its retryable error contract. This adds no new query or benchmark runner.
Validation: focused product and response-time checks, pre-commit and independent review; real Codex tool/Stop hook capacity and explicit-receipt proofs. Native journeys passed for App Server and queue delivery, rich inputs, mid-turn input and restart recovery. The later revision-advice integration is covered by focused response, advice and wire checks; the delivery transport did not change. The retained busy comparison is one native session per version: steering feedback was 26.3s with pointers versus 9.9s inline, while the inline completed reply arrived just after the fixed cutoff. That small pair establishes neither a stable latency improvement nor reliable parent delegation. Both harnesses' existing settled-agent cases received two completed replies. These timing cohorts precede the integration with current main; they are retained observations rather than timing claims about the integrated tree.