# fix\(cost\): retain partial-refresh failures only from the same source · lucenx/codexbar-plasma

[View on GitCafe](https://git.cafe/lucenx/codexbar-plasma/commit/5484f788f4c9d8e4a482ecde0bdae30d3972692d)

Repository: [lucenx/codexbar-plasma](https://git.cafe/lucenx/codexbar-plasma)

Visibility: public

Requested revision: 5484f788f4c9d8e4a482ecde0bdae30d3972692d

Requested commit: 5484f788f4c9d8e4a482ecde0bdae30d3972692d

Commit: 5484f788f4c9d8e4a482ecde0bdae30d3972692d

Tree: 25b08453b05d5f0aa2b98170a71c583c73a1715b

Author: Simone

Committer: Simone

## Message

```
fix(cost): retain partial-refresh failures only from the same source

After a command-source change the retained cost map still holds the
previous context's snapshots. A partial reply from the new source merged
those snapshots for its failed providers and then stamped the result
with the new source, re-tagging old costs as current on both the
provider meters and Usage & Spend. The merge now retains against an
empty map unless tokenCostsContext already matches costCommandSource;
same-context failure retention is unchanged.

Cover: partial-refresh QML case in test_cost_context.py (cross-source
drop + same-source retain, negative-controlled), static ui-regression
pin on the guard. CHANGELOG updated.

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

```

## Parents

- [77dcf05dcc06b95475a281e5c31d3036734e0e95](https://git.cafe/lucenx/codexbar-plasma/commit/77dcf05dcc06b95475a281e5c31d3036734e0e95?format=markdown)

[Source at this commit](https://git.cafe/lucenx/codexbar-plasma/tree/5484f788f4c9d8e4a482ecde0bdae30d3972692d?format=markdown)
