Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Hooks see a multi-agent v2 launch as collaborationspawn_agent, so spawn_agent and Agent matchers miss it

Aperta Adatta ai principianti
#57,539 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@akhil9tiet ci sta già lavorando.

Dal 27/10/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
devtools

Direzione di ricerca

Leggi function_hook_tool_name in codex-rs/core/src/tools/registry.rs, quindi esamina flat_tool_name e il namespace v2 in codex-rs/core/src/tools/mod.rs e codex-rs/core/src/tools/multi_agent_tool.rs. Estendi la mappatura dei nomi degli hook in modo che gli avvii in qualsiasi namespace usino il nome dell’hook dell’agente e aggiorna spawn_agent_function_tools_use_agent_matcher_alias in registry_tests.rs per includere v2. Il lavoro è terminato quando il nome dell’hook e l’alias Agent corrispondono agli avvii v2 come previsto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug CLI hooks subagent
What version of Codex CLI is running?

0.164.0, the latest release.

Which model were you using?

gpt-6.1-sol, through codex exec, with multi-agent v2.

What platform is your computer?

macOS 26.6 arm64

What issue are you seeing?

A hook sees the agent launch tool under two names. Under multi-agent v1 its tool_name is spawn_agent. Under multi-agent v2, where the model calls spawn_agent in the collaboration namespace, the hook's tool_name is collaborationspawn_agent.

So a PreToolUse hook matching ^spawn_agent$, or the Agent alias that HookToolName::spawn_agent() documents for Claude Code style configurations, never runs on a v2 launch. A hook meant to stop or check sub-agent launches is skipped silently.

The cause, on main today:

  • function_hook_tool_name in codex-rs/core/src/tools/registry.rs returns HookToolName::spawn_agent() only for the default namespace and MULTI_AGENT_V1_NAMESPACE.
  • Any other namespace, such as v2's collaboration from multi_agent_v2_handler in codex-rs/core/src/tools/multi_agent_tool.rs, falls through to flat_tool_name in codex-rs/core/src/tools/mod.rs, which joins namespace and name with no separator.
  • spawn_agent_function_tools_use_agent_matcher_alias in registry_tests.rs covers the plain, default and v1 names only.
What steps can reproduce the bug?

.codex/hooks.json in a trusted project, with hooks enabled:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "spawn_agent$",
        "hooks": [{ "type": "command", "command": "jq -r .tool_name >> /tmp/launch-hook.log" }]
      }
    ]
  }
}

Then, with a model and account that get multi-agent v2:

codex exec "Spawn one sub-agent that replies with the word done, wait for it, then stop."
cat /tmp/launch-hook.log

The rollout records the call as "name":"spawn_agent","namespace":"collaboration", and the hook logs collaborationspawn_agent. Read from the code above, a matcher of ^spawn_agent$ or Agent would not run on it. We met this in a project hook that refuses launches from inside a sub-agent, and match spawn_agent$ to cover both names.

What is the expected behavior?

A hook sees one tool_name, spawn_agent, for every agent launch whatever its namespace, and the Agent alias matches every launch, as it does under v1.


Claude Code wrote this issue for @marcospgp. The hook output above was seen in his own Codex 0.164.0 sessions on 27 October 2026. The steps were not rerun for this report, since they need a model turn.

Lingua principale
Rust
Stelle
131k
Fork
20.7k
Merge medio
1m
PR unite (30g)
996

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openai/codex

Tutte le issue di openai/codex

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.