harnessForTask returns the adapter for the task's stored harness. NULL/empty harness column → claude+nil (back-compat). Unknown non-empty name → nil+error. Callers that can tolerate the error (e.g. list.go's per-row [live] marker) should skip the operation; callers that can't (cmdTranscript, cmdDo's
(task *flowdb.Task)
| 68 | // callers that can't (cmdTranscript, cmdDo's resume path) should |
| 69 | // surface the error to the user and stop. |
| 70 | func harnessForTask(task *flowdb.Task) (harness.Harness, error) { |
| 71 | if task == nil { |
| 72 | return claude.New(), nil |
| 73 | } |
| 74 | var name string |
| 75 | if task.Harness.Valid { |
| 76 | name = task.Harness.String |
| 77 | } |
| 78 | return harnessByName(name) |
| 79 | } |
| 80 | |
| 81 | // ambientHarness probes the current process env for each known |
| 82 | // harness's session-id env var. Returns the matching adapter if |