Skip to content

fix(workbuddy): preserve cache usage from aggregated responses - #220

Merged
caigee-cmd merged 1 commit into
caigee-cmd:mainfrom
gruffwy:fix/workbuddy-cache-usage
Sep 20, 2026
Merged

caigee-cmd merged 1 commit into
caigee-cmd:mainfrom
gruffwy:fix/workbuddy-cache-usage

Conversation

@gruffwy

@gruffwy gruffwy commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Problem

WorkBuddy's non-streaming path is produced by aggregating an upstream stream. The aggregate conversion currently retains prompt/completion usage but drops cache-read and cache-write token counts.

Behavior

  • Parse usage.cache_read_tokens and usage.cache_write_tokens from aggregated responses.
  • Fall back to usage.prompt_tokens_details.cached_tokens when the top-level cache-read field is absent.
  • Preserve explicit zero values by using pointer fields.
  • Prefer the top-level cache-read value when both representations are present.

Tests

  • go test ./internal/providers/workbuddy
  • GOFLAGS=-buildvcs=false go test ./internal/app -run 'TestImportConstraints|TestDutyBoundaries' -count=1
  • git diff --check

@caigee-cmd
caigee-cmd merged commit 9319770 into caigee-cmd:main Sep 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants