Skip to content

Identity neutralization misses current Codex CLI wording #622

Description

@byongshintv

Client or integration

Codex CLI

Area

Provider adapter

Summary

neutralizeIdentity() only replaces one exact Codex identity sentence. Codex CLI 0.145.0 sends a different current sentence, so routed non-OpenAI models receive the GPT-5/OpenAI identity and may identify themselves as Codex instead of the selected model.

Expected: known Codex identity variants are replaced with NEUTRAL_IDENTITY_LINE before a request is forwarded to a routed provider.

Reproduction

  1. Run OpenCodex 2.7.41 with Codex CLI 0.145.0 and an openai-chat routed non-OpenAI model.
  2. Ask the selected model to identify itself.
  3. Observe that the forwarded Codex instruction contains:
You are Codex, an agent based on GPT-5.
  1. Inspect src/adapters/identity.ts. The exact string currently neutralized is:
You are Codex, a coding agent based on GPT-5.
  1. Because the strings differ, String.replace() leaves the current identity instruction intact. In the observed run, the routed non-OpenAI model explicitly identified itself as Codex/GPT-5 rather than the selected model.

Version

2.7.41

Operating system

Ubuntu 22.04

Provider and model

Custom OpenAI-compatible provider using the openai-chat adapter / routed non-OpenAI model

Logs or error output

Expected neutralized input:
You are a coding agent. Do not claim to be GPT-5 or to be made by OpenAI.

Actual identity line left in the routed request:
You are Codex, an agent based on GPT-5.

Screenshots and supporting files

None. The minimal source-level reproduction above shows the exact-string mismatch.

Redacted configuration

{
  "providers": {
    "example": {
      "adapter": "openai-chat",
      "baseUrl": "https://redacted.example/v1",
      "liveModels": true
    }
  }
}

Suggested fix

Handle a small allowlist of known exact variants, or use a narrowly scoped expression such as:

/You are Codex, (?:a coding agent|an agent) based on GPT-5(?:\.[0-9]+)?\./g

A broad You are Codex.* expression should be avoided because it could rewrite unrelated content. Tests should cover both known variants and unrelated text remaining unchanged.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions