Skip to content

Phantom duplicate session key causes /status to show 0 tokens when real session has data #48204

@Lukavyi

Description

@Lukavyi

Bug

When using Telegram DM topics with 1M context window (Opus), OpenClaw creates two session entries for the same thread:

  1. Real session (full Telegram-specific key): agent:main:telegram:personal:direct:<userId>:thread:<userId>:<topicId> - contains all usage data (totalTokens, inputTokens, outputTokens, cacheRead, cacheWrite)
  2. Phantom session (short main-alias key): agent:main:main:thread:<userId>:<topicId> - all fields are null

When /status is invoked, it resolves to the phantom session (shorter "main" alias key), showing Context: 0/1.0m (0%) even though the real session has ~60k tokens of actual usage.

Evidence

# Real session (has data):
agent:main:telegram:personal:direct:XXXXX:thread:XXXXX:1039883
  totalTokens: 60796
  cacheRead: 59035
  cacheWrite: 1760
  model: claude-opus-4-6
  contextTokens: 1000000

# Phantom session (empty):
agent:main:main:thread:XXXXX:1039883
  totalTokens: null
  totalTokensFresh: null
  inputTokens: null
  contextTokens: null

Expected Behavior

  • Either only one session entry should exist per thread
  • Or /status should resolve to the session that has actual usage data

Environment

  • OpenClaw 2026.3.14 (0d9d1ce)
  • Model: anthropic/claude-opus-4-6 (1M context)
  • Channel: Telegram DM with topics enabled
  • Context window: 1,000,000 tokens configured

Related Issues

Metadata

Metadata

Assignees

Labels

No labels
No labels

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