Fix Codex transcript streaming and images

This commit is contained in:
iris committed 2026-09-09 15:14:24 -04:00
1 parent 14dd520719
commit 4dc3e3d784
7 files changed
+422 -53

No files matched your search

+22
View File
@@ -227,6 +227,28 @@ shown as unavailable while the free-text escape remains. Permission choices
are likewise reported per provider: Codex offers its read-only,
workspace-write and full-access modes, while Claude keeps its own modes.
Resuming passes `excludeTurns: true`: this app already owns and pages its
common transcript, so asking app-server to hydrate the complete Codex history
only sends the rollout a second time. That is especially costly for image tool
results, whose protocol records carry base64 data. Live structured tool
results are split at the driver boundary: text becomes tool output and each
image is saved under the session and emitted as `Image`, never serialized into
a transcript line. Images attached to a remote Codex session ride the stdio
protocol as inline image input, since the server's local attachment path does
not exist on that machine. `thread/tokenUsage/updated.last.inputTokens` is the
measured context (cached input is already included), while `last.totalTokens`
remains the turn's usage. If an older common transcript has no such event yet,
the server seeds the same measurement from the last `token_count` in Codex's
own rollout, including when that rollout is on an SSH setup.
App-server assistant text comes only from its durable
`item/agentMessage/delta` notifications; the full text on `item/completed` is
always the consolidated copy and is ignored. This is decided from the dialect,
not an in-memory set of ids: after a backend restart, the previous deltas can
be behind the persisted stdout cursor while the completion is still ahead,
and forgetting which ids streamed used to append the complete message after
its already-recorded prefix.
### The llama driver
One `llama-server` per session, started through the same `Transport` as any