openclaw - 💡(How to fix) Fix Claude CLI-backed sessions show mixed modelProvider metadata; sessions.patch model:null succeeds but does not normalize stale runtime fields [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#73090Fetched 2026-04-28 06:27:39
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

After configuring agents to use the Claude CLI runtime with a canonical Anthropic model ref, active sessions can report mixed modelProvider values for the same effective setup.

Config uses the documented split:

  • model: anthropic/claude-opus-4-7
  • runtime: claude-cli
  • fallback: none

Some active sessions report:

{
  "modelProvider": "claude-cli",
  "model": "claude-opus-4-7"
}

Other active sessions for Claude CLI-backed agents still report:

{
  "modelProvider": "anthropic",
  "model": "claude-opus-4-7"
}

Calling sessions.patch with model: null returns ok: true, but the stale rows remain or are immediately re-resolved back to modelProvider: "anthropic".

This makes it difficult to verify whether a session is actually using the configured CLI runtime or whether the session metadata is stale/misleading.

Root Cause

Start a fresh session or delete/reset affected session state, accepting loss of short-term session context. I did not force-delete session entries because the gateway method returned success but did not normalize the metadata.

Fix Action

Workaround

Start a fresh session or delete/reset affected session state, accepting loss of short-term session context. I did not force-delete session entries because the gateway method returned success but did not normalize the metadata.

Code Example

{
  "modelProvider": "claude-cli",
  "model": "claude-opus-4-7"
}

---

{
  "modelProvider": "anthropic",
  "model": "claude-opus-4-7"
}

---

{
  "agents": {
    "defaults": {
      "agentRuntime": {
        "id": "claude-cli",
        "fallback": "none"
      },
      "model": {
        "primary": "anthropic/claude-opus-4-7",
        "fallbacks": []
      },
      "thinkingDefault": "high"
    },
    "list": [
      {
        "id": "<claude-cli-agent-1>",
        "agentRuntime": {
          "id": "claude-cli",
          "fallback": "none"
        },
        "model": "anthropic/claude-opus-4-7",
        "thinkingDefault": "high"
      },
      {
        "id": "<claude-cli-agent-2>",
        "agentRuntime": {
          "id": "claude-cli",
          "fallback": "none"
        },
        "model": "anthropic/claude-opus-4-7",
        "thinkingDefault": "high"
      }
    ]
  }
}

---

openclaw sessions --all-agents --active 360 --json

---

openclaw gateway call sessions.patch \
  --params '{"key":"<session-key>","model":null}' \
  --json

---

{
  "modelProvider": "anthropic",
  "model": "claude-opus-4-7"
}
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug / session metadata inconsistency

Summary

After configuring agents to use the Claude CLI runtime with a canonical Anthropic model ref, active sessions can report mixed modelProvider values for the same effective setup.

Config uses the documented split:

  • model: anthropic/claude-opus-4-7
  • runtime: claude-cli
  • fallback: none

Some active sessions report:

{
  "modelProvider": "claude-cli",
  "model": "claude-opus-4-7"
}

Other active sessions for Claude CLI-backed agents still report:

{
  "modelProvider": "anthropic",
  "model": "claude-opus-4-7"
}

Calling sessions.patch with model: null returns ok: true, but the stale rows remain or are immediately re-resolved back to modelProvider: "anthropic".

This makes it difficult to verify whether a session is actually using the configured CLI runtime or whether the session metadata is stale/misleading.

Environment

  • OpenClaw: 2026.4.25 (aa36ee6)
  • Install method: npm global
  • OS: macOS 26.4.1
  • Gateway service: local gateway

Sanitized config shape

{
  "agents": {
    "defaults": {
      "agentRuntime": {
        "id": "claude-cli",
        "fallback": "none"
      },
      "model": {
        "primary": "anthropic/claude-opus-4-7",
        "fallbacks": []
      },
      "thinkingDefault": "high"
    },
    "list": [
      {
        "id": "<claude-cli-agent-1>",
        "agentRuntime": {
          "id": "claude-cli",
          "fallback": "none"
        },
        "model": "anthropic/claude-opus-4-7",
        "thinkingDefault": "high"
      },
      {
        "id": "<claude-cli-agent-2>",
        "agentRuntime": {
          "id": "claude-cli",
          "fallback": "none"
        },
        "model": "anthropic/claude-opus-4-7",
        "thinkingDefault": "high"
      }
    ]
  }
}

Steps to reproduce

  1. Configure one or more agents to use:
    • agentRuntime.id: "claude-cli"
    • agentRuntime.fallback: "none"
    • model: "anthropic/claude-opus-4-7"
  2. Have existing active sessions from before or during the runtime/config migration.
  3. Run:
openclaw sessions --all-agents --active 360 --json
  1. Observe mixed runtime metadata across active sessions:
    • some rows show modelProvider: "claude-cli"
    • other rows show modelProvider: "anthropic"
  2. Try clearing the session model override through the gateway:
openclaw gateway call sessions.patch \
  --params '{"key":"<session-key>","model":null}' \
  --json
  1. The call returns ok: true, but the affected session entry still reports:
{
  "modelProvider": "anthropic",
  "model": "claude-opus-4-7"
}

Expected behavior

For sessions whose effective agent runtime is claude-cli, session metadata should either:

  • consistently show modelProvider: "claude-cli" for the runtime provider, or
  • clearly separate canonical model provider (anthropic) from runtime backend (claude-cli), so status/session checks are not ambiguous.

If sessions.patch with model: null is the intended way to clear stale per-session model state, it should either normalize/clear stale runtime fields or return a response indicating no runtime metadata was changed.

Actual behavior

sessions.patch returns success, but stale-looking session rows continue to report modelProvider: "anthropic" even though the agent config uses claude-cli runtime with fallback disabled.

Impact

This creates ambiguous verification for Claude CLI-backed deployments. Health checks and config validation can pass, while active session metadata still suggests some sessions are using the canonical Anthropic provider rather than the configured Claude CLI runtime.

Workaround

Start a fresh session or delete/reset affected session state, accepting loss of short-term session context. I did not force-delete session entries because the gateway method returned success but did not normalize the metadata.

Notes

This may be related to session runtime fields being persisted separately from model override fields, or to canonical model provider resolution overwriting/obscuring the runtime backend.

extent analysis

TL;DR

The most likely fix is to update the session metadata handling to consistently reflect the configured runtime provider, potentially by modifying the sessions.patch endpoint to clear or update stale runtime fields.

Guidance

  • Verify that the sessions.patch endpoint is correctly handling the model: null parameter and updating the session metadata accordingly.
  • Check the session metadata storage to see if the runtime fields are being persisted separately from the model override fields, which could be causing the inconsistency.
  • Consider adding a separate field to the session metadata to clearly separate the canonical model provider from the runtime backend, to avoid ambiguity.
  • Test the workaround of starting a fresh session or deleting/resetting affected session state to see if it resolves the issue.

Example

No code snippet is provided as the issue is related to the behavior of the sessions.patch endpoint and session metadata handling, which is not explicitly defined in the provided information.

Notes

The issue may be related to the way session runtime fields are persisted and updated, and modifying the sessions.patch endpoint or adding a separate field to the session metadata may be necessary to resolve the issue.

Recommendation

Apply a workaround by starting a fresh session or deleting/resetting affected session state, as this may resolve the issue temporarily until a more permanent fix can be implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

For sessions whose effective agent runtime is claude-cli, session metadata should either:

  • consistently show modelProvider: "claude-cli" for the runtime provider, or
  • clearly separate canonical model provider (anthropic) from runtime backend (claude-cli), so status/session checks are not ambiguous.

If sessions.patch with model: null is the intended way to clear stale per-session model state, it should either normalize/clear stale runtime fields or return a response indicating no runtime metadata was changed.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Claude CLI-backed sessions show mixed modelProvider metadata; sessions.patch model:null succeeds but does not normalize stale runtime fields [1 participants]