fix: extract tool arguments from ToolExecutionStartEvent in sidecar

The CopilotTurnExecutionState was ignoring ToolExecutionStartData.Arguments
when creating tool-calling activity events, despite the Copilot SDK providing
them. This caused the activity panel to show 'Viewed a file' / 'Used rg'
with no contextual details (file paths, search patterns, etc.).

The fix adds NormalizeRawToolArguments to WorkflowRequestInfoInterpreter for
converting the raw object? payload (typically JsonElement) into the normalized
dictionary, then passes ToolExecutionStartData.Arguments through
CreateToolCallingActivity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-04-08 10:47:55 +02:00
co-authored by Copilot
parent 931ec27f42
commit 2c165e453f
6 changed files with 73 additions and 3 deletions
@@ -98,7 +98,8 @@ internal sealed class CopilotTurnExecutionState
string toolName = toolExecutionStart.Data.ToolName.Trim();
ToolNamesByCallId[toolCallId] = toolName;
ActiveAgent = agent;
AgentActivityEventDto? toolActivity = CreateToolCallingActivity(agent, toolName, toolCallId);
AgentActivityEventDto? toolActivity = CreateToolCallingActivity(
agent, toolName, toolCallId, toolExecutionStart.Data.Arguments);
if (toolActivity is not null)
{
_pendingEvents.Enqueue(toolActivity);
@@ -295,7 +296,8 @@ internal sealed class CopilotTurnExecutionState
private AgentActivityEventDto? CreateToolCallingActivity(
AgentIdentity agent,
string toolName,
string toolCallId)
string toolCallId,
object? rawArguments = null)
{
if (toolName.StartsWith("handoff_to_", StringComparison.Ordinal))
{
@@ -312,6 +314,7 @@ internal sealed class CopilotTurnExecutionState
AgentName = agent.AgentName,
ToolName = toolName,
ToolCallId = toolCallId,
ToolArguments = WorkflowRequestInfoInterpreter.NormalizeRawToolArguments(rawArguments),
};
}