From 529bb58b9a01ce6d31a406f04defc7c09352cf2e Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 30 Nov 2026 15:34:02 +0100 Subject: [PATCH] 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 --- backend/open_webui/utils/agents/codex.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/open_webui/utils/agents/codex.py b/backend/open_webui/utils/agents/codex.py index 8e00acd17d..7d5824d75b 100644 --- a/backend/open_webui/utils/agents/codex.py +++ b/backend/open_webui/utils/agents/codex.py @@ -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