openclaw - 💡(How to fix) Fix [control-center] AI usage mix: Feishu sessions misclassified + stale data in cumulative view [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#59458Fetched 2026-04-08 02:24:53
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
closed ×1locked ×1
RAW_BUFFERClick to expand / collapse

描述

The "AI usage mix (all sessions)" pie chart in the Control Center has two bugs:

Bug 1 — Feishu and Webchat sessions are misclassified as "Main/内部会话"

The session type classifier functions (classifySessionTypeFromSessionKey and classifySessionTypeLabel in usage-cost.ts) only recognize cron, discord, and telegram channel types. Sessions from Feishu and Webchat are not handled and fall through to the default return value "Main/内部会话".

Bug 2 — Cumulative "all sessions" view uses stale sessions.json snapshot instead of real jsonl history events

The cumulative bySessionType breakdown calls buildSessionTypeBreakdownFromSessionContexts(), which only reads from the sessions.json snapshot. Other breakdowns like byAgent and byProvider correctly use runtimeEvents30d (the full jsonl history).

Expected behavior

  • Feishu and Webchat sessions should appear as their own categories in the pie chart
  • Cumulative "all sessions" view should reflect the full 30-day token count

Environment

  • OpenClaw control-center (latest)
  • Multiple agents with Feishu channel active
<img width="1832" height="716" alt="Image" src="https://github.com/user-attachments/assets/1612b495-ccc3-4efc-8db9-d8561cc193c6" /> <img width="1332" height="326" alt="Image" src="https://github.com/user-attachments/assets/fb541b0d-5ed0-4f4b-a8a0-dccb2d7967e7" />

extent analysis

TL;DR

Update the classifySessionTypeFromSessionKey and classifySessionTypeLabel functions to recognize Feishu and Webchat channel types, and modify buildSessionTypeBreakdownFromSessionContexts to use the full jsonl history events.

Guidance

  • Update the classifySessionTypeFromSessionKey and classifySessionTypeLabel functions in usage-cost.ts to include Feishu and Webchat channel types, preventing them from being misclassified as "Main/内部会话".
  • Modify buildSessionTypeBreakdownFromSessionContexts to use runtimeEvents30d instead of the sessions.json snapshot for the cumulative "all sessions" view.
  • Verify the changes by checking the "AI usage mix (all sessions)" pie chart in the Control Center to ensure Feishu and Webchat sessions are correctly categorized and the cumulative view reflects the full 30-day token count.
  • Review the byAgent and byProvider breakdowns to understand how they correctly utilize runtimeEvents30d and apply similar logic to buildSessionTypeBreakdownFromSessionContexts.

Example

// Example update to classifySessionTypeFromSessionKey
function classifySessionTypeFromSessionKey(sessionKey: string) {
  if (sessionKey.includes('feishu')) return 'Feishu';
  if (sessionKey.includes('webchat')) return 'Webchat';
  // Existing logic for cron, discord, and telegram
}

Notes

The provided solution assumes that the runtimeEvents30d contains the necessary information for the cumulative "all sessions" view. If this is not the case, additional modifications may be required.

Recommendation

Apply the workaround by updating the classifySessionTypeFromSessionKey and classifySessionTypeLabel functions and modifying buildSessionTypeBreakdownFromSessionContexts to use runtimeEvents30d, as this directly addresses the identified bugs and should provide the expected behavior.

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

openclaw - 💡(How to fix) Fix [control-center] AI usage mix: Feishu sessions misclassified + stale data in cumulative view [1 participants]