Skip to content

[Bug]: Auto-compaction does not resolve compaction model aliases before dispatch #90340

Description

@toruvieI

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Auto-compaction in OpenClaw 2026.6.1 does not resolve a configured compaction model alias before dispatch, causing the alias gpt54mini to be sent as openai/gpt54mini and rejected as an unknown model.

Steps to reproduce

  1. Start OpenClaw 2026.6.1 with a model alias and compaction override shaped like this sanitized config:

    {
      "models": {
        "providers": {
          "openai": {
            "api": "openai-chatgpt-responses",
            "agentRuntime": { "id": "pi" }
          }
        }
      },
      "agents": {
        "defaults": {
          "model": {
            "primary": "gpt55",
            "fallbacks": ["gpt54"]
          },
          "models": {
            "openai/gpt-5.5": {
              "alias": "gpt55",
              "agentRuntime": { "id": "pi" }
            },
            "openai/gpt-5.4": {
              "alias": "gpt54",
              "agentRuntime": { "id": "pi" }
            },
            "openai/gpt-5.4-mini": {
              "alias": "gpt54mini",
              "params": { "thinking": "high" },
              "agentRuntime": { "id": "pi" }
            },
            "openai/*": {
              "agentRuntime": { "id": "pi" }
            }
          },
          "compaction": {
            "reserveTokens": 30000,
            "keepRecentTokens": 20000,
            "maxHistoryShare": 0.1,
            "model": "gpt54mini",
            "notifyUser": true
          }
        }
      }
    }
  2. Run a long openai/gpt-5.5 session until embedded auto-compaction is triggered.

  3. Observe the gateway/agent log line shown below.

Expected behavior

The auto-compaction path should resolve agents.defaults.compaction.model = "gpt54mini" through the same model alias resolver used by normal agent model selection, then dispatch compaction to canonical openai/gpt-5.4-mini.

Actual behavior

Auto-compaction dispatches or reports the alias as openai/gpt54mini, which is not a configured model id and is rejected as unknown.

OpenClaw version

2026.6.1

Operating system

macOS 15.x / Darwin 24.x

Install method

npm global, Node.js 24

Model

Primary session model: openai/gpt-5.5

Compaction override: alias gpt54mini for canonical openai/gpt-5.4-mini

Provider / routing chain

OpenClaw -> OpenAI plugin -> ChatGPT Responses runtime (agentRuntime.id = "pi")

Additional provider/model setup details

The alias is defined under agents.defaults.models as:

"openai/gpt-5.4-mini": {
  "alias": "gpt54mini",
  "params": { "thinking": "high" },
  "agentRuntime": { "id": "pi" }
}

Changing only agents.defaults.compaction.model from gpt54mini to canonical openai/gpt-5.4-mini avoids the failure.

Logs, screenshots, and evidence

15:17:24+02:00 warn agent/embedded {"subsystem":"agent/embedded"} auto-compaction failed for openai/gpt-5.5: Unknown model: openai/gpt54mini

Sanitized verification after workaround:

agents.defaults.compaction.model = "openai/gpt-5.4-mini"
config valid: true
issues: []
warnings: []

Impact and severity

  • Affected users/systems/channels: OpenClaw sessions using agents.defaults.compaction.model set to a configured alias instead of a fully-qualified provider/model id.
  • Severity: Medium. Normal chat continues, but auto-compaction fails, so long sessions can lose the intended context-management behavior.
  • Frequency: Observed when auto-compaction runs with the alias override shown above.
  • Consequence: Context compaction does not complete until the config is changed to a canonical model id.

Additional information

This appears to be either:

  1. the embedded auto-compaction path not calling the normal model alias resolver, or
  2. the call site passing the configured alias into provider/model normalization before alias resolution.

The workaround is to avoid aliases in agents.defaults.compaction.model and use openai/gpt-5.4-mini directly.

No credentials, user paths, account names, chat IDs, or local file paths are included in this report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper: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.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions