Files
pipelines/internal/codex/testdata
alan 83b60990d2 feat(codex): retain native session usage snapshots for chat
Verify typed ThreadTokenUsage/TokenUsageBreakdown/Thread/Turn against openai/codex@6fb1c3903d. Use native totalTokens and latest-call context tokens without re-adding cached/reasoning subsets. Replay bounded per-connection snapshots and clear on room/source release.

Cost stays unavailable: no subscription USD usage is reported by this notification. Throughput stays unavailable even with native Turn.durationMs because neither last-call nor cumulative-session output is a compatible turn-specific numerator. Thread readback exposes no token usage; no extra reads, resume, or live provider calls added.

Checks: go test -race ./internal/codex; go vet ./internal/codex; go test ./internal/server ./internal/protocol; git diff --check.
2026-10-21 00:07:12 +01:00
..

Codex model protocol fixtures

These use synthetic models/providers, never guessed production identifiers. Wire shapes were checked against the official app-server documentation and the generated protocol source matching the installed package manifest (Codex 0.163.0):

Model.model is the turn override, not the catalog row's opaque id. Thread.model is current configured/latest persisted metadata, not per-turn execution telemetry. thread/start also returns model/provider at the top level. The fixtures project fields consumed by this adapter and retain real casing and pagination shapes. Tests use an isolated fake WebSocket JSON-RPC server.

Local codex --version timed out before output, so schema generation was not reached; the installed codex-package.json identified version 0.163.0, so version-tagged generated source was read instead. No live app-server socket was contacted.

Model selection validates via thread/read + model/list, persists a Pipelines next-turn choice, and supplies turn/start.model only when the user sends a prompt. It never calls thread/resume, which can awaken a queued goal, nor any configuration-writing API. The acknowledgement means "saved for the next turn," not "remote settings changed." The override is supplied again after a Pipelines restart; an already-running turn is not reconfigured.

Attachment inputs

Attachment wire tests also use the installed 0.163.0 tag's schema/typescript/v2/UserInput.ts and TurnStartParams.ts. Verified PNG, JPEG and GIF bytes use localImage with an absolute local path. Other files (including unsupported/corrupt image formats) retain their bytes and use a mention name/path plus an explicit statement that the reference has not loaded their contents: the agent must inspect them with its normal tools. This does not bypass the thread's sandbox or grant filesystem permissions. Text inputs include the schema's text_elements array.

Only unchanged server-prepared file URIs are admitted; private regular files, eight-file/1 MiB combined bounds, and image decode allocation bounds are checked before turn/start. Files retain the existing attachment-store retention rules. History keeps local file/image parts; native image parts use the stored basename while a companion text input retains the original display name. All wire tests use fake JSON-RPC servers, never the production control socket.