microsoft / microsoft/agent-framework

.NET: CompactionMessageIndex.Update() drops new user messages when TodoProvider is configured

Open
#7,395 1 comment 0 reactions 1 assignee Claimed by @westey-m View on GitHub
.NET agents
Dominant language
Python
Stars
13.6k
Forks
2.3k
Avg merge
2d 45m
Merged PRs (30d)
358

Description

When using CompactionProvider together with TodoProvider,
the 2nd+ user messages are silently dropped and never reach the LLM.

Root cause: CompactionMessageIndex.Update() checks if the last message
in the message list has the same content as the last processed message.
If they match, it returns early thinking nothing changed.

But TodoProvider generates the same empty-todo message
("### Current todo list\n- none yet") every turn.
So in Round 2, the last message (new todo message) has the same content
as Round 1's last message (old todo message) → ContentEquals returns true
→ Update() returns early → the new user input is never added to the index
→ LLM only sees Round 1's stale messages.

This happens with Microsoft.Agents.AI 1.15.0.

Attached is a minimal reproduction project (3 files, no custom provider,
all types from MAF NuGet package).

Repro steps:
dotnet build BugRepro_CompactionMessageLoss\BugRepro_CompactionMessageLoss.csproj
dotnet run --project BugRepro_CompactionMessageLoss\BugRepro_CompactionMessageLoss.csproj

Expected: Round 2 LLM input should contain "What is the weather today?"
Actual: Round 2 LLM input only shows Round 1's "Hello" and todo message.

[BugRepro_CompactionMessageLoss.zip](https://github.com/user-attachments/files/30508002/BugRepro_CompactionMessageLoss.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.