What happened?
Issue:
When sending multiple messages to the same task (same taskId), the Task.history field only contains messages from the current turn instead of accumulating all historical messages. This is inconsistent with the Python SDK behavior.
Expected Behavior:
When continuing an existing task:
- Message 1 response:
task.history = [user1, agent1]
- Message 2 response:
task.history = [user1, agent1, user2, agent2]
- Message 3 response:
task.history = [user1, agent1, user2, agent2, user3, agent3]
Actual Behavior:
- Message 1 response:
task.history = [user1, agent1] ✅
- Message 2 response:
task.history = [user2, agent2] ❌ (missing user1, agent1)
- Message 3 response:
task.history = [user3, agent3] ❌ (missing all previous)
Root Cause:
The DefaultRequestHandler/ResultManager builds the task history from events published to the ExecutionEventBus during the current execution only. When a RequestContext contains an existing task with prior history, those historical messages are not republished to the event bus, causing them to be lost in the final response.
Workaround:
In the AgentExecutor.execute() method, manually republish historical messages before processing:
if (task?.history && Array.isArray(task.history) && task.history.length > 0) {
for (const historicalMessage of task.history) {
eventBus.publish(historicalMessage);
}
}
Expected Fix:
The SDK should automatically republish historical messages from requestContext.task.history when present, similar to how the Python SDK handles this scenario.
Relevant log output
Code of Conduct
What happened?
Issue:
When sending multiple messages to the same task (same
taskId), theTask.historyfield only contains messages from the current turn instead of accumulating all historical messages. This is inconsistent with the Python SDK behavior.Expected Behavior:
When continuing an existing task:
task.history= [user1, agent1]task.history= [user1, agent1, user2, agent2]task.history= [user1, agent1, user2, agent2, user3, agent3]Actual Behavior:
task.history= [user1, agent1] ✅task.history= [user2, agent2] ❌ (missing user1, agent1)task.history= [user3, agent3] ❌ (missing all previous)Root Cause:
The
DefaultRequestHandler/ResultManagerbuilds the task history from events published to theExecutionEventBusduring the current execution only. When aRequestContextcontains an existingtaskwith prior history, those historical messages are not republished to the event bus, causing them to be lost in the final response.Workaround:
In the
AgentExecutor.execute()method, manually republish historical messages before processing:Expected Fix:
The SDK should automatically republish historical messages from
requestContext.task.historywhen present, similar to how the Python SDK handles this scenario.Relevant log output
Code of Conduct