Skip to content

Agent Runtime: Output token usage is per-turn, not cumulative #135

Description

@wangtsiao

Describe the bug

The usage information displayed to the user shows output token count as a per-turn value rather than an accumulated total across the entire session.

Current behavior

The output_tokens field shown in the UI appears to only reflect the most recent turn's token consumption, not the cumulative count since the session started.

Where to look

  • crates/core/src/execution.rs:215output_tokens: Option<i64> field appears to be per-turn
  • crates/core/src/session.rs:244total_output_tokens: usize exists but may not be properly propagated to the UI
  • The accumulated usage tracking at crates/core/src/execution.rs:919-929 accumulates per-turn, but the UI may be reading the wrong field

Expected behavior

The output token display should show the total accumulated output tokens for the entire session, not just the current turn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions