From cc15611ceb84db754b96832cd4ab8b56ec09cf66 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 12:52:10 +0000 Subject: [PATCH 1/2] Initial plan From ae0bf38051031aa9369969d6a344db28663bca3e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 13:05:29 +0000 Subject: [PATCH 2/2] fix: add .downloaded-artifacts/all marker in view_command_test.go to avoid network calls Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/cli/view_command_test.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/pkg/cli/view_command_test.go b/pkg/cli/view_command_test.go index 50c8d68382d..9676a8fb0ac 100644 --- a/pkg/cli/view_command_test.go +++ b/pkg/cli/view_command_test.go @@ -121,9 +121,13 @@ func buildViewRunDir(t *testing.T) string { t.Fatalf("WriteFile events.jsonl: %v", err) } - // Mark the directory as already downloaded so downloadRunArtifacts skips - // network calls (it returns early when the dir is non-empty and has no cached - // summary — it just skips the download and lets the caller process what's there). + // Write the complete-download marker so downloadRunArtifacts skips network + // calls (it requires the ".downloaded-artifacts/all" marker to be present + // before it will use the cached directory contents). + if err := markArtifactDownloaded(runDir, string(ArtifactSetAll)); err != nil { + t.Fatalf("markArtifactDownloaded: %v", err) + } + return dir } @@ -272,17 +276,17 @@ func TestViewWorkflowRun_WithSafeOutputs_ShowsSection(t *testing.T) { } func TestViewWorkflowRun_EmptyDir_WarnsAndReturnsNil(t *testing.T) { - // A run dir that is non-empty (so downloadRunArtifacts skips the network call) - // but contains no JSONL files → no events → warning, no error. + // A run dir that has the complete-download marker but contains no JSONL files + // → no events → warning, no error. logsDir := t.TempDir() runDir := filepath.Join(logsDir, "run-1111") if err := os.MkdirAll(runDir, 0755); err != nil { t.Fatalf("MkdirAll: %v", err) } - // Place a dummy file so the directory is not empty; downloadRunArtifacts will - // skip the download when the dir is non-empty (no valid cached summary). - if err := os.WriteFile(filepath.Join(runDir, "placeholder.txt"), []byte("x"), 0600); err != nil { - t.Fatalf("WriteFile placeholder: %v", err) + // Write the complete-download marker so downloadRunArtifacts skips network + // calls; the run dir has no JSONL files so the timeline will be empty. + if err := markArtifactDownloaded(runDir, string(ArtifactSetAll)); err != nil { + t.Fatalf("markArtifactDownloaded: %v", err) } opts := ViewOptions{