Skip to content

Commit efe5456

Browse files
davidslaterCopilot
andauthored
Fix container smoke detection fallback (#106)
* Fix container smoke detection fallback * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 2bcd926 commit efe5456

6 files changed

Lines changed: 14 additions & 13 deletions

File tree

.github/workflows/smoke-claude-container.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/smoke-codex-container.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/smoke-copilot-container.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/engine/engine.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ type codexEngine struct {
6767
}
6868

6969
func (e *codexEngine) Analyze(ctx context.Context, prompt string) (string, error) {
70-
return runCLIWithPromptFile(ctx, "codex", prompt, func(promptPath string) []string {
71-
return codexArgs(e.model, promptPath)
72-
}, nil)
70+
return runCLIEnv(ctx, "codex", codexArgs(e.model, ""), prompt, nil)
7371
}
7472

7573
func copilotArgs(promptPath string) []string {
@@ -101,14 +99,15 @@ func claudeArgs(model string) []string {
10199
return append(args, "-")
102100
}
103101

104-
func codexArgs(model, promptPath string) []string {
102+
func codexArgs(model, prompt string) []string {
105103
args := []string{
106104
"exec",
107105
"-c", "web_search=disabled",
108106
"-c", "fetch=disabled",
109107
"--dangerously-bypass-approvals-and-sandbox",
110108
"--skip-git-repo-check",
111-
"--prompt-file", promptPath,
109+
"--",
110+
prompt,
112111
}
113112
if model != "" {
114113
args = append([]string{"-c", "model=" + model}, args...)

pkg/engine/engine_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,30 +95,32 @@ func TestEngineCommandArgs(t *testing.T) {
9595
})
9696

9797
t.Run("codex", func(t *testing.T) {
98-
got := codexArgs("gpt-5-codex", "/tmp/prompt.txt")
98+
got := codexArgs("gpt-5-codex", "detect threats")
9999
want := []string{
100100
"-c", "model=gpt-5-codex",
101101
"exec",
102102
"-c", "web_search=disabled",
103103
"-c", "fetch=disabled",
104104
"--dangerously-bypass-approvals-and-sandbox",
105105
"--skip-git-repo-check",
106-
"--prompt-file", "/tmp/prompt.txt",
106+
"--",
107+
"detect threats",
107108
}
108109
if !reflect.DeepEqual(got, want) {
109110
t.Fatalf("codexArgs() = %#v, want %#v", got, want)
110111
}
111112
})
112113

113114
t.Run("codex default model", func(t *testing.T) {
114-
got := codexArgs("", "/tmp/prompt.txt")
115+
got := codexArgs("", "detect threats")
115116
want := []string{
116117
"exec",
117118
"-c", "web_search=disabled",
118119
"-c", "fetch=disabled",
119120
"--dangerously-bypass-approvals-and-sandbox",
120121
"--skip-git-repo-check",
121-
"--prompt-file", "/tmp/prompt.txt",
122+
"--",
123+
"detect threats",
122124
}
123125
if !reflect.DeepEqual(got, want) {
124126
t.Fatalf("codexArgs() = %#v, want %#v", got, want)

scripts/create-threat-detection-sibling-workflows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def replacement_steps(engine: str, workflow_description: str, awf_config_line: s
119119
env:
120120
{indent(engine_env(engine), 4)}
121121
THREAT_DETECTION_MODEL: ${{{{ vars.GH_AW_MODEL_DETECTION_{engine.upper()} || '' }}}}
122-
THREAT_DETECTION_REFLECT_URL: http://127.0.0.1:8080/reflect
122+
THREAT_DETECTION_REFLECT_URL: http://host.docker.internal:8080/reflect
123123
WORKFLOW_DESCRIPTION: {workflow_description}
124124
WORKFLOW_NAME: ${{{{ github.workflow }}}}
125125
run: |

0 commit comments

Comments
 (0)