From 1280a4c7ccf45c01996025e91830d8218b0bb9e2 Mon Sep 17 00:00:00 2001 From: Akanksha Trehun Date: Mon, 31 Aug 2026 13:35:50 +0530 Subject: [PATCH] Return an error instead of log.Fatalf in storage CLI adapter log.Fatalf calls os.Exit(1) directly, which kills the whole harness process on a single trial's nerdctl failure instead of letting the orchestrator record the trial as failed and move on. CLIStartTask already returns (StageResult, error) as part of its signature, so no caller changes were needed: the fatal call is replaced with returning the underlying error wrapped with fmt.Errorf, including the captured stdout/stderr for debuggability, consistent with the JSON-parse error returned a few lines below it in the same function. Updates #10 Signed-off-by: Akanksha Trehun --- internal/runtime/storage/cli_adaptor.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/runtime/storage/cli_adaptor.go b/internal/runtime/storage/cli_adaptor.go index a8f7fcc..2b96f9a 100644 --- a/internal/runtime/storage/cli_adaptor.go +++ b/internal/runtime/storage/cli_adaptor.go @@ -50,7 +50,12 @@ func (a *Adapter) CLIStartTask(tc harnessruntime.TrialContext) (harnessruntime.S log.Printf("Running nerdctl command: %s\n", cmdNerdctl.String()) if err := cmdNerdctl.Run(); err != nil { - log.Fatalf("failed to start task with nerdctl: %v", err) + return harnessruntime.StageResult{}, fmt.Errorf( + "start task with nerdctl: %w\nstdout: %s\nstderr: %s", + err, + stdout.String(), + stderr.String(), + ) } finishedAt := time.Now()