fix: normalize command paths to base names in shellparse (#25599)

Normalize program names in shellparse.Parse to their basename.

Does not rely on filepath.Base because the server may run on either
Linux or Windows where the behavior would differ.

Closes CODAGT-470
This commit is contained in:
Mathias Fredriksson
2026-05-22 13:36:53 +03:00
committed by GitHub
parent 5d40bac79f
commit 0ba702c43f
8 changed files with 187 additions and 159 deletions
+3 -2
View File
@@ -259,8 +259,9 @@ type ChatMessagePart struct {
// ParsedCommands holds parsed programs from an execute tool call's
// shell command, one entry per simple command in source order. Each
// entry is [program] or [program, arg] where arg is the first non-flag
// positional argument. Only populated when ToolName is "execute" and
// the command parses successfully; nil otherwise.
// positional argument. Program names are normalized to their base
// name (e.g. /usr/bin/go becomes go). Only populated when ToolName
// is "execute" and the command parses successfully; nil otherwise.
ParsedCommands [][]string `json:"parsed_commands,omitempty" variants:"tool-call?"`
Result json.RawMessage `json:"result,omitempty" variants:"tool-result?"`
ResultDelta string `json:"result_delta,omitempty" variants:"tool-result?"`