Repository navigation
Description
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
Title:
[Bug]: Session shows openai/gpt-5.5 in UI, but new turns execute via DeepSeek and collapse chat history into new leaf sessions
Summary:
For agent marcus, the session UI and session metadata show openai/gpt-5.5 with agentRuntime.id=codex, but new turns are actually executed through deepseek/deepseek-v4-pro. When DeepSeek fails, OpenClaw creates a new leaf session and chat.history collapses to only the new leaf, making most prior history disappear in the UI.
Version:
- OpenClaw 2026.6.5
Environment:
- Linux / WSL2
- Local gateway on
127.0.0.1:18789 - Control UI via local web dashboard
Affected session:
- agent:
marcus - session key:
agent:marcus:telegram:direct:364***075
What I expected:
- If the session shows
openai/gpt-5.5andagentRuntime.id=codex, new turns should execute with that model/runtime. - If a turn fails, prior history should remain visible in the same chat.
What actually happens:
sessionInfo.modelshowsgpt-5.5sessionInfo.modelProvidershowsopenaiagentRuntime.idshowscodex- but failed turns are recorded in transcript as:
provider: deepseekmodel: deepseek-v4-proerrorMessage: 402 Insufficient Balance
- after such a failure, OpenClaw rolls the session into a new leaf
sessionId chat.historythen returns only the new leaf tail, so most earlier history disappears from the UI
Observed session IDs in one usage family:
e42f5193-4658-44a0-b725-70d0105df4d25c26daa1-3d7b-485b-9891-59fcd72f8236e05de8b3-8655-484f-89a0-59b1a3e09bd6c47ae0e7-89b5-4d84-ae6a-87bdb31b6a48
Concrete evidence:
-
Session metadata reported by Gateway for the session:
modelProvider: openaimodel: gpt-5.5agentRuntime.id: codex
-
Actual failed turn recorded in transcript /
chat.history:provider: deepseekmodel: deepseek-v4-prostopReason: errorerrorMessage: 402 Insufficient Balance
-
chat.historybehavior:- after leaf rollover, history collapses to the newest leaf unless transcripts are manually merged/relinearized
Steps to reproduce:
- Have a session whose UI/session metadata shows
openai/gpt-5.5andagentRuntime.id=codex - Send a new message in that session
- Observe the actual execution path in transcript /
chat.history - If the actual runtime errors, observe that a new leaf session is created
- Re-open the same chat in Control UI and see that history collapses to the leaf tail
Why this looks like a bug:
- displayed session model/runtime and actual execution route diverge
- history visibility depends on transcript tree/leaf rollover in a way that hides prior chat unexpectedly
- provider failure should not silently rewrite the user-visible session into a nearly empty chat
Notes:
- In my case, the immediate provider error is
402 Insufficient Balancefrom DeepSeek, but that seems like only the trigger. - The deeper issue is that the session claims to be on
gpt-5.5/ Codex while execution actually goes to DeepSeek.
If useful, I can provide:
- redacted
sessions.jsonentry foragent:marcus:telegram:direct:364***075 - redacted transcript snippets showing
gpt-5.5in session info vsdeepseek-v4-proin failed turns - exact
chat.historypayloads before/after rollover
Steps to reproduce
- Start OpenClaw 2026.6.5 with an agent session whose UI/session metadata shows
openai/gpt-5.5andagentRuntime.id=codex. - Open session
agent:marcus:telegram:direct:364***075in Control UI. - Send a new message in that chat.
- Observe that the new turn is executed via
deepseek-v4-proinstead of the displayedgpt-5.5. - If the provider errors, observe that OpenClaw rolls the chat into a new leaf session and the visible history collapses to the new tail.
Expected behavior
New turns should execute with the model/runtime shown in the session (openai/gpt-5.5, agentRuntime.id=codex), and prior chat history should remain visible even if a turn fails.
Actual behavior
The session UI/session metadata shows openai/gpt-5.5, but new turns are executed through deepseek-v4-pro. When that provider fails (402 Insufficient Balance in my case), OpenClaw creates a new leaf session and the visible chat history collapses to the new leaf until the transcripts are manually merged.
OpenClaw version
2026.6.5
Operating system
Linux on WSL2 Kernel: 6.6.87.2-microsoft-standard-WSL2 Arch: x64
Install method
npm global
Model
Displayed in session/UI: openai/gpt-5.5 Actual model used by failed turns: deepseek/deepseek-v4-pro
Provider / routing chain
Displayed route: openclaw -> codex/openai (session shows gpt-5.5) Actual failed-turn route: openclaw -> deepseek
Additional provider/model setup details
Agent: marcus
Session key: agent:marcus:telegram:direct:364***075
The session UI / chat.history session metadata shows:
modelProvider: openaimodel: gpt-5.5agentRuntime.id: codex
But newly created leaf turns actually execute with:
provider: deepseekmodel: deepseek-v4-pro
When DeepSeek fails (402 Insufficient Balance), OpenClaw rolls the chat into a new leaf session and visible history collapses to the new tail.
Global default config currently points to DeepSeek, while this affected session still displays GPT-5.5/Codex in session metadata. This mismatch appears to be the core bug.
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
[-][Bug]:[/-][+][Bug]: Session shows openai/gpt-5.5 in UI, but new turns execute via DeepSeek and chat history collapses into new leaf sessions[/+]clawsweeper commentedon Jun 10, 2026
Thanks for the context here. I did a careful shell check against current
main, and this is already implemented.Close: current main resolves agent-scoped routing and UI model display from the same current selection, and preserves the active transcript ancestry instead of treating a leaf as an empty replacement chat. The repair is on main only, not yet proven shipped in a public release.
So I’m closing this as already implemented rather than keeping a duplicate issue open.
Review details
Best possible solution:
Keep the canonical resolver and active-transcript projection, then include the current-main repair in a future release.
Do we have a high-confidence way to reproduce the issue?
No; current-main source and regression coverage route stale runtime metadata through the current agent selection and retain active-path ancestry in history.
Is this the best way to solve the issue?
Yes; one canonical resolver now drives both dispatch and UI projection, while the transcript reader preserves the selected path rather than adding a workaround.
Security review:
Security review: This is issue triage, not a patch security review.
AGENTS.md: found and applied where relevant.
What I checked:
src/agents/session-model-ref.ts:25, 6e5bf3ec55cb)src/gateway/server-methods/chat-send-session.ts:161, 6e5bf3ec55cb)src/agents/session-model-ref.test.ts:30, 6e5bf3ec55cb)src/config/sessions/transcript-tree.test.ts:120, 6e5bf3ec55cb)src/agents/session-model-ref.ts:19, cae603057562)Likely related people:
src/agents/session-model-ref.ts,src/agents/session-model-ref.test.ts,src/config/sessions/transcript-tree.ts)Codex review notes: model internal, reasoning high; reviewed against 6e5bf3ec55cb; fix evidence: commit cae603057562, main fix timestamp 2026-08-14T20:49:45-06:00.
2 remaining items