mirror of
https://github.com/openai/codex.git
synced 2026-11-19 22:30:42 +00:00
Show task tokens and usage estimates in the agent command center (#44970)
## What changed - Display input/output token counts and estimated credits and USD cost in task details. Prefer live token totals, falling back to complete totals from usage breakdowns. - Fetch estimates for the selected task on a one-minute cadence for supported Business and Enterprise plans. Cache results, preserve prior nonzero estimates when a response reports zero, and stop fetching when the capability is unavailable. - Clear cached usage and discard pending results on account changes, reconnects, or missed server events. Prioritize activity and usage over the original prompt when space is limited. ## Testing Add a rendering snapshot and tests covering caching, stale results, unavailable usage, token resets, and incomplete usage breakdowns. GitOrigin-RevId: b72c96053557389fdc723a70fab0dab841a52e49
This commit is contained in:
@@ -32,7 +32,7 @@ use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
|
||||
const TOKEN_ACTIVITY_FETCH_TIMEOUT: std::time::Duration =
|
||||
std::time::Duration::from_secs(/*secs*/ 15);
|
||||
const THREAD_USAGE_FETCH_TIMEOUT: std::time::Duration =
|
||||
pub(super) const THREAD_USAGE_FETCH_TIMEOUT: std::time::Duration =
|
||||
std::time::Duration::from_secs(/*secs*/ 65);
|
||||
const RATE_LIMIT_RESET_REQUEST_TIMEOUT: std::time::Duration =
|
||||
std::time::Duration::from_secs(/*secs*/ 15);
|
||||
@@ -844,7 +844,7 @@ pub(super) async fn fetch_account_token_activity(
|
||||
.wrap_err("account/usage/read failed in TUI")
|
||||
}
|
||||
|
||||
async fn fetch_thread_usage(
|
||||
pub(super) async fn fetch_thread_usage(
|
||||
request_handle: AppServerRequestHandle,
|
||||
thread_id: ThreadId,
|
||||
) -> Result<ThreadUsageOutcome> {
|
||||
|
||||
Reference in New Issue
Block a user