mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 07:48:45 +00:00
991fe4fc5bskipped a pressure compaction when the tokens outside the range plus a minimal summary reached the model's limit. "Outside the range" includes the newest messages, so a huge newest message (priced by its characters by the meter) made the guard skip the very summary that makes room for it. The real Harness test "a chat the model server refused once is not stuck: the next message compacts ... and goes through" caught it: before991fe4fc5bit passes (35 of 36 in agent-context + agent-context-optimizer, the one failure is another test); on 0.2.24 / main it fails with "only the first, too large, prompt was refused: 32914, 52940" (the chat stayed refused). The tests that need the real Harness are skipped without STRATA_HARNESS_DIR, which is why the full-suite run missed it. The guard now uses what no summary can remove: the fixed part, the measured total less every conversation message (system prompt and tool list), and skips only when that alone, plus a minimal summary, reaches the limit (a 16K window: 10.9K of instructions and tools against a 10,036 limit). The 16K case is still guarded; the refused-once case compacts again. Verified with the real Harness of the 0.2.24 package (AppImage extracted on a rental): agent-context.test.mjs passes with the fix. Tests: agent-compaction-limit.test.mjs, now 6, with the huge-newest-message case.