MCPcopy Create free account
hub / github.com/github/gh-aw / TestCodexEngineExecutionUsesHarness

Function TestCodexEngineExecutionUsesHarness

pkg/workflow/codex_engine_test.go:1220–1258  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1218}
1219
1220func 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
1260func TestCodexEngineExecutionCustomHarness(t *testing.T) {
1261 engine := NewCodexEngine()

Callers

nothing calls this directly

Calls 4

GetExecutionStepsMethod · 0.95
NewCodexEngineFunction · 0.85
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected