goose icon indicating copy to clipboard operation
goose copied to clipboard

Stream token usage on every agent message

Open katzdave opened this issue 2 months ago • 4 comments

Token usage gets saved to the session every turn, so just pull that.

  • Some clientside renames to make more clear what each token means
  • Make sure we always sum input + output tokens -> total tokens even if the provider doesn't provide

katzdave avatar Oct 23 '25 20:10 katzdave

@katzdave can you resolve the conflicts when you get a chance?

zanesq avatar Oct 28 '25 17:10 zanesq

@katzdave can you resolve the conflicts when you get a chance?

Done

katzdave avatar Oct 28 '25 18:10 katzdave

I think this fixes https://github.com/block/goose/issues/3538 also in my testing

zanesq avatar Oct 28 '25 21:10 zanesq

LGTM tested locally and token count is much better.

One question: what happens when multiple agents/requests update the same session concurrently would it lose the updates?

I think it should be fine, since all of the updates are just pulling the latest state from the session on every message.

I think this fixes #3538 also in my testing

Nice! I think desktop will need one more small fix for this but, very close.

katzdave avatar Oct 28 '25 23:10 katzdave