Skip to content

Discord channel remains trapped in oversized session after /new; compaction fails provider_error_4xx and model drifts from codex/gpt-5.5 to gpt-5.4 #90496

@nguyenjustin214-lab

Description

@nguyenjustin214-lab

Summary

A Discord channel can get trapped in an oversized session where every normal message returns:

Context is too large and auto-compaction could not recover this turn. Try again, use /compact, or use /new to start a fresh session.

This persists even after light follow-up messages and after attempting to recover with /new/manual compaction. The channel continues to bind to a very large session, compaction repeatedly fails with provider_error_4xx, and the active channel session can show gpt-5.4 even though global/default config is pinned to codex/gpt-5.5 with no fallbacks.

Environment

OpenClaw 2026.6.1 (2e08f0f)
macOS 26.3.1 arm64
Node 25.5.0
Gateway app 2026.6.1
Discord channel plugin enabled and Discord status OK

Config/model policy:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "codex/gpt-5.5",
        "fallbacks": []
      }
    }
  }
}

Configured subagents were also set back to codex/gpt-5.5 with fallbacks: [] after the 2026.6.1 update migrated them to openai/gpt-5.5.

openclaw models list shows:

codex/gpt-5.5 default,configured auth yes
openai/gpt-5.5 configured auth no
openai/gpt-5.4 configured auth no

Expected behavior

One of these should happen when a Discord channel session gets too large:

  1. Auto-compaction succeeds and the logical channel session continues with a smaller context.
  2. /compact succeeds manually.
  3. /new creates a clean small session for the channel.
  4. If compaction cannot succeed, OpenClaw should preserve transcript/state and rotate safely, or at least stop rebinding the channel to the same unrecoverable oversized lane.

The channel should also respect the configured default route codex/gpt-5.5 and should not drift to gpt-5.4 when no fallback is configured.

Actual behavior

The Discord #main channel repeatedly returns the context-too-large error even for simple messages like a product question or “Hello”.

The session remains large/over budget and compaction fails repeatedly:

[compaction-diag] end runId=58d36597-52c3-476a-954d-e01561f23d58 sessionKey=agent:main:discord:channel:1488013357016420522 diagId=cmp-mq00oayd-3WEMIw trigger=budget provider=codex/gpt-5.5 attempt=1 maxAttempts=1 outcome=failed reason=provider_error_4xx durationMs=427
[compaction-diag] end runId=58d36597-52c3-476a-954d-e01561f23d58 sessionKey=agent:main:discord:channel:1488013357016420522 diagId=cmp-mq05by5r-Cc9sYA trigger=budget provider=codex/gpt-5.5 attempt=1 maxAttempts=1 outcome=failed reason=provider_error_4xx durationMs=337
[compaction-diag] end runId=58d36597-52c3-476a-954d-e01561f23d58 sessionKey=agent:main:discord:channel:1488013357016420522 diagId=cmp-mq07oeww-J67I_w trigger=budget provider=codex/gpt-5.5 attempt=1 maxAttempts=1 outcome=failed reason=provider_error_4xx durationMs=367

Live session inspection showed this channel bound to an oversized/near-overlimit session:

{
  "key": "agent:main:discord:channel:1488013357016420522",
  "sessionId": "58d36597-52c3-476a-954d-e01561f23d58",
  "modelProvider": "codex",
  "model": "gpt-5.4",
  "totalTokens": 231980,
  "contextTokens": 272000,
  "totalTokensFresh": true
}

After further attempted recovery, the channel showed a new session id but still gpt-5.4 and not a clean/small 5.5 lane:

{
  "key": "agent:main:discord:channel:1488013357016420522",
  "sessionId": "f79787f0-a5ba-4d64-9d34-f2a69e6d69c3",
  "modelProvider": "codex",
  "model": "gpt-5.4",
  "totalTokens": null,
  "contextTokens": 200000,
  "totalTokensFresh": false
}

There was also an idle scheduled/reminder-style item targeting the same channel session with codex/gpt-5.4 while the rest of GPT cron routes were codex/gpt-5.5:

acba74a9-f602-4e93-b350-b740dcea0106 Pick up animal poop ... idle session:agent:main:discord:channel:1488013357016420522 ... main codex/gpt-5.4

User-visible impact

The Discord channel becomes effectively unusable. Every normal message returns the same context-too-large warning. Manual /compact produces no usable recovery. /new/recovery behavior does not reliably create a clean, small, configured-model continuation.

Notes

  • Gateway and Discord health were otherwise OK.
  • Config validation passed.
  • Global default route was codex/gpt-5.5 with no fallbacks.
  • The system intentionally avoids direct OpenAI API routing; openai/gpt-* entries are configured compatibility entries but auth is not available and should not be active defaults.
  • This bug report omits private Discord content and tokens.

Ask

Please investigate:

  1. Why compaction returns provider_error_4xx without a recoverable fallback path.
  2. Why /new or channel recovery can leave the channel bound to a huge/failed lane.
  3. Why a Discord channel session can show gpt-5.4 despite config default codex/gpt-5.5 and fallbacks: [].
  4. Whether scheduled/reminder/session-targeted items can pin or recreate a channel session using stale model/runtime metadata.
  5. Whether OpenClaw should automatically preserve transcript + rotate the channel when compaction is unrecoverable, instead of repeatedly returning the same error.

Metadata

Metadata

Assignees

Labels

P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm 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:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions