ac4af582301a4e8a29245dbba767eba31334ddf9
1
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c8ed37e126 |
sessions: each Codex response exported to Langfuse carries only its own reply and tool calls, with the turn's prompt, and a finished turn exports once (#2284, JuckZ)
JuckZ's Codex Desktop trace in Langfuse showed one reply repeated on every
later response of its turn, no prompt or tool linkage, and a completed turn
exported a second time as failed.
- token_usage_record copied t.output (the turn's last AgentMessage, a role-less
text array) into every later response, including tool-call-only ones. Each
generation now takes its bodies from the rollout's response_items: input is
the base instructions (session_meta) as a system message, the turn's
developer/user messages, and the tool results fed back since the previous
response; output is only that response's assistant text and tool calls, in
OpenAI chat shape with call IDs. Turn IDs fall back to the desktop's
internal_chat_message_metadata_passthrough.turn_id, then the current turn
(the CLI records none).
- task_complete/turn_aborted deleted the turn but left it current, so the
following thread_settings_applied recreated it and the next task_started
exported it again as an inferred, failed root under the same ID.
- Extension items (web search, image generation) get a span named by kind with
query/action/prompt in and results/saved_path/failure out; FileChange gets
its diff, ImageView its path. Never the image generation's base64 result.
Not copied from the reference: it rebuilt the whole turn history for every
response. That is quadratic, and the user's real rollouts carry 2-3MB
screenshots in tool outputs and 100-400KB data-URL images in prompts, which
it would repeat on each response. Here inline images in a prompt or fed-back
result are named ("[image image/png, N bytes not exported]"); the tool's own
span keeps the output as recorded. Siblings: Claude, Pi/omp, Gemini and
OpenCode already give each response its own message's content; the reused
output and the recreated root were Codex-only.
Fixture: internal/sessions/testdata/traces/codex-desktop-sanitized.jsonl is
JuckZ's file byte for byte (cmp against d96139c2), described in the README.
Run (worktree on origin/main
|