From 2608ddc6be582bdeccb8f508a7fc06d1a732061a Mon Sep 17 00:00:00 2001 From: Anton Bogdanovich <27antonb@gmail.com> Date: Tue, 5 May 2026 22:22:03 -0700 Subject: [PATCH] fix(agents): show workspace-relative feedback paths --- pkg/utils/tool_feedback.go | 23 ++++++++++++++++++++++- pkg/utils/tool_feedback_test.go | 13 +++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/pkg/utils/tool_feedback.go b/pkg/utils/tool_feedback.go index c2597fb91..2b84058f3 100644 --- a/pkg/utils/tool_feedback.go +++ b/pkg/utils/tool_feedback.go @@ -108,7 +108,7 @@ func summarizeToolFeedbackArgs(toolName, argsPreview string) string { } if isFileToolFeedbackTool(normalizedToolName) { if summary := firstStringArg(args, "path", "file_path", "filepath"); summary != "" { - return truncateToolFeedbackSummary(filepath.Base(summary)) + return truncateToolFeedbackSummary(summarizeFilePath(summary)) } } return "" @@ -139,6 +139,27 @@ func normalizeToolFeedbackSummary(text string) string { return redactToolFeedbackSecrets(strings.Join(strings.Fields(text), " ")) } +func summarizeFilePath(path string) string { + path = strings.TrimSpace(path) + if path == "" { + return "" + } + + cleaned := filepath.Clean(path) + slashed := filepath.ToSlash(cleaned) + if idx := strings.LastIndex(slashed, "/workspace/"); idx >= 0 { + relative := strings.TrimPrefix(slashed[idx+len("/workspace/"):], "/") + if relative != "" && relative != "." { + return relative + } + } + + if !filepath.IsAbs(cleaned) { + return slashed + } + return filepath.Base(cleaned) +} + func truncateToolFeedbackSummary(text string) string { const maxRunes = 96 runes := []rune(text) diff --git a/pkg/utils/tool_feedback_test.go b/pkg/utils/tool_feedback_test.go index b6881a2a0..a0c51ff7d 100644 --- a/pkg/utils/tool_feedback_test.go +++ b/pkg/utils/tool_feedback_test.go @@ -67,6 +67,19 @@ func TestFormatToolFeedbackMessageWithStyle_WorkingSummaryShowsFileBasenameOnly( } } +func TestFormatToolFeedbackMessageWithStyle_WorkingSummaryShowsWorkspaceRelativeFile(t *testing.T) { + got := FormatToolFeedbackMessageWithStyle( + "working_summary", + "read_file", + "", + "{\"path\":\"/home/server/.picoclaw/spouse/workspace/memory/MEMORY.md\"}", + ) + want := "Working...\n• tool: `read_file` — `memory/MEMORY.md`" + if got != want { + t.Fatalf("FormatToolFeedbackMessageWithStyle() = %q, want %q", got, want) + } +} + func TestFormatToolFeedbackMessageWithStyle_WorkingSummaryShowsExecCommand(t *testing.T) { got := FormatToolFeedbackMessageWithStyle( "working_summary",