`codex exec --ephemeral` fails to spawn a custom subagent with `no thread with id`; non-ephemeral succeeds after global agent placement
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Summary
I am seeing a custom-subagent spawn failure in Codex CLI on Windows. The failure is deterministic in --ephemeral mode and reports:
ERROR codex_core::tools::router: error=collab spawn failed: no thread with id: <root-session-id>
The message resembles the thread-lifecycle symptom described in #35781, but my reproduction uses a user-requested custom agent rather than a memory consolidation agent.
Environment
- Codex CLI:
codex-cli 0.150.0-alpha.8 - OS: Windows 10 Home, 10.0.19045, x64
- Model:
gpt-5.6-terra - Command mode:
codex exec --strict-config --skip-git-repo-check - The diagnostic prompt forbids networking, external services, secret access, writes, and deletion.
Reproduction
- Define
chief-secretary.tomlandresearcher.tomlwithname,description,developer_instructions, andsandbox_mode = "read-only". - Ask the root session to delegate once to
chief-secretary, which is instructed to delegate once toresearcher. - Run the command in each mode below.
Project-scoped agents only (<project>/.codex/agents/)
- Normal mode: failed previously with
collab spawn failed: no thread with id: <root-session-id>. --ephemeral: failed previously with the same error.
Global agents also present (~/.codex/agents/)
- Normal mode: completed with final output
responded; nono thread with idrouter error appeared. The CLI output did not expose a child-agent identity, so this only confirms the requested diagnostic completed without the router error. --ephemeral: failed with the same error, before the delegated agent started.
Example failing invocation:
codex exec --strict-config --skip-git-repo-check --ephemeral -C <project> "<read-only prompt requesting chief-secretary -> researcher delegation>"
Expected behavior
The custom subagent should start in both normal and ephemeral modes, or ephemeral mode should reject the workflow before it exposes a spawn tool that cannot resolve the caller thread.
Actual behavior
Non-ephemeral behavior changes when the agent definition is globally available, but ephemeral mode still fails with a lookup for its own root session ID.
Request
Could this be related to the thread-registration or teardown path described in #35781? If not, please advise which redacted diagnostic fields or rollout details would help isolate the custom-agent/ephemeral path.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the custom-agent delegation with the failing codex exec --ephemeral invocation on Windows, then compare it with normal mode and the project-scoped versus global agent setups. Read the thread-registration and teardown discussion in #35781. Done means ephemeral custom-agent spawning succeeds, or the workflow is rejected before exposing an unusable spawn path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100