openclaw - 💡(How to fix) Fix Codex GPT-5.5 context budget can be overestimated as 1M, delaying compaction until context overflow

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…

On OpenClaw 2026.5.12, long-running Feishu sessions using GPT-5.5 through the Codex/OAuth path were cached and reported with a 1,000,000 token context budget. OpenAI's GPT-5.5 launch docs distinguish the surfaces: GPT-5.5 in Codex has a 400K context window, while the API has a 1M context window.

That mismatch made the active context engine (lossless-claw) compact too late. Eventually the user-facing symptom was the generic channel reply:

⚠️ Something went wrong while processing your request. Please try again, or use /new to start a fresh session.

After lowering only the GPT-5.5 Codex-backed agents/sessions to contextTokens: 350000, the same Zero/Feishu route returned to normal and status reported the expected smaller budget.

Error Message

Before workaround, active GPT-5.5 Codex sessions were shown/cached as 1000k context:

Root Cause

A global lower contextThreshold is not a good workaround because other agents use different models with smaller native windows, e.g. MiniMax around ~200K. The durable fix should be model/runtime-specific context budgeting, so Codex GPT-5.5 can compact at a safe point without affecting MiniMax or other agents.

Fix Action

Fix / Workaround

  • OpenClaw: 2026.5.12 (f066dd2)
  • OS: macOS 26.5 arm64
  • Gateway: local LaunchAgent, 127.0.0.1:18789
  • Channel: Feishu
  • Agent: main / Zero
  • Model config: openai/gpt-5.5 with Codex runtime/OAuth route
  • Context engine: lossless-claw
  • lossless-claw config at time of workaround:
    • contextThreshold: 0.7
    • proactiveThresholdCompactionMode: inline
    • freshTailMaxTokens: 100000

Before workaround, active GPT-5.5 Codex sessions were shown/cached as 1000k context:

Local workaround

Code Example

⚠️ Something went wrong while processing your request. Please try again, or use /new to start a fresh session.

---

agent:main:feishu:default:...  gpt-5.5  OpenAI Codex  117k/1000k (12%)
agent:main:feishu:zero:...     gpt-5.5  OpenAI Codex  135k/1000k (14%)
agent:balao-wealth:main        gpt-5.5  OpenAI Codex  239k/1000k (24%)

---

{
  "key": "openai-codex/gpt-5.5",
  "name": "GPT-5.5",
  "contextWindow": 1000000,
  "available": true
}

---

{
  "agents": {
    "list": [
      { "id": "main", "contextTokens": 350000 },
      { "id": "neo", "contextTokens": 350000 },
      { "id": "balao-wealth", "contextTokens": 350000 }
    ]
  }
}

---

agent:main:feishu:default:...  gpt-5.5  OpenAI Codex  117k/350k (33%)
agent:main:feishu:zero:...     gpt-5.5  OpenAI Codex  135k/350k (39%)
agent:balao-wealth:main        gpt-5.5  OpenAI Codex  239k/350k (68%)

---

openclaw agent --agent main --message "请只回复:ok"
# ok
RAW_BUFFERClick to expand / collapse

Summary

On OpenClaw 2026.5.12, long-running Feishu sessions using GPT-5.5 through the Codex/OAuth path were cached and reported with a 1,000,000 token context budget. OpenAI's GPT-5.5 launch docs distinguish the surfaces: GPT-5.5 in Codex has a 400K context window, while the API has a 1M context window.

That mismatch made the active context engine (lossless-claw) compact too late. Eventually the user-facing symptom was the generic channel reply:

⚠️ Something went wrong while processing your request. Please try again, or use /new to start a fresh session.

After lowering only the GPT-5.5 Codex-backed agents/sessions to contextTokens: 350000, the same Zero/Feishu route returned to normal and status reported the expected smaller budget.

Environment

  • OpenClaw: 2026.5.12 (f066dd2)
  • OS: macOS 26.5 arm64
  • Gateway: local LaunchAgent, 127.0.0.1:18789
  • Channel: Feishu
  • Agent: main / Zero
  • Model config: openai/gpt-5.5 with Codex runtime/OAuth route
  • Context engine: lossless-claw
  • lossless-claw config at time of workaround:
    • contextThreshold: 0.7
    • proactiveThresholdCompactionMode: inline
    • freshTailMaxTokens: 100000

Observed behavior

Before workaround, active GPT-5.5 Codex sessions were shown/cached as 1000k context:

agent:main:feishu:default:...  gpt-5.5  OpenAI Codex  117k/1000k (12%)
agent:main:feishu:zero:...     gpt-5.5  OpenAI Codex  135k/1000k (14%)
agent:balao-wealth:main        gpt-5.5  OpenAI Codex  239k/1000k (24%)

openclaw models list --agent main --json also included:

{
  "key": "openai-codex/gpt-5.5",
  "name": "GPT-5.5",
  "contextWindow": 1000000,
  "available": true
}

The session then eventually failed in Feishu with the generic Something went wrong message instead of compacting early enough.

Expected behavior

For GPT-5.5 when served through Codex/OAuth runtime, OpenClaw should budget against the Codex surface limit, not the API limit.

Expected behavior would be one or more of:

  • openai-codex/gpt-5.5 defaults to the Codex-specific context budget documented by OpenAI.
  • Canonical openai/gpt-5.5 routed through Codex/OAuth uses the effective Codex budget for session persistence, status, and context-engine token budgeting.
  • Existing sessions with stale contextTokens: 1000000 are recomputed or capped when the effective runtime is Codex.
  • Context overflow surfaces a clear context-overflow diagnostic and triggers compaction/retry where possible, instead of only the generic channel error.

Local workaround

Applied only to GPT-5.5 Codex-backed agents, not globally:

{
  "agents": {
    "list": [
      { "id": "main", "contextTokens": 350000 },
      { "id": "neo", "contextTokens": 350000 },
      { "id": "balao-wealth", "contextTokens": 350000 }
    ]
  }
}

Also updated existing stale session entries where model == "gpt-5.5" and contextTokens > 350000 to 350000, then restarted the gateway.

After workaround:

agent:main:feishu:default:...  gpt-5.5  OpenAI Codex  117k/350k (33%)
agent:main:feishu:zero:...     gpt-5.5  OpenAI Codex  135k/350k (39%)
agent:balao-wealth:main        gpt-5.5  OpenAI Codex  239k/350k (68%)

A direct smoke test returned normally:

openclaw agent --agent main --message "请只回复:ok"
# ok

Why this matters

A global lower contextThreshold is not a good workaround because other agents use different models with smaller native windows, e.g. MiniMax around ~200K. The durable fix should be model/runtime-specific context budgeting, so Codex GPT-5.5 can compact at a safe point without affecting MiniMax or other agents.

Related issues

This seems related to the broader Codex context metadata/history, but the observed failure mode is specifically the 1M API budget being applied to Codex/OAuth GPT-5.5 sessions and delaying lossless-claw compaction:

  • #71403: 272k vs 400k metadata inconsistency
  • #81816: compaction trigger inconsistency with 1M contextTokens
  • #77858: contextTokens handling in native Codex harness

References

OpenAI's GPT-5.5 announcement states:

  • GPT-5.5 in Codex: 400K context window
  • GPT-5.5 in API: 1M context window

https://openai.com/index/introducing-gpt-5-5/

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 GPT-5.5 when served through Codex/OAuth runtime, OpenClaw should budget against the Codex surface limit, not the API limit.

Expected behavior would be one or more of:

  • openai-codex/gpt-5.5 defaults to the Codex-specific context budget documented by OpenAI.
  • Canonical openai/gpt-5.5 routed through Codex/OAuth uses the effective Codex budget for session persistence, status, and context-engine token budgeting.
  • Existing sessions with stale contextTokens: 1000000 are recomputed or capped when the effective runtime is Codex.
  • Context overflow surfaces a clear context-overflow diagnostic and triggers compaction/retry where possible, instead of only the generic channel error.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING