diff --git a/cmd/launch/command_test.go b/cmd/launch/command_test.go index da168438b..6b2ba101c 100644 --- a/cmd/launch/command_test.go +++ b/cmd/launch/command_test.go @@ -443,18 +443,14 @@ func TestLaunchCmdHeadlessWithoutYes_ReturnsActionableConfirmError(t *testing.T) cmd := LaunchCmd(func(cmd *cobra.Command, args []string) error { return nil }, func(cmd *cobra.Command) {}) cmd.SetArgs([]string{"stubeditor", "--model", "llama3.2"}) - err := cmd.Execute() - if err == nil { - t.Fatal("expected launch command to fail without --yes in headless mode") + if err := cmd.Execute(); err != nil { + t.Fatalf("expected launch command to succeed without --yes, got %v", err) } - if !strings.Contains(err.Error(), "re-run with --yes") { - t.Fatalf("expected actionable --yes guidance, got %v", err) + if diff := cmp.Diff([][]string{{"llama3.2"}}, stub.edited); diff != "" { + t.Fatalf("editor models mismatch (-want +got):\n%s", diff) } - if len(stub.edited) != 0 { - t.Fatalf("expected no editor writes when confirmation is blocked, got %v", stub.edited) - } - if stub.ranModel != "" { - t.Fatalf("expected launch to abort before run, got %q", stub.ranModel) + if stub.ranModel != "llama3.2" { + t.Fatalf("expected launch to run with llama3.2, got %q", stub.ranModel) } } diff --git a/cmd/launch/launch_test.go b/cmd/launch/launch_test.go index a9bd53c7b..9659856b2 100644 --- a/cmd/launch/launch_test.go +++ b/cmd/launch/launch_test.go @@ -617,12 +617,9 @@ func TestLaunchIntegration_EditorForceConfigure(t *testing.T) { return []string{"llama3.2", "qwen3:8b"}, nil } - var proceedPrompt bool DefaultConfirmPrompt = func(prompt string, options ConfirmOptions) (bool, error) { - if prompt == "Proceed?" { - proceedPrompt = true - } - return true, nil + t.Fatalf("unexpected confirmation prompt: %q", prompt) + return false, nil } srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -650,9 +647,6 @@ func TestLaunchIntegration_EditorForceConfigure(t *testing.T) { if !multiCalled { t.Fatal("expected multi selector to be used for forced editor configure") } - if !proceedPrompt { - t.Fatal("expected backup warning confirmation before edit") - } if diff := compareStringSlices(editor.edited, [][]string{{"llama3.2", "qwen3:8b"}}); diff != "" { t.Fatalf("unexpected edited models (-want +got):\n%s", diff) } @@ -1444,8 +1438,8 @@ func TestLaunchIntegration_ConfigureOnlyDoesNotRequireInstalledBinary(t *testing if editor.ranModel != "" { t.Fatalf("expected configure-only flow to skip launch, got %q", editor.ranModel) } - if !slices.Contains(prompts, "Proceed?") { - t.Fatalf("expected editor warning prompt, got %v", prompts) + if slices.Contains(prompts, "Proceed?") { + t.Fatalf("expected editor write to skip Proceed prompt, got %v", prompts) } if !slices.Contains(prompts, "Launch LauncherEditor now?") { t.Fatalf("expected configure-only launch prompt, got %v", prompts) diff --git a/cmd/launch/models.go b/cmd/launch/models.go index 7c45ddfe0..a84d08154 100644 --- a/cmd/launch/models.go +++ b/cmd/launch/models.go @@ -256,7 +256,7 @@ func confirmEditorEdit(runner Runner, editor Editor) (bool, error) { } fmt.Fprintf(os.Stderr, "Backups will be saved to %s/\n\n", fileutil.BackupDir()) - return ConfirmPrompt("Proceed?") + return true, nil } // buildModelList merges existing models with recommendations for selection UIs. diff --git a/cmd/launch/selector_hooks.go b/cmd/launch/selector_hooks.go index 0f55aadea..d1e7efc71 100644 --- a/cmd/launch/selector_hooks.go +++ b/cmd/launch/selector_hooks.go @@ -66,8 +66,8 @@ func withLaunchConfirmPolicy(policy launchConfirmPolicy) func() { } } -// ConfirmPrompt is the shared confirmation gate for launch flows (integration -// edits, missing-model pulls, sign-in prompts, OpenClaw install/security, etc). +// ConfirmPrompt is the shared confirmation gate for launch flows (missing-model +// pulls, sign-in prompts, OpenClaw install/security, etc). // Behavior is controlled by currentLaunchConfirmPolicy, typically scoped by // withLaunchConfirmPolicy in LaunchCmd (e.g. auto-approve with --yes). func ConfirmPrompt(prompt string) (bool, error) {