Skip to content

Codex code-mode tool calls (custom_tool_call with a string input) break conversion to opencode and lose the result for claude_code #104

Closed

Description

@davidj4tech

txcript 0.14.4 (x86_64-unknown-linux-gnu release), codex-cli 0.169.0

A Codex session whose tool call uses Codex's code mode (custom_tool_call, name exec, input a JS string) does not convert cleanly:

  • continue <id> --from codex --with opencode --no-resume fails:
    error: cannot convert to opencode: `opencode import` failed: Error: Unexpected error
    Expected object, got "text(await tools.exec_command({cmd:\"cat marker.txt\",max_output_tokens:1000}));\n" at ["state"]["input"]
    
    (It also leaves an empty session behind in opencode.)
  • --with claude_code writes a session that resumes, but the tool's result is missing: asked about it, the resumed model says the file read never returned anything.
  • --with pi came through fine in the same test.

The two records involved (from ~/.codex/sessions/..., trimmed):

{"type":"response_item","payload":{"type":"custom_tool_call","status":"completed","call_id":"call_bb06566fce2b4dc9bc3d78aeccea79c7","name":"exec","input":"text(await tools.exec_command({cmd:\"cat marker.txt\",max_output_tokens:1000}));\n"}}
{"type":"response_item","payload":{"type":"custom_tool_call_output","call_id":"call_bb06566fce2b4dc9bc3d78aeccea79c7","output":[{"type":"input_text","text":"Script completed\nWall time 0.2 seconds\nOutput:\n"},{"type":"input_text","text":"{\"chunk_id\":\"61df54\",\"wall_time_seconds\":0.000007394,\"exit_code\":0,\"original_token_count\":8,\"output\":\"The harbour gate code is 4471.\\n\"}"}]}}

Two things look relevant: the call's input is a string rather than a JSON object (opencode wants an object), and the output is an array of input_text blocks rather than a string, which may be why the result is dropped for Claude Code.

To reproduce: in a folder with a marker.txt, run codex exec "Read marker.txt and tell me what it says", then txcript continue <that id> --from codex --with opencode --no-resume (and --with claude_code).

Minor, same run: the Codex rollout files txcript writes are named by UTC time (rollout-2026-11-15T03-52-12-…), while Codex names its own by local time (rollout-2026-11-15T14-50-58-…).

Activity

  1. NishantJoshi00 commented on Nov 17, 2026

    @NishantJoshi00
    Collaborator

    Thanks @davidj4tech, nice find. Code mode is the default in Codex now, so this was biting real sessions. Fixed in #109.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions