Skip to content

[Safety] Prevent or fork same-task switches across native and routed providers #2095

Description

@brotherjean

What are you trying to accomplish?

Use an OpenCodex-routed model for quota supplementation without corrupting or destabilizing an existing native Codex task, while keeping the project folder and files unchanged.

What prevents this today?

A single Codex task can accumulate provider-specific reasoning items, tool-call identifiers, signatures, and terminal semantics. Switching that same task between a native OpenAI model and a non-OpenAI routed model can replay those items on the other wire. The result can be a 400 during compaction/continuation, a websocket turn that never reaches a terminal event, or a thread that needs to be abandoned.

OpenCodex has fixed individual cases (for example reasoning sanitization for the compact endpoint and provider-specific tool-call ID handling), but there is no general task-level boundary or warning that guarantees a safe native/routed switch. This report is based on a macOS Apple Silicon user observation; the exact error depends on the provider and turn history.

What should OpenCodex do?

When the effective provider or wire changes inside an existing task, OpenCodex should provide one of these explicit, safe behaviours:

  1. Default to a new task/fork with a clear warning that provider-specific history will not be replayed.
  2. Or, if the task remains in place, run a provider-aware history sanitizer with a fail-closed result and a visible diagnostic.
  3. Keep the original task and its history recoverable; do not silently rewrite it or claim that a switch succeeded when the next request is unsafe.
  4. Record the provider/wire boundary in diagnostics without recording prompts, tokens, or raw payloads.

Example usage or interface

1. Start a task with native OpenAI / gpt-5.6-terra.
2. Send a normal turn and a tool turn.
3. Switch the same task to an OpenCodex-routed Kimi/DeepSeek model.
4. Continue the task or trigger compaction.
5. Switch back to native OpenAI.

Expected: a safe fork/warning, or a verified sanitized replay.
Observed: provider-specific history can be replayed across wires and the task may fail or remain stuck.

Alternatives or workarounds

Create a new task in the same project folder whenever changing between native and routed providers. Keep the native task as the control task and use OpenCodex only in disposable or purpose-specific tasks.

Additional context

Related issues:

This request is intentionally a task-boundary/safety layer, not a claim that those individual fixes are absent. It contains no keys, tokens, OAuth data, task IDs, local paths, or personal data.

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeststreamingSSE, WebSocket, terminal stream framestoolstool_calls, MCP, web-search / sidecar tools

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions