SIGN IN SIGN UP

fix(compaction): bound image token cost to stop runaway triple compaction

Image content blocks were counted toward the context estimate using their
raw base64 payload length (data.len() / 4 tokens). A handful of screenshots
(~1.4M base64 chars) inflated the estimate to ~256k tokens while the real
provider-observed input was only ~35-76k. This spuriously tripped the
reactive compaction threshold and, because the images stayed in the recent
kept turns, each compaction barely lowered the estimate -- driving three
back-to-back compactions within ~45s until the images finally fell out of
the kept window.

Charge a flat IMAGE_TOKEN_COST (1600 tokens) per image instead, matching how
providers actually tokenize images by resolution rather than transport bytes.
Adds a regression test.
J
jeremy committed
983fda331511e8075ccc42f0e8e051d69352b2c9
Parent: cc2795a