Skip to content

release: v0.6.2 — token usage tracking + hardcode cleanup#324

Merged
ajianaz merged 1 commit into
mainfrom
develop
Jun 21, 2026
Merged

release: v0.6.2 — token usage tracking + hardcode cleanup#324
ajianaz merged 1 commit into
mainfrom
develop

Conversation

@ajianaz

@ajianaz ajianaz commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Release v0.6.2

Merge developmain for the v0.6.2 patch release.

Included since v0.6.1

Highlights

  • 🔴 Critical fix: tokens_used was always None — now properly propagated
  • 🟠 Streaming review now collects token usage via stream_options.include_usage
  • 🟡 Multi-batch scan now accumulates (not overwrites) token counts
  • Hardcode cleanup: magic numbers extracted to named constants

Full changelog: see CHANGELOG.md [0.6.2] section.


After merge: tag v0.6.2 will be pushed to trigger the release workflow.

… (#323)

Three bugs caused tokens_used to always be None or partial:

1. parse_review_response/parse_scan_response hardcoded Ok((..., None)),
   discarding the Usage object from the API response. Fixed by threading
   Option<&Usage> through both functions and converting via
   usage_to_token_usage().

2. chat_completion_stream only collected delta.content, ignoring the
   usage field in the final SSE chunk. Now sends stream_options.include_usage
   and parses usage from top-level or choices[0].delta.usage.

3. scan multi-batch total_tokens was overwritten per batch instead of
   accumulated. Fixed with proper accumulation of input/output/cost.

Also:
- Extracted magic numbers (20, 60_000) to named constants
- Usage struct now accepts camelCase aliases (promptTokens etc)
- chat_completion returns (String, Option<Usage>) tuple
- Added 4 regression tests for token usage threading
- Bumped version 0.6.1 → 0.6.2

All 590 tests pass (568 unit + 16 CLI + 6 config).
@ajianaz ajianaz merged commit 4f0d027 into main Jun 21, 2026
10 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.

1 participant