Skip to content

fix(agent): preserve unconsumed tool results during microcompact - #269

Open
jsoncm wants to merge 1 commit into
iOfficeAI:mainfrom
jsoncm:fix/protect-unconsumed-tool-round
Open

fix(agent): preserve unconsumed tool results during microcompact#269
jsoncm wants to merge 1 commit into
iOfficeAI:mainfrom
jsoncm:fix/protect-unconsumed-tool-round

Conversation

@jsoncm

@jsoncm jsoncm commented Aug 26, 2026

Copy link
Copy Markdown

Summary

Microcompact runs before the next provider request, after the latest assistant tool batch and its user tool results have already been stored in history. Previously, count-based triggering and clearing treated that unconsumed batch as historical context, allowing the next model turn to receive cleared tool output.

This change protects every tool result associated with the latest assistant tool batch. Protected results are excluded from both the count trigger and clearing candidates; older model-consumed results retain the existing cleanup behavior.

Tests

  • Added regression coverage for a 10-call current tool batch and mixed historical/current batches.
  • Updated unit, integration, acceptance, and compaction-order tests to model the actual engine message lifecycle.
  • just push -u origin fix/protect-unconsumed-tool-round
    • cargo fix and workspace Clippy
    • cargo fmt
    • 2,380 nextest tests passed (2 skipped)
    • cargo-hakari verification

Scope

This is intentionally limited to preserving unconsumed tool results. It does not change the default-disabled microcompact setting or introduce task-wide tool-call, duration, or batch-budget policies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant