Repository navigation
refactor(codex): say how a pane's conversation was found, and pin the text matchers' callers - #4899
Conversation
… text matchers' callers
codexTranscriptPath returns { path, how }: served when the Codex server Ovis
started beside the pane names the thread, held when the pane's Codex (or the
server its TUI runs on) holds the rollout open, inferred for every other way.
No caller acts on it yet. A conventions test pins today's call sites of the
screen and title matchers, so their number can only shrink.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
…tion in the matcher ratchet A rollout whose file behind the descriptor's path is not proven is no longer graded held. The ratchet now counts every mention of the text matchers, matchCodexFirstExchange included, so an alias, an optional call or bracket access cannot add a caller unseen.
|
Reviews at this head (08fcadc):
|
Main's tmux path (#3762) returned a bare path; it is descriptor-proven, so it is held. Its peer test reads the path through the test helper.
|
Merged through
omo gate CLEAR at 08fcadc (dori review) and one Codex gpt-6.2-sol-fast xhigh review (no HIGH; its 3 MEDIUM fixed in 08fcadc); 51b8cbc only merges main and grades main's new tmux path (#3762) held; CodeRabbit did not review this head; merge on the lead's word (Dori). The pending-input contract test change only adapts its codexTranscriptPath mock to the new return shape. |
…e a cut read (#4964) Refs #1478 (fixes the two bugs @xqdd reported there; the upstream per-TUI thread signal is still missing, so the issue stays open). Both still happened on main after #4852 and #4899. 1. **A cut read of another thread blocked the match.** A thread whose last turn ends with one huge tool-output line (2.2 MB on a real 16.4 MB rollout here) loses its last prompt in the 1 MiB tail read, so `lastFinishedTurn` returns `asked: null` and `askedElsewhere` treats it as "maybe asked what the pane shows". New `withCutPrompt` reads that turn's prompt lines back from the rollout (at most 16 MiB back, only from that turn's `task_started` or the file start, never a half prompt, skipping `history_base` continuations, cached per file state). If it is not found, nothing changes and the pane stays in the terminal. (This is not about `history_mode = paginated`: every thread on the test PC is paginated.) 2. **More than 32 threads in the folder.** `listed = rows.length <= 32` switched the last-turn path off. A crowded folder now also runs it, but its answer counts only when the thread it finds is loaded (some Codex holds it), the rule `loadedRollouts` already documents. With no loaded proof, or more than 32 loaded threads, it stays null as before. The other `listed` uses are unchanged. Tests (`server/codex-processes.test.ts`, through `codexTranscriptPath` with a temp Codex home): "binds the short answer of the pane's own loaded thread in a folder of more threads than are read (#1478)" and "binds a short answer beside a thread whose read a long tool output cut above its last prompt (#1478)" both get `null` on main and pass here; they also check it stays `null` before the thread is loaded and when another thread really was asked the shown prompt. A throwaway check with a real 24 MB rollout returned `null` on main and the pane's rollout here. Focused runs: `codex-processes.test.ts -t "#3262"` 111 pass, `codex.test.ts` 125 pass, changelog and conventions tests, `bun run typecheck`. No UI or HTTP/WS contract change.
What
codexTranscriptPathnow says how it knew a pane's Codex conversation, not only which one:it returns
{ path, how }instead of a bare path.server/codex.ts)howservedRollouts, #4852)servedopenRollouts)held(inferredwhen the file behind the path is not proven)--remoteTUI runs on holds that rollout open with its write lock (ownServerRollout)heldtmuxRollout, #3762)heldinferredThe grade is informational: no caller acts on it yet, so behaviour does not change. The two callers
(
server/conversation.ts,server/prompt.ts) read.pathas before.A ratchet in
server/conventions.test.tspins where the text matchers (matchCodexTranscript,matchCodexFirstExchange,loadedConversation,matchShortCodexAnswers,lastTurnConversation,opencodeTitled,opencodeSessionsTitled) are named in production server code: today's count ofmentions per file (
codex.ts21,herdr-core/adapter.ts3,herdr-core/runtime.ts3,opencode.ts1). Every mention counts (definitions, imports, aliases,?.(, bracket access), so anew caller cannot slip past. A new mention or a new file fails the test; a lower count asks for the
pin to be lowered, so the number can only shrink.
No UI change and no HTTP/WS contract change:
howstays server-internal. A visible "inferred"marker would sit on nearly every hand-opened Codex chat, and the resolver already returns null
(terminal fallback) when it cannot tell.
Tests
server/codex-processes.test.ts: a rollout the pane's Codex holds open comes back asheld, asdoes the one the app server beside a
--remoteTUI holds; one found by the screen, or by theloaded threads and the screen, comes back as
inferred.server/approvals/codex.test.ts: the thread the pane's own server names comes back asserved;one the screen picks among that server's threads comes back as
inferred..paththrough a small helper, unchanged otherwise.