Skip to content

[Bug]: Session shows openai/gpt-5.5 in UI, but new turns execute via DeepSeek and chat history collapses into new leaf sessions #91806

Closed

Description

@Cornil79

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.5 and agentRuntime.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.model shows gpt-5.5
  • sessionInfo.modelProvider shows openai
  • agentRuntime.id shows codex
  • but failed turns are recorded in transcript as:
    • provider: deepseek
    • model: deepseek-v4-pro
    • errorMessage: 402 Insufficient Balance
  • after such a failure, OpenClaw rolls the session into a new leaf sessionId
  • chat.history then 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-70d0105df4d2
  • 5c26daa1-3d7b-485b-9891-59fcd72f8236
  • e05de8b3-8655-484f-89a0-59b1a3e09bd6
  • c47ae0e7-89b5-4d84-ae6a-87bdb31b6a48

Concrete evidence:

  1. Session metadata reported by Gateway for the session:

    • modelProvider: openai
    • model: gpt-5.5
    • agentRuntime.id: codex
  2. Actual failed turn recorded in transcript / chat.history:

    • provider: deepseek
    • model: deepseek-v4-pro
    • stopReason: error
    • errorMessage: 402 Insufficient Balance
  3. chat.history behavior:

    • after leaf rollover, history collapses to the newest leaf unless transcripts are manually merged/relinearized

Steps to reproduce:

  1. Have a session whose UI/session metadata shows openai/gpt-5.5 and agentRuntime.id=codex
  2. Send a new message in that session
  3. Observe the actual execution path in transcript / chat.history
  4. If the actual runtime errors, observe that a new leaf session is created
  5. 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 Balance from 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.json entry for agent:marcus:telegram:direct:364***075
  • redacted transcript snippets showing gpt-5.5 in session info vs deepseek-v4-pro in failed turns
  • exact chat.history payloads before/after rollover

Steps to reproduce

  1. Start OpenClaw 2026.6.5 with an agent session whose UI/session metadata shows openai/gpt-5.5 and agentRuntime.id=codex.
  2. Open session agent:marcus:telegram:direct:364***075 in Control UI.
  3. Send a new message in that chat.
  4. Observe that the new turn is executed via deepseek-v4-pro instead of the displayed gpt-5.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: openai
  • model: gpt-5.5
  • agentRuntime.id: codex

But newly created leaf turns actually execute with:

  • provider: deepseek
  • model: 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

Activity

  1. changed the title [-][Bug]:[/-] [+][Bug]: Session shows openai/gpt-5.5 in UI, but new turns execute via DeepSeek and chat history collapses into new leaf sessions[/+] on Jun 10, 2026
  2. clawsweeper commented on Jun 10, 2026

    @clawsweeper
    Contributor

    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:

    Likely related people:

    • Jason (Json): Current resolver, regression test, and active-path implementation lines trace to the main-branch proof commit. (role: current implementation author; confidence: high; commits: cae603057562; files: src/agents/session-model-ref.ts, src/agents/session-model-ref.test.ts, src/config/sessions/transcript-tree.ts)
    • SunnyShu: An earlier direct repair commit documents the same stale runtime model metadata versus current agent defaults invariant. (role: historic stale-route repair author; confidence: medium; commits: a1d03f1cfd2f)

    Codex review notes: model internal, reasoning high; reviewed against 6e5bf3ec55cb; fix evidence: commit cae603057562, main fix timestamp 2026-08-14T20:49:45-06:00.

  3. added
    P2Normal backlog priority with limited blast radius.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.
    and removed
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    on Jun 10, 2026
  4. 2 remaining items

  5. added
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    and removed
    clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    on Jul 30, 2026
  6. added
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    and removed
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    on Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.bugSomething isn't workingclawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.regressionBehavior that previously worked and now fails

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions