openai / openai/codex

Support reliable cross-provider session handoff with normalized tool history

Open
#38,365 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CLI custom-model enhancement session tool-calls
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

What variant of Codex are you using?

CLI

What feature would you like to see?
Feature request

Codex should support handing off a long-running session from one model provider
to another while preserving its working context.

Example:

  • Continue a long GPT session with a custom Responses-compatible provider when
    the GPT quota is exhausted.
  • Later hand the resulting session back to OpenAI models.
  • Preserve completed conversation history, decisions, tool results, and project
    context without requiring a manual summary.
Current behavior
  1. codex resume across providers is unreliable because the session retains its
    original provider-specific state.

  2. codex fork -p <provider> -m <model> <session-id> copies the history, but the
    destination provider may reject valid historical tool records.

  3. In my case DeepSeek returned:

    No tool output found for tool call call_mj42PDsUwFvbo5vPJM4Kunyd

  4. The corresponding custom_tool_call_output was present in the rollout file,
    but a developer message occurred between the tool call and its output.
    OpenAI accepted this history; the custom provider rejected it.

  5. Provider-specific pickers also make the source session difficult to locate,
    requiring its UUID.

Desired behavior

Before a cross-provider resume or fork, Codex should normalize the transcript
into a provider-neutral representation:

  • preserve all user and assistant messages;
  • preserve completed tool calls and outputs;
  • guarantee valid call/output pairing and ordering;
  • remove or transform provider-specific protocol items;
  • retain the source session as an unchanged rollback point;
  • clearly indicate that the destination is a new session derived from the
    original session.

Ideally:

codex handoff <session-id> --profile deepseek --model deepseek-v4-pro

Environment
  • Codex CLI 0.147.0
  • macOS
  • Source provider: OpenAI
  • Destination: custom Responses-compatible provider
Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the codex resume and codex fork entry points, then inspect the rollout file format that contains the tool call and custom_tool_call_output records. Compare the source history accepted by OpenAI with the ordering rejected by the custom provider. Done means a cross-provider handoff preserves usable messages and completed tools, leaves the source session unchanged, and clearly creates a derived session.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.