(t *testing.T)
| 1218 | } |
| 1219 | |
| 1220 | func TestCodexEngineExecutionUsesHarness(t *testing.T) { |
| 1221 | engine := NewCodexEngine() |
| 1222 | |
| 1223 | workflowData := &WorkflowData{ |
| 1224 | Name: "test-workflow", |
| 1225 | } |
| 1226 | steps := engine.GetExecutionSteps(workflowData, "test-log") |
| 1227 | if len(steps) != 1 { |
| 1228 | t.Fatalf("Expected 1 step for Codex execution, got %d", len(steps)) |
| 1229 | } |
| 1230 | |
| 1231 | stepContent := strings.Join([]string(steps[0]), "\n") |
| 1232 | |
| 1233 | // Default execution should use the codex_harness.cjs |
| 1234 | if !strings.Contains(stepContent, "codex_harness.cjs") { |
| 1235 | t.Errorf("Expected codex_harness.cjs in execution step, got:\n%s", stepContent) |
| 1236 | } |
| 1237 | |
| 1238 | // Harness should appear before the prompt file argument |
| 1239 | harnessIdx := strings.Index(stepContent, "codex_harness.cjs") |
| 1240 | promptFileIdx := strings.Index(stepContent, "--prompt-file") |
| 1241 | if harnessIdx == -1 { |
| 1242 | t.Fatal("Could not find codex_harness.cjs in step") |
| 1243 | } |
| 1244 | if promptFileIdx == -1 { |
| 1245 | t.Fatal("Could not find --prompt-file in step") |
| 1246 | } |
| 1247 | if harnessIdx > promptFileIdx { |
| 1248 | t.Error("Expected codex_harness.cjs to appear before --prompt-file") |
| 1249 | } |
| 1250 | |
| 1251 | // Should use --prompt-file instead of $INSTRUCTION when harness is active |
| 1252 | if !strings.Contains(stepContent, "--prompt-file") { |
| 1253 | t.Errorf("Expected --prompt-file in harness-wrapped execution step, got:\n%s", stepContent) |
| 1254 | } |
| 1255 | if strings.Contains(stepContent, "\"$INSTRUCTION\"") { |
| 1256 | t.Errorf("Expected no $INSTRUCTION variable when harness is active, got:\n%s", stepContent) |
| 1257 | } |
| 1258 | } |
| 1259 | |
| 1260 | func TestCodexEngineExecutionCustomHarness(t *testing.T) { |
| 1261 | engine := NewCodexEngine() |
nothing calls this directly
no test coverage detected