openclaw - 💡(How to fix) Fix [Feature] Auto-tune or warn on session.parentForkMaxTokens instead of silent skip [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#63141Fetched 2026-04-09 07:57:54
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Error Message

session.parentForkMaxTokens defaults to 100000. When a parent session exceeds this, session-init silently skips the fork with a WARN-level log line: 2. Promote the WARN to a visible signal — post a one-time message to the originating channel ("⚠️ context window full, starting fresh — previous conversations not carried over") so users understand why the agent forgot things. Currently only logged.

Fix Action

Fix / Workaround

Current workaround

Code Example

[session-init] skipping parent fork (parent too large):
  parentKey=agent:main:discord:channel:1234
  → sessionKey=agent:main:discord:channel:5678
  parentTokens=154551
  maxTokens=100000
RAW_BUFFERClick to expand / collapse

Problem

session.parentForkMaxTokens defaults to 100000. When a parent session exceeds this, session-init silently skips the fork with a WARN-level log line:

[session-init] skipping parent fork (parent too large):
  parentKey=agent:main:discord:channel:1234
  → sessionKey=agent:main:discord:channel:5678
  parentTokens=154551
  maxTokens=100000

The child session starts with no context from the parent. For a Discord channel used as the agent's "home" channel, this manifests as the agent suddenly forgetting recent conversations at seemingly random intervals.

Observed in production

Today on 2026.4.8: our #chat parent session grew to 154,551 tokens vs the 100k cap. 4 child threads opened over a morning all started cold. Users experienced the agent as "amnesiac" — forgetting things it was told 30 min ago.

Current workaround

Raised session.parentForkMaxTokens to 200000. Opus has ~1M context so 200k is still conservative, but this is a manual tuning exercise per deployment. When the session grows past 200k we'll hit the same silent fork skip again.

Proposed solutions (pick one or more)

  1. Auto-compact the parent before forking — if parentTokens > maxTokens, trigger a compaction pass on the parent session before forking, instead of silently skipping. This feels like the right default given the new pluggable compaction provider (#56224) and memoryFlush (2026.4.7).

  2. Promote the WARN to a visible signal — post a one-time message to the originating channel ("⚠️ context window full, starting fresh — previous conversations not carried over") so users understand why the agent forgot things. Currently only logged.

  3. Auto-scale the default — default maxTokens to e.g. min(500_000, modelContextWindow × 0.25) instead of the static 100_000. For Opus/Sonnet/GPT-5 the 100k default is now extremely conservative.

Related

  • #56224 — pluggable compaction provider (could be wired into fork path)
  • #62146 — persisted compaction checkpoints (gives a safe rollback point)
  • #43661 — session hangs on compaction timeout (relevant if we auto-compact)

extent analysis

TL;DR

Increase the session.parentForkMaxTokens value or implement auto-compaction to prevent silent skipping of parent forks.

Guidance

  • Consider increasing the session.parentForkMaxTokens value to a more conservative limit, such as 200000 or higher, to reduce the likelihood of silent skipping.
  • Evaluate the proposed solution of auto-compacting the parent session before forking when parentTokens > maxTokens to prevent data loss.
  • Review the related issues, such as #56224 and #62146, to understand the potential benefits and limitations of implementing a pluggable compaction provider and persisted compaction checkpoints.
  • Assess the trade-offs of promoting the WARN to a visible signal, which could improve user experience but may also introduce additional complexity.

Example

No specific code snippet is provided, as the issue focuses on configuration and design decisions rather than code implementation.

Notes

The optimal solution will depend on the specific requirements and constraints of the deployment, including the available resources, model context window, and user experience goals.

Recommendation

Apply a workaround by increasing the session.parentForkMaxTokens value to a more conservative limit, such as 200000 or higher, to reduce the likelihood of silent skipping, and consider implementing auto-compaction in the future to provide a more robust solution.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING