(t *testing.T)
| 8150 | } |
| 8151 | |
| 8152 | func TestManagerStartRunExecutionProfile(t *testing.T) { |
| 8153 | t.Parallel() |
| 8154 | |
| 8155 | t.Run( |
| 8156 | "Should pass the persisted execution profile to the session executor", |
| 8157 | func(t *testing.T) { |
| 8158 | t.Parallel() |
| 8159 | |
| 8160 | store := newInMemoryManagerStore() |
| 8161 | executor := &recordingSessionExecutor{ |
| 8162 | startRef: &SessionRef{SessionID: "sess-profiled-worker"}, |
| 8163 | } |
| 8164 | manager := newTaskManagerForTestWithOptions(t, store, WithSessionExecutor(executor)) |
| 8165 | actor := validActorContext() |
| 8166 | |
| 8167 | taskRecord, err := manager.CreateTask(context.Background(), CreateTask{ |
| 8168 | Scope: ScopeGlobal, |
| 8169 | Title: "Profiled start run", |
| 8170 | }, actor) |
| 8171 | if err != nil { |
| 8172 | t.Fatalf("CreateTask() error = %v", err) |
| 8173 | } |
| 8174 | _, err = manager.SetExecutionProfile( |
| 8175 | context.Background(), |
| 8176 | taskRecord.ID, |
| 8177 | &ExecutionProfile{ |
| 8178 | Worker: WorkerProfile{ |
| 8179 | Mode: WorkerModeSelect, |
| 8180 | AgentName: "builder", |
| 8181 | Provider: "codex", |
| 8182 | Model: "gpt-5.4", |
| 8183 | }, |
| 8184 | }, |
| 8185 | actor, |
| 8186 | ) |
| 8187 | if err != nil { |
| 8188 | t.Fatalf("SetExecutionProfile() error = %v", err) |
| 8189 | } |
| 8190 | run, err := manager.EnqueueRun( |
| 8191 | context.Background(), |
| 8192 | EnqueueRun{TaskID: taskRecord.ID}, |
| 8193 | actor, |
| 8194 | ) |
| 8195 | if err != nil { |
| 8196 | t.Fatalf("EnqueueRun() error = %v", err) |
| 8197 | } |
| 8198 | run, err = manager.ClaimRun(context.Background(), run.ID, ClaimRun{}, actor) |
| 8199 | if err != nil { |
| 8200 | t.Fatalf("ClaimRun() error = %v", err) |
| 8201 | } |
| 8202 | |
| 8203 | if _, err := manager.StartRun(context.Background(), run.ID, StartRun{}, actor); err != nil { |
| 8204 | t.Fatalf("StartRun() error = %v", err) |
| 8205 | } |
| 8206 | if got, want := len(executor.startCalls), 1; got != want { |
| 8207 | t.Fatalf("len(startCalls) = %d, want %d", got, want) |
| 8208 | } |
| 8209 | profile := executor.startCalls[0].ExecutionProfile |
nothing calls this directly
no test coverage detected