# refactor(e2e/copilot): extract startup-dialog detection into helper

`2e2ff13`→[main](/content/gh/entireio/cli/commits/main/index.html)·

Soph·1mo ago·1 file·+10 added/-1 removed

Pull the inline "is this the prompt or a startup dialog?" check in
StartSession out into a named isStartupDialog() helper. Pure refactor,
no behavior change — this isolates the dialog-detection logic so the
follow-up fix has a single place to harden.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

## Sessions

94ef96b560e5View transcript

[?\
Fix Copilot CLI e2e Trust Dialog DetectionClaude Code·Opus 4.8[1m]·2 steps](/content/gh/entireio/cli/session/e53a047c-f1cc-4923-af20-67f45011c1fa#timeline-94ef96b560e5/index.html)

## Changes

1

- e2e/agents

- Mcopilot-cli.go+10/-1

```
285 unmodified lines

286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
30 unmodified lines

331
332
333
325
334
335
336
337

285 unmodified lines

\treturn false
// isStartupDialog reports whether the captured pane is showing a Copilot
// startup dialog (e.g. "Confirm folder trust") rather than the interactive
// prompt. The dialog renders its selected option with the same "❯" cursor as
// the input prompt, so presence of "❯" alone cannot distinguish them — we must
// key off the dialog chrome.
func isStartupDialog(content string) bool {
\treturn strings.Contains(content, "Enter to select")
}

func (c *CopilotCLI) StartSession(ctx context.Context, dir string) (Session, error) {
\tbin, err := exec.LookPath(c.Binary())
\tif err != nil {
30 unmodified lines

\t\t_ = s.Close()
\t\treturn nil, fmt.Errorf("waiting for startup prompt: %w", err)
\t}
\tif strings.Contains(content, "❯") && !strings.Contains(content, "Enter to select") {
\tif strings.Contains(content, "❯") && !isStartupDialog(content) {
\t\tfoundPrompt = true
\t\tbreak
\t}
```

Me2e/agents/copilot-cli.go+10/-1
