fix: use transcript usage as fallback for /status token display

When using custom providers like LM Studio, Ollama, or DashScope,
token counts in /status show as 0 because the agent meta store
does not always have usage data populated for these providers.

Fix: set includeTranscriptUsage: true in both /status command and
the session_status tool. This enables the existing fallback path
that reads usage from the session transcript JSONL file when the
meta store has zero/missing token counts.

The merge logic already guards against overwriting valid data:
- totalTokens: only updated when zero or transcript value is larger
- inputTokens/outputTokens: only filled when zero/missing
- model/contextTokens: only filled when missing

Fixes #54995
This commit is contained in:
jjjojoj 2026-03-26 16:32:37 +08:00 committed by Peter Steinberger
parent b601c7cb8f
commit 97a8ba89fd
2 changed files with 2 additions and 1 deletions

View File

@ -499,6 +499,7 @@ export function createSessionStatusTool(opts?: {
skipDefaultTaskLookup: true,
primaryModelLabelOverride: primaryModelLabel,
...(providerForCard ? {} : { modelAuthOverride: undefined }),
includeTranscriptUsage: true,
});
const fullStatusText =
taskLine && !statusText.includes(taskLine) ? `${statusText}\n${taskLine}` : statusText;

View File

@ -345,7 +345,7 @@ export async function buildStatusText(params: {
subagentsLine,
taskLine,
mediaDecisions: params.mediaDecisions,
includeTranscriptUsage: false,
includeTranscriptUsage: true,
});
return statusText;