fix: a native Codex chat stops as soon as one of its subagents finishes (#35230)

When Codex started a subagent in a native Codex chat, the chat ended the moment that subagent finished, even though the main task was still working. The reply was saved as finished with whatever had arrived so far, and Codex recorded the main task as interrupted. A failing subagent also failed the whole chat with its own error. The chat now ends only when the main task itself finishes, and an error from the main task still shows.

Fixes #35226
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-30 18:34:02 +04:00
1 parent 7e2b509869
commit 529bb58b9a
1 file changed
+3
+3
View File
@@ -169,6 +169,9 @@ async def run(transport, output, prompt, images, options):
)
elif method == 'turn/completed':
turn = params.get('turn') or {}
# Subagent turns complete on this stream too.
if turn.get('id') != turn_id:
continue
if turn.get('status') == 'failed' or turn.get('error'):
raise ValueError(str(turn.get('error') or 'Codex turn failed'))
return