Commit c40d411
fix: remove double usage_count increment in Session.retire() (#1816)
## Summary
- `Session.retire()` incremented `_usage_count`, but callers
(`mark_good()`, `mark_bad()`) already increment it before calling
`retire()`, causing a double-increment when a session is retired at the
usage limit.
- Removed the redundant `_usage_count += 1` from `retire()`.
- Added tests covering the no-double-increment invariant for
`mark_good()`, `mark_bad()`, and direct `retire()` calls.
---
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent c10cdf5 commit c40d411
2 files changed
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | | - | |
222 | 220 | | |
223 | 221 | | |
224 | 222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
88 | 106 | | |
89 | 107 | | |
90 | 108 | | |
| |||
0 commit comments