Skip to content

[Bug]: Dashboard child sessions inherit stale parent context token budget #97331

Description

@galiniliev

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

A newly opened Control UI dashboard chat can inherit a stale cached contextTokens value from its parent dashboard session, so it shows and uses a smaller context budget than the active model/config resolves.

Steps to reproduce

  1. Run OpenClaw with a dashboard parent session whose stored entry has modelProvider: "github-copilot", model: "claude-opus-4.8", and stale cached contextTokens: 128000.
  2. Configure the active model metadata for github-copilot/claude-opus-4.8 with contextTokens: 1000000 / contextWindow: 1000000.
  3. Open a new Control UI chat from the dashboard without explicitly choosing a model.
  4. Observe the new child session row/transcript reports the inherited 128k budget instead of deriving the current 1M budget.

Expected behavior

The new dashboard child session should inherit user-facing runtime selection such as provider/model/auth profile/settings, but it should not inherit cached runtime metadata like contextTokens. The session row should derive the current context budget from the active model/config/catalog.

Actual behavior

The new dashboard child session inherits the parent entry's cached contextTokens: 128000, then the Control UI context notice can display values such as 16k/128k or 106.3k / 128k for a model/config that currently resolves to a 1,000,000-token budget.

OpenClaw version

Source checkout on main before 730a24c199 (36722014ef reproduced the code path).

Operating system

NOT_ENOUGH_INFO

Install method

Source checkout / local Control UI dashboard session.

Model

github-copilot/claude-opus-4.8

Provider / routing chain

OpenClaw -> GitHub Copilot provider route

Additional provider/model setup details

The active config/model metadata resolved github-copilot/claude-opus-4.8 to contextTokens: 1000000 and contextWindow: 1000000, while the stale dashboard parent chain contained cached contextTokens: 128000 entries for the same provider/model.

Logs, screenshots, and evidence

# Active model/config evidence, redacted to field names and values:
"primary": "github-copilot/claude-opus-4.8"
"contextTokens": 1000000
"id": "claude-opus-4.8"
"contextWindow": 1000000
"contextTokens": 1000000

# Stale inherited dashboard parent chain, session keys and local paths redacted:
"modelProvider": "github-copilot"
"model": "claude-opus-4.8"
"contextTokens": 128000
"parentSessionKey": "[redacted dashboard parent session key]"

# Fresh child transcript showed the stale inherited budget:
{"type":"model_change","provider":"github-copilot","modelId":"claude-opus-4.8"}
📚 Context: 16k/128k (13%)
"parentSessionKey":"[redacted dashboard parent session key]","sessionId":"[redacted session id]","model":"claude-opus-4.8","contextTokens":128000,"status":"running"

# Root cause on main before the fix:
src/gateway/server-methods/sessions.ts inherited `parentEntry.contextTokens` inside `inheritSessionRuntimeSelection()`, so newly created dashboard child sessions copied cached parent budget metadata.

Impact and severity

Affected: Control UI dashboard users who create child sessions from a parent whose cached context metadata is stale after model/config/catalog changes.

Severity: High for affected sessions because context display and context-budget-derived decisions can be pinned to a smaller stale budget until metadata is cleared.

Frequency: Reproduced once directly in a fresh dashboard child session, with a stale dashboard parent chain containing five cached contextTokens: 128000 entries.

Consequence: The user sees an incorrect smaller context budget for a model that should show roughly 1M context, and may get misleading compaction/status behavior.

Additional information

Duplicate search checked related Control UI context display issues #46517 and #47431; those covered lifetime-token display confusion, not child-session inheritance of stale cached context metadata.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.bugSomething isn't workingclawsweeper: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.maintainerMaintainer-authored PRmaturity:stableIssue affects a taxonomy feature currently scored M4/M5.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions