openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Chat loops forever when a compacted tool result is evicted: the retrieve miss tells the model to re-run

Open yh928 opened this issue 4 months ago • 0 comments

Summary

Chat can hang forever and never answer: the model retrieves a compacted tool result, the store misses, and the miss message tells it to re-run the tool — which reproduces the same oversized result, which is compacted and offloaded again.

Problem

A large tool result is compacted to a summary plus a retrieve_tool_output(hash) / ⟦tj:hash⟧ marker, with the original offloaded to the CCR store. When the model later retrieves that hash and the entry is gone, the error instructs it to "re-run the tool to regenerate it". Re-running produces the same oversized output, which is compacted and offloaded under a new hash that misses just as fast. Observed live: a parent agent re-delegated to a subagent forever on an evicted result, burning turns and cost with no reply.

The eviction itself is easy to hit. The in-memory CCR store is FIFO-bounded at 256 entries and lost on restart, so a retrieve footer the model was handed can go stale inside a single busy turn.

Steps to reproduce:

  1. Run a turn whose tool result is large enough to be compacted and offloaded.
  2. Keep the turn busy until the entry is evicted (or restart the core).
  3. Have the model retrieve the hash from its footer.

Expected: the model proceeds with the summary it already has. Actual: it re-runs the same call and the cycle repeats without bound.

Solution (optional)

Two changes: make the retrieve-miss message state that the original is gone, that the same call must not be re-run, and that the compacted summary is what to proceed with (narrower arguments only if a specific detail is essential); and default ccr_disk_enabled ON so the TTL/size-capped disk tier keeps offloaded originals recoverable, making a compaction footer a promise the store can keep. Configs that explicitly set false stay unchanged.

Acceptance criteria

  • [ ] Repro gone — an evicted retrieve ends the turn with a slightly less detailed answer, not an unbounded loop.
  • [ ] Both retrieve surfaces covered — retrieve_tool_output and tokenjuice_retrieve.
  • [ ] Opt-out preserved — an explicit ccr_disk_enabled = false is honoured.
  • [ ] Regression safety — coverage asserting the miss message does not instruct a blind re-run.
  • [ ] Diff coverage ≥ 80% — the fix PR meets the changed-lines coverage gate.

Related

Fix: #5257

yh928 avatar Jul 31 '26 08:07 yh928