Main thread kills subagents too eagerly

Resolved 💬 6 comments Opened Feb 26, 2026 by smileBeda Closed Feb 26, 2026
💡 Likely answer: A maintainer (jif-oai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

0.105.0

What subscription do you have?

PRO

Which model were you using?

gpt-5.3-codex xhigh

What platform is your computer?

Mac

What terminal emulator and version are you using (if applicable)?

terminal

What issue are you seeing?

I see it to often that main thread polls for subagent status, says "it is still working, I am prepping a fix anyway in case it hangs" and then later kills the subagent, only to find half-edited files that the subagent was editing.

What steps can reproduce the bug?

Not sure, I use subagents, they work, but sometimes they take time, and main thread, in his eagerness to be fast, kills them

What is the expected behavior?

NO killing of subagents!

Additional information

<img width="1920" height="311" alt="Image" src="https://github.com/user-attachments/assets/291afa06-d19c-4281-98bd-3ac9f61adf2b" />
Example that is really detrimental:

  • wasted a ton of tokens
  • then killed subagent
  • realized stuff is now broken since it had still work to do the subagent
  • had to redo all that work again and fix it up

View original on GitHub ↗

6 Comments

jif-oai contributor · 4 months ago

This is a model behaviour problem. This will get solved over time but I can't have a direct fix for this

smileBeda · 4 months ago

@jif-oai to understand this right - the _model_ counts the time and the _model_ decides the timeout limits?

I’ve a hard time understanding this. It’s capable of estimating what a timeout should be and even keep track of it? There’s no setting I can tweak to say „max timeout Subagent == xxx seconds“?

jif-oai contributor · 4 months ago

Yes indeed the model is supposed to estimate. And here the issue is mainly the problem becoming impatient. I'll try to tune a bit the prompt to make it more patient for now

jif-oai contributor · 4 months ago

Btw your screenshot shows an UX older than 0.105.0. Are you sure of your version?

smileBeda · 4 months ago

Duh, you are right - I was still on 104. Now on 105!

... about that timeout... I think it might be very good to add a deterministic control that globally applies, something like the background_terminal_max_timeout - but for subagents. Just basically as a fallback so the main thread can decide "ok, while I consider it too long now, the user said it is OK to wait N seconds, so I will poll again.

Not sure if that makes sense to you?

jif-oai contributor · 4 months ago

It make sense. That's a good idea but we need to make sure the model understand it correctly. I'll build something for this