Epic: Bring Codex to parity with Claude Code — cost, sessions, tool pruning, and the unverified surface
维护者通常 1 天内回复
@Alan-Cha 已经在做这个了。
开始于 2026年10月14日。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 6/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- go
- 领域
- backend, observability
调研方向
This is a tracking epic, not a single task, and it depends on the unmerged PR #1337. A reasonable entry point is the tool-prune and inference-parser suffix lists, which should share one predicate; check that the /responses path is recognised in both. The other sections need design decisions first, such as whether to bundle non-Anthropic prices, so start by asking a maintainer which section to take.
由索引模型根据 Issue 内容生成。
描述
Follow-on to #942, which lands Codex as a recognised, configurable, parsed agent — the same tier as OpenCode. This issue tracks what it still lacks relative to Claude Code, the reference integration, plus everything #942 shipped unverified.
Depends on #1337 (the PR that completes #942). Nothing here is a regression; it is the gap between "supported" and "at parity".
Where Codex stands today
| Capability | Claude Code | OpenCode | Codex |
|---|---|---|---|
| Recognised agent / per-agent metrics | ✅ | ✅ | ✅ (#1337) |
| Persistent configure + revert | ✅ | ✅ | ✅ (#1337) |
| Typed inference events | ✅ | ✅ | ✅ (#1315, #1326) |
| Token counts | ✅ | ✅ | ✅ |
| Cost | ✅ | model-dependent | ❌ |
| Named sessions | ✅ | ✅ | ❌ |
| Tool pruning | ✅ | ❌ | ❌ |
1. Cost — and this is NOT Codex-specific
Worth stating first because it reframes the work: the bundled price table is Anthropic-only by design. Its generated header says so — "VENDOR LIST prices for the first-party Anthropic endpoint" — and every one of its ~33 entries is a claude-* model. There are zero OpenAI rates.
So Codex's blank cost is not an integration gap. Measured on a live turn: gpt-6-luna reports 1 priceable request and 0 priced ones, with no amount — exactly the "find traffic that is not priced" signal working as designed. OpenCode pointed at a GPT model would report the same.
Two things to decide, and only the second is Codex's:
- Should Cortex bundle non-Anthropic rates at all? A cross-cutting decision affecting OpenCode and any gateway deployment, not just Codex. The generator already reads LiteLLM's full table, so the data is available; the question is whether shipping other vendors' list prices is in scope.
- Document the
pricing:override path indocs/agents/codex.md. Cheap, in scope today, and the right answer regardless of the above. Note the wrinkle: Codex's model is served on a ChatGPT subscription, not per-token billing, so any per-token rate an operator sets is an imputed cost rather than a real one. The doc should say that rather than implying a missing number.
2. Named sessions
Codex's traffic lands in a pending:codex@<pid>.<start> bucket and never leaves it, because it sends none of the three session headers a laptop install reads (X-Claude-Code-Session-Id, X-Task-Id, X-Session-Id). Every other supported agent supplies one: Claude Code, Bob Shell (BobSessionHeader) and OpenCode (SessionIDHeader) each have their own.
Evidence that none arrives: the bucket is never adopted, and adoption only requires any one of the three to carry a value.
- Capture Codex's full request headers and establish whether it sends any stable conversation/thread id. Codex has a session concept of its own (
codex resume,~/.codex/sessions/,session_index.jsonl), so an id may exist on the wire under a name Cortex does not read. If it does, adding it tosession.id_headersmay be the whole fix. - If no header exists, decide between: deriving a session from Codex's own rollout/session files (agentop already harvests Claude Code transcripts, so there is precedent), improving process-tree attribution, or accepting per-process buckets and documenting it.
3. Tool pruning
Unsupported for three independent reasons, any one sufficient — all confirmed by reading the code:
-
agentop tools scandiscovers tools from Claude Code's transcripts (~/.claude/projects/*.jsonl) and proposes only Claude Code's 26 hardcoded built-in names (cmd/agentop/toolscan/known.go). Nothing builds a Codex list. -
tool-prune's default paths are/v1/chat/completions,/v1/completions,/v1/messages./responsesis absent, so it recordsskip/path_not_inferenceon every Codex inference request. - Even with
pathsoverridden, it reads the manifest from a top-leveltoolsarray, while Codex nests its manifest underinput[].tools[].tools[]. It would skip withno_tool_manifest.
Also worth fixing while in here, and arguably first:
-
tool-pruneandinference-parserkeep separate suffix lists, and only the parser's recognises/responses. The drift is silent — the parser parses a request the pruner calls "not inference". One shared predicate would stop the next dialect hitting this.
OpenCode is also unsupported here, so this is the one row where Codex matches OpenCode and only Claude Code is ahead.
4. Unverified surface from #942
Everything #942 shipped was tested on Codex 0.160.1, macOS 26.3 (arm64), against the ChatGPT backend. Untested:
- Linux, and any other Codex version. Every User-Agent string, the
CODEX_dotenv filter and the.envload behaviour are pinned to that one build. -
A live TUI capture.Done — captured in #1337 by allocating a pty directly and typing into the real TUI. Both tokens confirmed, includingcodex-tuion the TUI's own/backend-api/codex/responsesinference requests. The capture also caught an auto-update, so it covers 0.160.1 and 0.162.1, which is the only evidence that the UA shape holds across releases. It corrected one detail: the third UA field is the TERM value, not a literalunknown. - The five unclaimed originator tokens:
codex_vscode,codex_desktop,codex-app-server,codex_mcp_server,codex-cli. All present in the binary; none seen on traffic or traced to aclient_name. Deliberately not folded intocodex(a wrong fold is silent where an unrecognised agent is not) — butcodex_vscodeandcodex_desktopplausibly belong to separate products, the way IBM Bob the IDE does to Bob Shell, and each needs its own decision. - The public
/v1/responsesAPI with an OpenAI API key rather than a ChatGPT subscription. The parser recognises the path, and its non-streaming shape is modelled from the published schema rather than captured traffic. - A
function_call-shaped tool call. Codex's ownexectool is acustom_tool_call; thefunction_callbranch is modelled from the documented schema and has never run on real traffic. - The cost path, unexercised for Codex because no rate applies (see §1).
5. Smaller known issues
-
CODEX_HOMEmust be set whereagentopruns, not only where Codex runs — agentop reads it from its own environment. If Codex is launched with it set (wrapper script, devcontainer, launchd unit) andagentop configure codex enableis run from a plain shell, the two resolve different files andstatusconfirms the wrong one. Documented with--envas the workaround; nothing outside can detect the split. - Chatty non-inference traffic. One
codex execturn produced ~100 recorded events, most of them plugin-list polling and an MCP handshake rather than inference. Consider whether any belong inlistener.skip_hostsguidance for Codex users. -
InferenceToolCall.Argumentsis not JSON for Codex.custom_tool_callarguments are freeform text by design.sparc's reflector tolerates it (JSONDecodeErrorfallback);opahands it to Rego as a plain string, so a policy callingjson.unmarshalon it is the policy author's problem. Documented, but worth a guardrail or a worked Rego example.
Related
- #942 — lands Codex as a supported agent (this issue's prerequisite)
- #1337 — the PR completing #942
- #1363 — Claude Code's second User-Agent is unrecognised; same bug class as #1337's TUI blocker
- #1289 — the
Prior/Writtenrevert gap, shared by all the configure integrations
Assisted-By: Claude (Anthropic AI) [email protected]
- 主要语言
- Go
- 星标
- 16
- 派生
- 41
- 平均合并
- 11 小时 25 分钟
- 30 天内合并 PR
- 269
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rossoctl/cortex 的其他 Issue
-
UI shows costs for all sessions even when drilled into a session可能已有人在做 @esnible 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
rossoctl/cortex#1116 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 8/100
维护者通常 1 天内回复
-
WebSocket inference is unobservable, and the cheap fix would make it worse可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 30/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 18/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 15/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
documentation hacktoberfest priority: low skill: good first issue status: ready for dev
难度 2/5 半天 新手友好度 85/100
hyperledger-labs/fabric-smart-client#2142 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
numberly/vault-db-injector#107 ·
维护者通常 1 天内回复
-
area/import kind/bug
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
[DOC] Wrong sg_egress_ports range in the Terraform Databricks Guide for AWS Hub & Spoke with Network Firewall可能已有人在做 @akhil9tiet 今天认领。 未关闭docs
难度 1/5 1 小时以内 新手友好度 72/100
databricks/terraform-provider-databricks#6080 · 1 条评论 ·
维护者通常 3 天内回复