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

Đang mở Phù hợp với người mới
#64,539 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
85/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu với codex-rs/core/src/tools/handlers/multi_agents_spec.rs để xác nhận rằng lược đồ spawn_agent v2 hiển thị task_name, sau đó kiểm tra codex-rs/protocol/src/agent_path.rs để tìm thông báo xác thực được hardcode. Tái hiện sự không khớp bằng codex exec --json và một lệnh gọi spawn_agent của MultiAgentV2 sử dụng task_name. Thay đổi chính được hoàn tất khi lỗi xác thực nhắc đến task_name nhất quán với lược đồ; thêm mẫu JSON Schema tùy chọn sẽ cho thấy cùng ràng buộc đó sớm hơn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
Rust
Star
136k
Fork
21.6k
Merge trung bình
1 phút
Pull request đã merge (30 ngày)
999

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của openai/codex

Tất cả issue của openai/codex

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.