Files
DeepSeek-Reasonix/benchmarks
YHHandreasonix 3025f5af2a feat(agent): deterministic tool-result pruning + cache-TTL-aware cold-resume maintenance (#3968)
* feat(agent): prune stale tool results before folding and on cold resume

Stale tool results are re-derivable (files re-read, commands re-run), so
eliding them is a free, lossless alternative to the paid summarize fold.
Prune runs only where a cache reset is already being paid: at the compact
trigger, where it skips the fold entirely when eliding alone clears the
threshold, and on resume after the provider prefix cache has expired
(cacheColdAfter), where rewriting history costs no extra misses and
directly shrinks the full-price first request. No message is ever removed,
so tool_call/result pairing and signed reasoning stay intact by
construction; originals are archived like fold drops.

* bench(e2e): context-maintenance driver — cold-resume A/B + placeholder comprehension

Three real-API scenarios for the prune work: seed two identical-shape fat
sessions, A/B the cold-restart miss tokens with and without pruning after
the provider cache has expired, and verify the model re-reads a file behind
a prune placeholder instead of answering from nothing.

* fix(control): widen cold-resume prune threshold to a risk-asymmetric default

Pruning a still-cached session costs ~4x the miss tokens of leaving it
alone (measured warm-cache A/B), while a threshold that is too large only
forgoes a free prune. Default to 24h until the cache-ttl probe pins the
real retention; never set below it.

* bench(e2e): check write/unmarshal errors in the maintenance driver (errcheck)

* fix(control): derive cold-resume idle from branch meta only (CodeQL go/path-injection)

The os.Stat mtime fallback fed a user-influenced path straight into a
filesystem call. Branch meta is guaranteed for every session the controller
has snapshotted, so the fallback only ever covered never-saved imports —
those now skip one prune until their first snapshot creates the meta.

---------

Co-authored-by: reasonix <[email protected]>
2026-06-11 14:38:27 +08:00
..