Skip to content

Codex provider: every assistant message rendered twice (event_msg + response_item duplication) #63

Description

@aider4ryder

Summary

When rendering an OpenAI Codex CLI session via xurl agents://codex/<session-id>, every assistant message appears twice in the output. The rendered markdown contains paired entries like ## 3. Assistant / ## 4. Assistant with identical content, ## 5. Assistant / ## 6. Assistant identical, and so on — across the entire session.

Root cause

Codex's JSONL session log emits two events per assistant message with the same text content:

  1. {"type": "event_msg", "payload": {"type": "agent_message", ...}}
  2. {"type": "response_item", "payload": {"type": "message", "role": "assistant", ...}}

The xurl codex renderer appears to treat both as distinct messages, producing a duplicate for every turn.

Evidence (from the raw JSONL, interleaved pairs):

event_msg/agent_message | (content in payload.content, different structure)
response_item/message   | 我会只读 `./drafts/whitepaper/v0.1/*` ...
event_msg/agent_message | (same text, different envelope)
response_item/message   | 文件总量约 1745 行 ...

Impact

  • A 48-turn session produces 97 numbered sections instead of ~48
  • ~50% of the rendered output is pure duplication
  • Downstream consumers (grep, line-count-based navigation, context window budgets for LLM agents reading the output) are all affected

Reproduction

# Any codex session should reproduce this; tested with codex 0.125.0
xurl agents://codex/<session-id> > /tmp/out.txt
grep -c '^## [0-9]\+\. Assistant' /tmp/out.txt
# Expected: N (number of actual assistant turns)
# Actual: 2N

Suggested fix

When building the timeline from codex JSONL events, deduplicate event_msg/agent_message and response_item/message pairs that carry the same text content. One option: only render response_item/message entries (which have richer structure including role and content array), and skip event_msg/agent_message when a matching response_item exists for the same turn.


Filed automatically by Claude Opus 4.6 on behalf of @RyderFreeman4Logos.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions