Repository navigation
fix(agent-usage): preserve project and model names in usage history - #171
Merged
Merged
Conversation
239573049
added a commit
that referenced
this pull request
Dec 1, 2026
The per-day store (one segment file per day plus a manifest) replaced the single usage-snapshot.json, so the two upstream fixes are re-applied on top of it: - #168: a row priced from the table keeps one price version; tokens recorded at another version mark it "mixed" (no single snapshot price), the snapshot meta turns mixed as rows are recorded, and bill rows merge versions the same way. Segments store a mixed row's missing price apart from a model without a price. - #171: rows inside a day are indexed by the encoded [cwd, agent, model] tuple, so directories and model names with '|' never merge two rows; a version 1-2 snapshot's pipe-joined keys are split the same way #171 does. Migrating a version 1-2 snapshot now keeps every row as it was (no recount, no reprice), Claude rows included, and leaves the old file untouched so a rollback to a version that only reads it resumes from a consistent state. Claude replies are counted once per message id from the upgrade on. The #171 tests read the per-day store instead of the old file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #166.
A Claude request recorded under
/projects/core|mobileexported asmobile,claudeinstead ofclaude,fixture-model. Changing just the pipe to a hyphen made the CSV correct. The bug is in the history index, before CSV escaping: it joined the day, directory, agent and model with|and later split on the same character.History now indexes the tuple without delimiter ambiguity and keeps its four fields on each row. Bills, budgets, history charts and model lookup read those fields directly. Models containing
|and two different tuples that previously produced the same key remain distinct.Snapshot compatibility
[key, row]layout and gives colliding tuples distinct storage keys, so the previous reader doesn't drop their costs.Verification
On
main@5b3efc9, all three new Jaunt cases failed before the fix. With this patch,dotnet test tests/Octopus.Plugins.Jaunt.Tests/Octopus.Plugins.Jaunt.Tests.csproj -c Releasepassed 57/57 (0 skipped), on macOS 27.2.1 arm64 with .NET SDK 10.0.403.core-mobileand one incore|mobile, the CSV now reportsclaude,fixture-model,2,200000,0,0,200000,2.000000. Removing the synthetic transcripts and reloading the plugin reproduces the same CSV and all four project totals in the collision fixture.I also applied this commit and #168 together to
main@1304ffa: no merge conflicts, and the combined Jaunt suite passed 59/59 (0 skipped).Impact
This affects the built-in Agent Usage history, project budgets and new bill exports on desktop. The tests use local synthetic transcripts and an offline price catalog. No desktop UI or full-solution run.