[P0] Prolog-RLM context cap retains oldest 192 messages and drops newest tool results #107

Open
opened 2026-09-06 04:15:53 +00:00 by nsaspy · 0 comments
Owner

Summary

The Agent Zero Prolog-RLM adapter bounds history by stopping after the first 192 units. Agent Zero history is chronological, so long-running chats retain their oldest turns and discard the newest tool results, decisions, and progress.

Owning code

plugins/_prolog_rlm/helpers/loop.py:

  • line 49 sets _MAX_COMPILED_UNITS = 192.
  • lines 73-93 enumerate prior from index 0 forward and break once the unit count reaches the cap.
  • a permanent system unit consumes one slot, leaving only 191 prior messages when present.

There is no regression test with more than 192 messages. Existing tests only cover two prior messages.

Live impact

The current hackmode-rage-worker chat has:

  • 702 persisted history messages.
  • 342 model iterations.
  • 341 provider response IDs.
  • only 7 response-tool completions.
  • current context estimate of 300,093 tokens.

At least the newest 510 messages are excluded by the adapter cap. Those excluded turns contain the latest tool results and progress needed to avoid repeating work. This matches the reported high spend with little useful output.

Acceptance criteria

  • Select the newest bounded nonempty history messages, not the oldest.
  • Preserve chronological order in the selected slice.
  • Preserve original sequence/index provenance in unit names or metadata.
  • Keep the permanent system/instruction unit without silently reducing recent-history correctness.
  • Add tests with at least 250 messages proving the newest tool result and current task state survive, the oldest cold turns are omitted, and ordering remains stable.
  • Add a long-running scheduler regression showing later cycles see the immediately preceding cycle result.
  • Keep request byte and per-unit bounds fail-closed.
## Summary The Agent Zero Prolog-RLM adapter bounds history by stopping after the first 192 units. Agent Zero history is chronological, so long-running chats retain their oldest turns and discard the newest tool results, decisions, and progress. ## Owning code plugins/_prolog_rlm/helpers/loop.py: - line 49 sets _MAX_COMPILED_UNITS = 192. - lines 73-93 enumerate prior from index 0 forward and break once the unit count reaches the cap. - a permanent system unit consumes one slot, leaving only 191 prior messages when present. There is no regression test with more than 192 messages. Existing tests only cover two prior messages. ## Live impact The current hackmode-rage-worker chat has: - 702 persisted history messages. - 342 model iterations. - 341 provider response IDs. - only 7 response-tool completions. - current context estimate of 300,093 tokens. At least the newest 510 messages are excluded by the adapter cap. Those excluded turns contain the latest tool results and progress needed to avoid repeating work. This matches the reported high spend with little useful output. ## Acceptance criteria - Select the newest bounded nonempty history messages, not the oldest. - Preserve chronological order in the selected slice. - Preserve original sequence/index provenance in unit names or metadata. - Keep the permanent system/instruction unit without silently reducing recent-history correctness. - Add tests with at least 250 messages proving the newest tool result and current task state survive, the oldest cold turns are omitted, and ordering remains stable. - Add a long-running scheduler regression showing later cycles see the immediately preceding cycle result. - Keep request byte and per-unit bounds fail-closed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/a0-symbolics#107
No description provided.