Commit 1cb90cc
committed
Fix calibration using DB message count instead of compressed window count
After a compressed turn (layers 1-4), calibrate() was called with
withParts.length — the total number of messages in the DB — instead of
the number of messages actually sent to the model (the compressed window).
On the next turn, newMsgCount = dbCount - dbCount = near-zero, so
expectedInput ≈ lastKnownInput (the compressed prompt size, e.g. 114K).
Since 114K < maxInput (168K), layer 0 fires and sends all messages
uncompressed → overflow (405K on a 200K-limit model).
Fix: transform() now sets lastTransformedCount = result.messages.length
via a thin public wrapper around the renamed transformInner(). The event
handler uses getLastTransformedCount() for calibration instead of
withParts.length. On layer 0 these are equal; on layers 1-4, the delta
on the next turn is now computed relative to the compressed window.1 parent 6af2b88 commit 1cb90cc
3 files changed
+39
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
54 | 66 | | |
55 | 67 | | |
56 | 68 | | |
| |||
139 | 151 | | |
140 | 152 | | |
141 | 153 | | |
| 154 | + | |
142 | 155 | | |
143 | 156 | | |
144 | 157 | | |
| |||
691 | 704 | | |
692 | 705 | | |
693 | 706 | | |
694 | | - | |
| 707 | + | |
695 | 708 | | |
696 | 709 | | |
697 | 710 | | |
| |||
890 | 903 | | |
891 | 904 | | |
892 | 905 | | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
893 | 924 | | |
894 | 925 | | |
895 | 926 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
222 | | - | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
223 | 228 | | |
224 | 229 | | |
225 | 230 | | |
| |||
0 commit comments