diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index 4737b044a..0e4a5e22f 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -1149,10 +1149,16 @@ func buildRichStatus(task *activeTask, isBackground bool, workspace string) stri sb.WriteByte('/') sb.WriteString(strconv.Itoa(task.MaxIter)) sb.WriteString(")\n") - // Workspace: always emit for fixed height + // Workspace: always emit for fixed height (show project name only) sb.WriteString("\U0001F4C1 ") if workspace != "" { - sb.WriteString(workspace) + project := workspace + if idx := strings.LastIndex(workspace, "/"); idx >= 0 { + project = workspace[idx+1:] + } else if idx := strings.LastIndex(workspace, "\\"); idx >= 0 { + project = workspace[idx+1:] + } + sb.WriteString(project) } sb.WriteByte('\n') sb.WriteString(statusSeparator) diff --git a/pkg/agent/loop_test.go b/pkg/agent/loop_test.go index c5792e48a..6008599f4 100644 --- a/pkg/agent/loop_test.go +++ b/pkg/agent/loop_test.go @@ -1663,9 +1663,9 @@ func TestBuildRichStatus_LatestEntryNoInlineResult(t *testing.T) { if !strings.Contains(got, " \u23F3") { t.Errorf("latest entry result should be on indented line, got:\n%s", got) } - // Full workspace path shown (not just project name) - if !strings.Contains(got, "/ws/my-project") { - t.Errorf("should show full workspace path, got:\n%s", got) + // Project name shown + if !strings.Contains(got, "my-project") { + t.Errorf("should show project name, got:\n%s", got) } // No second separator before error section lines := strings.Split(got, "\n")