Preserve multi-tool history groups #41

Merged
lost-rob0t merged 5 commits from fix/zara-008-multi-tool-history into fix/zara-007-intent-precedence 2026-07-19 01:35:15 +00:00
lost-rob0t commented 2026-07-18 21:57:03 +00:00 (Migrated from github.com)

What

  • validate tool results as one contiguous group after the assistant message that requested them
  • preserve valid results in provider tool-call order while dropping duplicates, unknown IDs, orphans, and cross-turn results
  • cover OpenAI- and Anthropic-shaped histories, partial results, mixed turns, and the existing add_messages reducer

Why

The previous validator compared every tool result only with the immediately preceding kept message. After keeping the first result, the preceding message was no longer the assistant tool-call message, so valid second and later results were discarded.

Impact

Multi-tool agent turns now remain valid across conversation history without relaxing message-boundary validation. This change stays in the agent/LLM boundary and does not move application logic out of Prolog.

Validation

  • nix develop -c pytest
  • nix develop -c bash -c 'pytest && for test_script in scripts/test-*.sh; do bash "$test_script"; done'

Closes #9

## What - validate tool results as one contiguous group after the assistant message that requested them - preserve valid results in provider tool-call order while dropping duplicates, unknown IDs, orphans, and cross-turn results - cover OpenAI- and Anthropic-shaped histories, partial results, mixed turns, and the existing `add_messages` reducer ## Why The previous validator compared every tool result only with the immediately preceding kept message. After keeping the first result, the preceding message was no longer the assistant tool-call message, so valid second and later results were discarded. ## Impact Multi-tool agent turns now remain valid across conversation history without relaxing message-boundary validation. This change stays in the agent/LLM boundary and does not move application logic out of Prolog. ## Validation - `nix develop -c pytest` - `nix develop -c bash -c 'pytest && for test_script in scripts/test-*.sh; do bash "$test_script"; done'` Closes #9
Sign in to join this conversation.
No description provided.