harnessForSpawn returns the harness to use when bootstrapping a new session for a task: 1. If the task already has a harness set, look it up by name — unknown names error out so we don't silently spawn the wrong adapter for a pinned task. 2. Otherwise, detect ambient — the harness running THIS `flo
(task *flowdb.Task)
| 112 | // with the session_id write (guarded by a COALESCE clause so an |
| 113 | // existing pin isn't overwritten), so step 1 dominates on every |
| 114 | // subsequent invocation. |
| 115 | func harnessForSpawn(task *flowdb.Task) (harness.Harness, error) { |
| 116 | if task != nil && task.Harness.Valid && task.Harness.String != "" { |
| 117 | return harnessByName(task.Harness.String) |
| 118 | } |
| 119 | if h := ambientHarness(); h != nil { |
| 120 | return h, nil |
| 121 | } |
| 122 | return claude.New(), nil |
| 123 | } |
| 124 | |
| 125 | // defaultHarness returns the adapter for code paths that have no |