notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 5d77354696a9e279c19ee41fd8a0469a7968fb5a
parent fac3b9245c0cb1b66f1bfd8388e9a6487459993f
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 26 Feb 2026 09:34:58 -0800

dave: fix context fill bar to use input_tokens only

The fill bar was using input_tokens + output_tokens, but only input
tokens consume context window space. Also add debug tracing on
ResultMessage usage values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Diffstat:
Mcrates/notedeck_dave/src/backend/claude.rs | 6++++++
Mcrates/notedeck_dave/src/messages.rs | 6++++--
Mcrates/notedeck_dave/src/ui/dave.rs | 2+-
3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/crates/notedeck_dave/src/backend/claude.rs b/crates/notedeck_dave/src/backend/claude.rs @@ -377,6 +377,12 @@ async fn session_actor( } // Extract usage metrics + tracing::debug!( + "ResultMessage usage: {:?}, total_cost_usd: {:?}, num_turns: {}", + result_msg.usage, + result_msg.total_cost_usd, + result_msg.num_turns + ); let (input_tokens, output_tokens) = result_msg .usage .as_ref() diff --git a/crates/notedeck_dave/src/messages.rs b/crates/notedeck_dave/src/messages.rs @@ -341,8 +341,10 @@ pub struct UsageInfo { } impl UsageInfo { - pub fn total_tokens(&self) -> u64 { - self.input_tokens + self.output_tokens + /// Context window fill: only input tokens consume context space. + /// Output tokens are generated from the context, not part of it. + pub fn context_tokens(&self) -> u64 { + self.input_tokens } } diff --git a/crates/notedeck_dave/src/ui/dave.rs b/crates/notedeck_dave/src/ui/dave.rs @@ -1485,7 +1485,7 @@ fn usage_bar_ui( context_window: u64, ui: &mut egui::Ui, ) { - let total = usage.map(|u| u.total_tokens()).unwrap_or(0); + let total = usage.map(|u| u.context_tokens()).unwrap_or(0); if total == 0 { return; }