Commit 4fedab2
committed
fix(agent): clear last_prompt_tokens after emergency compaction
Addresses review feedback: when emergency compaction succeeds in the
ContextOverflow recovery path, the context shrinks but last_prompt_tokens
still held the pre-compaction value. If the retried call then returned no
usage stats (mock/local provider, transient gap), the end-of-turn check
would read that stale huge value through effective_context_tokens and fire
a redundant compaction immediately after this one. Reset it to None on
successful emergency compaction so the check falls back to the fresh
post-compaction estimate.1 parent 28c9603 commit 4fedab2
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2523 | 2523 | | |
2524 | 2524 | | |
2525 | 2525 | | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
2526 | 2532 | | |
2527 | 2533 | | |
2528 | 2534 | | |
| |||
0 commit comments