codex exec --json emits duplicate id keys for web-search items
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 領域
- backend-api-design, cli, testing
調査の方向性
codex-rs/exec/src/exec_events.rsから始めます。ここでは、issueが外側の項目と、フラット化されたウェブ検索ペイロードの定義を指しています。これらのフィールドがどのようにシリアライズされるかを追い、issueの要求どおり、重複キーを拒否する生のJSONシリアライズテストを追加します。各ウェブ検索項目に曖昧さのないidが1つだけあり、テストで重複キーが拒否されることを確認できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
What issue are you seeing?
codex exec --json emits two different id properties in each web-search item. Parsers that keep the first property identify the item as item_1; parsers that keep the last identify it as ws-1. A duplicate-rejecting parser cannot consume the event.
This is separate from #60990, which concerns an omitted TypeScript field.
Reproduction
Run from the repository root with the Python SDK dependencies and codex on PATH. The Responses API is a local mock; no external web request is made.
import json, os, shutil, subprocess, sys, tempfile
from pathlib import Path
sys.path[:0] = [str(Path("sdk/python/src").resolve()),
str(Path("sdk/python/tests").resolve())]
from app_server_harness import (
AppServerHarness, ev_assistant_message, ev_completed,
ev_response_created, sse,
)
def reject_duplicates(pairs):
result = {}
for key, value in pairs:
if key in result:
raise ValueError(f"duplicate key: {key}")
result[key] = value
return result
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as tmp:
with AppServerHarness(Path(tmp)) as harness:
added = {"type": "response.output_item.added", "item": {
"type": "web_search_call", "id": "ws-1", "status": "in_progress"}}
done = {"type": "response.output_item.done", "item": {
"type": "web_search_call", "id": "ws-1", "status": "completed",
"action": {"type": "search", "query": "example"}}}
harness.responses.enqueue_sse(sse([
ev_response_created("r1"), added, done,
ev_assistant_message("m1", "Finished."), ev_completed("r1"),
]))
env = dict(os.environ, CODEX_HOME=str(harness.codex_home),
CODEX_APP_SERVER_DISABLE_MANAGED_CONFIG="1")
proc = subprocess.run([
shutil.which("codex"), "exec", "--json", "--skip-git-repo-check",
"-c", 'web_search="cached"', "-c", "features.plugins=false",
"-c", "features.plugin_discovery_prefetch=false", "Example",
], cwd=harness.workspace, env=env, capture_output=True, text=True,
check=True, timeout=15)
for line in proc.stdout.splitlines():
event = json.loads(line)
if event.get("item", {}).get("type") == "web_search":
print(line)
try:
json.loads(line, object_pairs_hook=reject_duplicates)
except ValueError as error:
print(error)
Observed for the started item (the completed item has the same duplication):
{"type":"item.started","item":{"id":"item_1","type":"web_search","id":"ws-1","query":"","action":{"type":"other"}}}
duplicate key: id
Python's default decoder retains ws-1; a first-wins decoder retains item_1. A separate structurally equivalent Serde deserialization test returned duplicate field id.
Expected behavior
Emit one unambiguous id per item. The outer item flattens a web-search payload that also has an id. Remove the duplicate or give the raw search identifier a distinct field name if both IDs are needed. Add a raw-JSON serialization test that rejects duplicate keys.
Tested with Codex CLI 0.167.0-alpha.4.1, Python 3.14.0, and Windows; source checked at 6bfdc75f0d9e6fae313234f694839866d7c63c39.
- 主要言語
- Rust
- スター
- 135k
- フォーク
- 21.4k
- 平均マージ
- 1分
- マージ済み PR(30日)
- 995
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openai/codex のほかの issue
-
bug CLI exec session
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug CLI config
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
app-server bug CLI
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
bug CLI exec windows-os
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
app-server bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
compatibility
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws/aws-emulator#30 · コメント 1 件 ·
-
tormach-plasma refusal text with no machine reads "no machine is not declared a plasma machine"オープンarea:post bug effort:low P2 source:agent
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Higher Interval Candles draws nothing on a seconds chart whose interval does not divide two hoursオープンbug studies
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
userFRM/egui-charts#2727 ·
メンテナーはふだん 1 日以内に返信
-
enhancement priority::low upstream
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信