Repository navigation
Description
Bug type
Behavior bug (incorrect output/state without crash)
Summary
On version 3.13, when using the Codex GPT-5.4 model, if a submitted task is long-running and involves tool calls that
take a long time to complete, this bug is very likely to occur. It happens in both the Web UI and the TUI.
After it happens, OpenClaw stops sending any further replies. In the Web UI, it shows terminated; in the TUI, it shows
run error: terminated. However, the task seems to continue running in the background—it’s just that I can no longer
see any replies or output.
Also, the OpenClaw gateway frequently logs messages like the following:
20:38:35 [agent/embedded] embedded run agent end: runId=bc4e7499-e93b-4427-8c70-826c1e1b7cb0 isError=true model=gpt-5.4 provider=openai-codex error=terminated
20:39:06 [agent/embedded] embedded run agent end: runId=bc4e7499-e93b-4427-8c70-826c1e1b7cb0 isError=true model=gpt-5.4 provider=openai-codex error=terminated
20:39:26 [agent/embedded] embedded run agent end: runId=bc4e7499-e93b-4427-8c70-826c1e1b7cb0 isError=true model=gpt-5.4 provider=openai-codex error=terminated
20:39:57 [agent/embedded] embedded run agent end: runId=bc4e7499-e93b-4427-8c70-826c1e1b7cb0 isError=true model=gpt-5.4 provider=openai-codex error=terminated
20:41:59 [agent/embedded] embedded run agent end: runId=1ed3fd78-4ecf-4f9f-99c8-9ddbf2e60668 isError=true model=gpt-5.4 provider=openai-codex error=terminated
Steps to reproduce
- Start the OpenClaw gateway. Then, when using the Codex models openai-codex/gpt-5.4 or gpt-5.3-codex, ask the model
to perform a relatively difficult task that requires multiple long-running tool calls.
Expected behavior
Long-running tasks with slow tool calls should continue normally without the session being marked as terminated.
The UI should remain responsive, and the user should still receive progress updates and the final reply.
Actual behavior
OpenClaw stops replying during long-running tasks that involve slow tool calls. The Web UI shows terminated, and
the TUI shows run error: terminated. No further progress or final reply is delivered, even though the task appears
to keep running in the background.
The gateway frequently logs:
provider=openai-codex error=terminated
20:39:57 [agent/embedded] embedded run agent end: runId=bc4e7499-e93b-4427-8c70-826c1e1b7cb0 isError=true model=gpt-5.4 provider=openai-codex error=terminated
20:41:59 [agent/embedded] embedded run agent end: runId=1ed3fd78-4ecf-4f9f-99c8-9ddbf2e60668 isError=true model=gpt-5.4 provider=openai-codex error=terminated
OpenClaw version
2026.3.13
Operating system
windows10
Install method
npm global
Model
openai-codex/gpt-5.4
Provider / routing chain
OpenClaw -> Cloudflare AI Gateway -> OpenAI (Codex)
Config file / key location
No response
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
inexom commentedon Mar 16, 2026
Firehdx commentedon Mar 16, 2026
I launch my tui with backbone Minimax M2.5, and encountered similar issue: openclaw stopped tool calling or sending message, came down to an ERROR: "[agent/embedded] embedded run agent end: runId=XXXXXX isError=true error=Network connection lost."
JeeTan commentedon Mar 17, 2026
Me too. Do you have any solutions?
Firehdx commentedon Mar 17, 2026
I switched my backbone to other models, e.g. Step-3.5 Flash or Kimi K2.5, and it worked for me.
Once I switched back to M2.5, the error appeared still, so I guess the problem is the network connection from the router site (OpenRouter for me) to the provider.
steipete commentedon Apr 25, 2026
Closing this as implemented after Codex review.
Current
mainalready contains a targeted fix for bare embedded-runner transport failures reported asterminated/Request failedon Codex/OpenAI paths, with regression coverage and changelog entry. This matches the issue’s reported symptom closely enough to close as implemented onmain.What I checked:
src/agents/pi-embedded-helpers/failover-matches.ts:134explicitly matches bareterminated, and:140matches bareRequest failed, both in the timeout/failover matcher used by embedded runs. (src/agents/pi-embedded-helpers/failover-matches.ts:134, 972c7112a292)src/agents/pi-embedded-helpers.isbillingerrormessage.test.ts:848assertsterminatedis classified as timeout, and:863asserts CodexRequest failedis classified as timeout. (src/agents/pi-embedded-helpers.isbillingerrormessage.test.ts:848, 972c7112a292)src/agents/model-fallback.run-embedded.e2e.test.ts:479covers bare Codex/Undici transport failures, includingterminated, and verifies the run is treated astimeoutand falls through to fallback instead of surfacing the raw transport failure. (src/agents/model-fallback.run-embedded.e2e.test.ts:479, 972c7112a292)src/agents/pi-embedded-runner/run.ts:1582classifies assistant errors and:1641-1700routes timeout-classified failures into retry/failover handling instead of leaving them as unknown surfaced errors. (src/agents/pi-embedded-runner/run.ts:1582, b45329334965)CHANGELOG.md:159says OpenClaw now classifies bare undici transport failures (terminated,UND_ERR_*) and pi-ai openai-codexRequest failedastimeout, specifically so Cloudflare/upstream transport failures enter fallback instead of surfacing as unclassified errors. (CHANGELOG.md:159, b45329334965)So I’m closing this as already implemented rather than keeping a duplicate issue open.
Review notes: reviewed against b45329334965; fix evidence: commit 972c7112a292.