assistant2: Serialize token usage (#27586)

We'll need this for detecting old long threads

Release Notes:

- N/A
This commit is contained in:
Agus Zubiaga 2025-03-27 10:38:08 -03:00 committed by GitHub
parent 76d3a9a0f0
commit f15a241d3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -286,8 +286,7 @@ impl Thread {
tool_use,
action_log: cx.new(|_| ActionLog::new()),
initial_project_snapshot: Task::ready(serialized.initial_project_snapshot).shared(),
// TODO: persist token usage?
cumulative_token_usage: TokenUsage::default(),
cumulative_token_usage: serialized.cumulative_token_usage,
feedback: None,
}
}
@ -648,6 +647,7 @@ impl Thread {
})
.collect(),
initial_project_snapshot,
cumulative_token_usage: this.cumulative_token_usage.clone(),
})
})
}