Repository navigation
Read threads in the order they were said - #3358
Merged
Merged
Conversation
A message the user sent after the agent's progress line stood above that line. Two mechanisms put words said earlier at the thread's end: the browser pinned the working message as the transcript's last child, and the Codex App Server adapter streamed a turn's opening commentary as the head of its provisional reply, which the server draws at the thread's end until the final answer commits. Either way the user's newer message landed above words said before it. A thread now reads in log order, and what the log does not hold yet stands at its end: - The working message stands where its words were said, after the last message logged before them. Served workflows carry `detail_seq`, the log position of the start whose line `detail` is, so a start's line can be placed as well as a progress message's. - Each run of progress no answer has folded shows as one dim line, its latest step, where the run was said (`transcript.js`). The run the agent's current work speaks through is the live working message. A run the work leaves keeps its line in place, so a new step after the user's message appends below it and moves nothing above. - An answer folds only the progress run it follows with no user message in between (`events._ephemeral_ranges`). A run the user spoke after stays where it was said, and its line offers its earlier steps through its own "Show N progress messages". Before, the answer folded every run it completed, which either moved the user's message up or held the answer behind a notice. - A Codex turn's opening posts as an ephemeral progress reply once it is complete, as every other harness's first line does, so it becomes the working message where it was said. The provisional reply and the committed answer are now the final answer alone. The opening's paragraphs join into one line, a refused post is reported rather than ending the turn, and an opening whose completion a reconnect missed posts when the next item begins. Behavior that changed in tests: - `test_ephemeral_updates_wait_for_an_answer_and_preserve_user_interjections` and `test_ephemeral_progress_folds_when_its_held_completion_is_revealed`: progress followed by a user message is no longer folded into the answer. - `test_app_server_events_report_semantic_codex_progress`: a committed reply is the final answer alone; the opening arrives as `opening`. - The App Server clause in `registry.json`, `harness-codex-app-server.md`, the leaf.page prompt and How it works say the opening posts as the progress line (regtest snapshots regenerated). New tests: the panel journey (send after progress, next step, answer) under the shift watch; a kept run's disclosure and a held rewrite of its step, collapsed and opened; the Codex opening's post, its one-line form, the reconnect case and the commit without it; `workingPlace`. Checked: `leaf-dev journey codex-app-server` passed every step, the opening posting as progress about 2.3 s after each comment. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # build/browser/contract.d.ts # build/browser/protocol-baseline.json # tests/process/website_server/_regtest_outputs/test_app_server.test_hosted_agent_receives_the_response_instructions_and_delivery__0/snapshot.yaml
# Conflicts: # tests/model/interact_contract/_regtest_outputs/test_layer_contract.test_each_route_hands_the_agent_what_the_snapshot_shows__0/snapshot.yaml # tests/process/website_server/_regtest_outputs/test_app_server.test_hosted_agent_receives_the_response_instructions_and_delivery__0/snapshot.yaml
leaf-agent
approved these changes
Oct 20, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 20, 2026
…turn" (#3357) (#3362) Reverts #3357. That change put every Codex App Server delivery on the task's Codex queue, so each one became the user message of its turn: Leaf's opening line and the envelope as JSON, in the user's Codex transcript and queue. In Codex a message added to the user turn is noisy, and Leaf should add one only when it must. Deliveries go back to `turn/start` with a `leaf_delivery` tool output (`turnTrigger: "leaf"`), which adds no user message. This reopens the race #3357 closed: a follow-up the user queued in Codex starts just after the running turn ends, a Leaf `turn/start` in that gap steers into the follow-up's turn, and Leaf posts its answer as the reply. Reproduced on this branch with the note's script (codex-cli 0.160.0): Leaf's `turn/start` landed in the turn holding `Reply: USER FOLLOW-UP`. `notes/codex-integration.md`, "Delivery-start race", and its TODO entry are back, saying why the queue route was reverted. The note also records a new measurement: the Codex TUI keeps a follow-up queued with Tab in its own state, not in App Server's queue (`thread/queue/list` returned no items while the TUI showed one queued, and the TUI sent its `turn/start` 17.5 ms after the turn completed), so reading App Server's queue before starting can't close the race. The TODO entry is a decision for Max again. Kept: #3357's TODO entry for a user who steers into Leaf's delivery turn, which predates it, and #3358's opening-as-progress-line wording, which the two regenerated snapshots carry on the restored `turn/start` input. Checks: the focused Codex tests (`test_codex_app_server`, `test_codex_adapter`, `test_hooks`, `test_responses`, the layer contract, `tests/process/website_server`) pass, and the `codex-app-server` and `website-adapter` journeys passed. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 1, 2026
…t the reply clause's copy (#4884) The developer instructions that leaf.page's hosted Codex agent starts with were a triple-quoted string in `leaf_website`. They now live in `worker/leaf_website/hosted-agent.md`, which `CODEX_INSTRUCTIONS` reads, so an edit to them diffs as prose. The file also drops one sentence: "Your opening commentary shows in the thread at once as your progress line, and your final answer is your reply to the user." Every hosted delivery that owes a reply carries the App Server answering clause in `browser/runtime/kernel-registry.json`, which says the same, and `skills/leaf/references/harness-codex.md`, "Replies", says it a third time. The copy here had to be rewritten in step with the clause when #3358 changed how the opening posts. `evals/website-replies`, three repeats on Codex: | Instructions | Hosted runs passing every check | Follow-ups answered without a preamble | |---|---|---| | main | 6/6 | 3/3 | | whole reply paragraph cut | 5/6 (one opening read "I'll inspect the current Leaf page and its guidance…") | 1/3 | | this PR (mechanics sentence cut) | 6/6 | 2/3 | So the paragraph's other sentence, on a brief acknowledgement and no preamble for an immediate answer, stays; it now says "the user" where it said "them". > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 19, 2026
…6508) A progress step (an ephemeral reply) stood as a thread's dim working line until the agent next spoke there, so a turn that ended on a step left it standing indefinitely: 18 of the 26 open threads ending on a step on this machine owed nothing. Now the server says what ended each step (`completed_by`): the agent's next message in the thread, or the end of the turn that wrote it, unless a message of the user's before the step still waits on an answer. That exception keeps a line fork's line, whose turn closes in seconds, and keeps owed work on today's rule, as Max chose. The "Show N progress messages" disclosure is gone, as he asked, with the pending-progress machinery behind it. | Before | After | | --- | --- | | <img width="340" alt="Thread card: an answer, then a dim 'Recording your pick on the page' line after the turn ended" src="https://gist.githubusercontent.com/max-sixty/433b8beba15ad9fb606978c5f61e146b/raw/ccf0ff2e13a996a5cbfe00d1e4a1569c2bcc6876/before.png"> | <img width="340" alt="The same thread card ending on the answer" src="https://gist.githubusercontent.com/max-sixty/433b8beba15ad9fb606978c5f61e146b/raw/ccf0ff2e13a996a5cbfe00d1e4a1569c2bcc6876/after.png"> | To weigh: a step the user wrote after isn't ended by the agent's next step, only by its next reply, so a new step below the user's message never moves it or gets held out of sight (main avoided the same move in #3358). A failure receipt now ends the step before it. A step leaving mid-thread, by a message or by its turn, holds news as a message's fold does. Tests: model, runtime and the 35 affected browser and journey tests pass. Two journeys fail on main's runtime too: `test_an_open_card_takes_news_without_moving_its_controls`, and intermittently the shift-watch teardown of `test_a_reply_sent_after_progress_stands_below_it`. > _This was written by Claude Code on behalf of max-sixty_
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.
A message the user sent after the agent's progress line stood above that line. Two mechanisms put words said earlier at the thread's end: the browser pinned the working message as the transcript's last child, and the Codex App Server adapter streamed a turn's opening commentary as the head of its provisional reply, which the server draws at the thread's end until the final answer commits. Either way the user's newer message landed above words said before it.
A thread now reads in log order, and what the log does not hold yet stands at its end:
thread-card.jsworkingMessage,summary-ranges.jsworkingPlace). Served workflows carrydetail_seq, the log position of the start whose linedetailis, so a start's line can be placed as well as a progress message's.transcript.js). The run the agent's current work speaks through is the live working message. A run the work leaves keeps its line in place, so a new step after the user's message appends below it and moves nothing above.events._ephemeral_ranges). A run the user spoke after stays where it was said, and its line offers its earlier steps through its own "Show N progress messages". Before, the answer folded every run it completed, which either moved the user's message up or held the answer behind a notice; the shift watch caught the move.codex.pyAppServerReplyStream.open). The provisional reply and the committed answer are now the final answer alone. The opening's paragraphs join into one line, a refused post is reported rather than ending the turn, and an opening whose completion a reconnect missed posts when the next item begins.What remains at the thread's end by the same rule is an answer still streaming: a message sent during that stream is logged before the answer, so it stands above it, and nothing moves when the answer commits.
Behavior that changed in tests:
test_ephemeral_updates_wait_for_an_answer_and_preserve_user_interjectionsandtest_ephemeral_progress_folds_when_its_held_completion_is_revealed: progress followed by a user message is no longer folded into the answer.test_app_server_events_report_semantic_codex_progress: a committed reply is the final answer alone; the opening arrives asopening.registry.json,harness-codex-app-server.md, the leaf.page prompt and How it works say the opening posts as the progress line (regtest snapshots regenerated).New tests: the panel journey (send after progress, next step, answer) under the shift watch; a kept run's disclosure and a held rewrite of its step, collapsed and opened; the Codex opening's post, its one-line form, the reconnect case and the commit without it;
workingPlace.Checked:
leaf-dev journey codex-app-serverpassed every step, the opening posting as progress about 2.3 s after each comment. An independent Codex review found five gaps over two rounds (multiline opening, edited face shifting unheld collapsed and opened, kept run with no disclosure, reconnect losing the opening); each is fixed with a test that fails without it.