Skip to content

fix(codex): follow-ups to #16 and #19 - #20

Merged
devswha merged 1 commit into
devswha:mainfrom
Yoonwoo-Ha:fix/codex-followups
Sep 24, 2026
Merged

devswha merged 1 commit into
devswha:mainfrom
Yoonwoo-Ha:fix/codex-followups

Conversation

@Yoonwoo-Ha

Copy link
Copy Markdown
Contributor

Follow-ups from the merge reviews of #16 and #19.

#19

codexHistoryTail still read the remembered chain as it was. Right after a backtrack, the live file's tail reached the archived parent and readRange threw, so the candidate was dropped. An app-server Codex TUI with no open rollout fd then had nothing to match, and the pane showed terminal output until the entry was evicted. Now codexHistoryTail and codexHistorySegments both use the chain only while every file in it exists, and look it up again otherwise. The check transcriptStream had of its own is folded into that.

#16

  • Candidates. The 32 candidates for a screen match are interactive threads only (source cli or vscode). A burst of codex exec runs no longer pushes the pane's own thread out.
  • Claims. Another pane claims a newer thread only when its screen shows that thread's first message (first_user_message) as well as its answer. A pane where this pane's answer is only quoted or pasted claims nothing. The screen is also matched against this pane's own thread and that pane's binding, so a match has to be unique across all of them.
  • Housekeeping. The conversation route hands its session snapshot down. An unsure poll takes no extra snapshot, and closed panes' bindings are dropped with it.
  • Not changed: narrowing vscode. On my machine, TUIs attached to a Codex Desktop app-server record originator = "Codex Desktop" too, including the TUIs herdr starts. So the store can't tell a Desktop or plugin thread from a TUI's thread. A thread that no pane shows keeps reading as "can't tell", never as another conversation.

Testing

  • bun run typecheck is clean; bun test: 281 pass.
  • Two new tests, each failing without its change:
    • codexHistoryTail after the parent is archived under a remembered chain
    • a pane still matches with 40 codex exec rows newer than its thread
  • The two-pane contract test now also checks that a pane showing only the other thread's answer (without its question) leaves this pane unsure, and that the pane that typed the question claims the thread. It fails without the first-message check.
  • Live, with two real Codex 0.156.1 panes in one folder, as for Keep a pane's Codex conversation while tool output fills the screen #16:
    • A was matched and its answer pushed off screen.
    • B was opened afterwards and answered, and A kept its conversation without anyone reading B's chat. That read took 24 ms (119 ms before this change).
    • A /new in A was never taken for its old conversation.

🤖 Generated with Claude Code

From the merge reviews:

- devswha#19: codexHistoryTail read the remembered chain as it was. After a
  backtrack the live file's tail reached an archived parent, the read
  threw, and an app-server TUI without an open rollout lost its screen
  match until the entry was evicted. Both codexHistoryTail and
  codexHistorySegments now use the chain only while every file in it
  exists, and look it up again otherwise. transcriptStream's own check is
  folded into that.
- devswha#16: the 32 candidates for a screen match are interactive threads only,
  so a burst of `codex exec` runs no longer pushes a pane's own thread
  out.
- devswha#16: another pane now claims a newer thread only when its screen shows
  that thread's first message as well as its answer. An answer of this
  pane quoted or pasted there claims nothing. Its screen is matched
  against this pane's own thread and its own binding too, so a match is
  unique across all of them.
- devswha#16: the conversation route hands its session snapshot down, so an
  unsure poll takes no extra snapshot, and closed panes' bindings are
  dropped with it.

Not changed: narrowing `source='vscode'`. On this machine, TUIs attached
to a Codex Desktop app-server record originator "Codex Desktop" too, so
the store cannot tell a Desktop or plugin thread from a TUI's. A thread
no pane shows keeps reading as unsure, never as another conversation.

Tests: the archived-parent tail and the exec burst each fail without
their change. A pane showing only the other thread's answer leaves this
pane unsure; the pane that typed it claims it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@devswha

devswha commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Merged. Thanks. Each change is guarded by a test that fails without it, and pruning uses only the route's own snapshot, so a failed snapshot can't wipe the bindings.

One trade-off worth writing down in the code or docs: a claim now needs the thread's first message within the other pane's last 400 lines. If pane B ran a long session while A's chat was closed, B's first question has scrolled off, so B's thread is never claimed and A shows "unavailable" until B's chat is opened. A first message under 8 normalized characters ("hi", "fix it") can never be claimed at all. It never shows the wrong conversation, so this is fine for now. A test for binding pruning and the uniqueness rule would also be welcome. Nit: codexHistorySegments's doc comment now sits orphaned above liveChain.

Yoonwoo-Ha added a commit to Yoonwoo-Ha/herdr-web-ui that referenced this pull request Sep 24, 2026
Rebased onto main (devswha#15 and devswha#20 merged). The whole answer runs inside
devswha#15's per-pane serialize: read, open the queue, keys, close. A composer
submit can't land between them.

Review follow-ups:
- "Send now" on a held message goes through the same check as the
  composer. It is disabled, with the reason as its title, while Codex's
  queue is open in the terminal.
- The remembered question (the one the queue really opened on) is
  matched by title and options, the newest such one. It is dropped when
  the pane's rollout changes. An older skipped question with the same
  title no longer takes its place.
- closeQueue tells the question just answered from its twin by prompt id,
  and after 600ms treats an identical question still open as the next one
  (Codex takes the Enter at once). Two questions with the same title and
  options no longer leave the queue open.

Checked live on Codex 0.156.1: two identical queued questions, each
answered from its card, with the queue folded back to "? 1 question" in
between. The earlier queue flows still pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Yoonwoo-Ha

Copy link
Copy Markdown
Contributor Author

Thanks. The follow-ups are in #23:

  • Trade-off. It is written above claimedByOtherPanes: the first message must still be in the other pane's last 400 lines and read as at least 8 letters or digits.
  • Test. A contract test covers the uniqueness rule and pruning, and each part fails without its code.
  • Doc comment. codexHistorySegments's comment is back in place.

devswha pushed a commit that referenced this pull request Sep 24, 2026
From the merge reviews.

#15 (composer submit):
- A submit is stamped when it reaches the server. Nothing of it is typed
  once 45s have passed, whether it waited behind a stalled message in the
  pane's queue or not: it answers submit_timeout ("nothing was typed").
  A send that starts in time ends within two more 10s RPCs, and the
  client now waits 90s, so a message it gave up on never reaches the pane
  later. A contract test with a 50ms deadline fails without the check.
- The collapsed-queue fallback no longer takes a numbered menu row
  (`› 1. …`) under the queue for the main prompt.
- Text typed after the sent part keeps its leading whitespace. An edit
  inside the sent part while it was on its way stays in the box with a
  note that it was not sent, rather than silently waiting for a resend
  that would duplicate it (checked in a browser).

#20 (Codex bindings):
- The claim trade-off is written down where it lives: the other pane's
  first message must still be in its last 400 lines and read as 8+
  letters or digits, otherwise this pane stays unsure. It never shows
  another conversation.
- A contract test covers the uniqueness rule (a pane whose screen also
  matches this pane's thread claims nothing) and pruning (a closed pane's
  binding stops counting). Each part fails without its code.
- codexHistorySegments' doc comment is back above it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
devswha added a commit that referenced this pull request Sep 24, 2026
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