Bug: spawn_agent v2 exposes parameter task_name but validation error refers to nonexistent parameter agent_name

オープン 初心者向け
#64,539 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
cli

調査の方向性

codex-rs/core/src/tools/handlers/multi_agents_spec.rs から始め、spawn_agent v2 スキーマが task_name を公開していることを確認します。次に、codex-rs/protocol/src/agent_path.rs を調査して、ハードコードされた検証メッセージを確認します。codex exec --json と、task_name を使用した MultiAgentV2 の spawn_agent 呼び出しで不一致を再現します。主要な変更は、検証エラーがスキーマと整合して task_name を名乗る時点で完了となります。任意の JSON Schema パターンを追加すると、同じ制約を早い段階で公開できます。

索引モデルが issue の本文から書いたものです。

説明

bug CLI subagent
Version / Commit
  • Observed in: codex-cli 0.172.0 (codex exec --json)
  • Verified on main (065e18b)
Summary

In MultiAgentV2, spawn_agent exposes its required naming parameter to the model as task_name, but when a model passes an invalid value (such as a hyphenated name like "ledger-audit"), the validation error returned to the model cites agent_name ("agent_name must use only lowercase letters, digits, and underscores") — a parameter name that does not exist in the spawn_agent v2 tool schema.

Source Location (main @ 065e18b)
  1. Tool schema names the parameter task_name — codex-rs/core/src/tools/handlers/multi_agents_spec.rs:139-144 & 163:
    properties.insert(
        "task_name".to_string(),
        JsonSchema::string(Some(
            "Task name for the new agent. Use lowercase letters, digits, and underscores."
                .to_string(),
        )),
    );
    ...
    Some(vec!["task_name".to_string(), "message".to_string()]),
    
  2. Validation error hardcodes agent_name — codex-rs/protocol/src/agent_path.rs:143 and 229:
    Err("agent_name must use only lowercase letters, digits, and underscores".to_string())
    
Reproduction
  1. Run a MultiAgentV2 session where the model invokes spawn_agent with {"task_name": "ledger-audit", "message": "..."}.
  2. Observe the tool error returned to the model:
    agent_name must use only lowercase letters, digits, and underscores
    
    The model is told to fix agent_name, even though its tool call schema only has task_name.

(Reproduced during TraceTrial-Bench Core-95 evaluation on L4-pending-child-at-exit-001 with [email protected].)

Expected Behavior
  1. Report the actual schema parameter name (task_name) in spawn_agent v2 validation errors (e.g., "task_name must use only lowercase letters, digits, and underscores").
  2. Optionally add "pattern": "^[a-z0-9_]+$" to the task_name JSON Schema property so models see the machine-readable constraint up front.
主要言語
Rust
スター
136k
フォーク
21.6k
平均マージ
1分
マージ済み PR(30日)
999

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

openai/codex のほかの issue

openai/codex の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。