fix(usage-log): remove redundant taskId field from TokenUsageRecord

taskId was set to params.runId, the same value already stored in the
runId field, giving downstream consumers two identical fields with
different names. Remove taskId from the type and the entry constructor
to avoid confusion.
This commit is contained in:
jiarung 2026-03-13 09:40:24 +00:00
parent d03e7ae8ed
commit cece47f490

View File

@ -3,7 +3,6 @@ import path from "path";
export type TokenUsageRecord = {
id: string;
taskId?: string;
label: string;
tokensUsed: number;
tokenLimit?: number;
@ -77,7 +76,6 @@ export async function recordTokenUsage(params: {
const entry: TokenUsageRecord = {
id: makeId(),
taskId: params.runId,
label: params.label,
tokensUsed: Math.trunc(total),
...(usage.input != null && usage.input > 0 && { inputTokens: Math.trunc(usage.input) }),