Skip to content

[bug]Restore native Windows interactive prompts#1396

Open
stale2000 wants to merge 1 commit into
entireio:mainfrom
stale2000:stale2000/windows-interactive-prompts
Open

[bug]Restore native Windows interactive prompts#1396
stale2000 wants to merge 1 commit into
entireio:mainfrom
stale2000:stale2000/windows-interactive-prompts

Conversation

@stale2000

@stale2000 stale2000 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Entire Logs: https://entire.io/gh/stale2000/cli/session/019eaad9-6a88-78a0-94c4-0fe99696aefa

Summary

This fixes native Windows interactive prompt detection. The CLI previously treated Windows terminals as non-interactive because interactive.CanPromptInteractively() always tried to open /dev/tty, which only exists on Unix-like systems. login.waitForEnter() and the commit-link prompt path also depended on the same Unix terminal assumption.

Bug and impact

On native Windows, /dev/tty does not exist. That meant CanPromptInteractively() returned false even when a real user was running Entire from an interactive PowerShell, Command Prompt, or Windows Terminal session.

The practical effect is that Windows users could be pushed into non-interactive fallback behavior by mistake. Flows that rely on prompts could skip choices, auto-select defaults, or fail with non-interactive messages instead of asking the user. Affected areas include login browser confirmation, setup/configuration choices, review/fix pickers, and git-hook commit-link confirmations.

How to reproduce

On native Windows before this change:

  1. Run Entire from an interactive terminal such as PowerShell or Windows Terminal.
  2. Trigger any flow guarded by interactive.CanPromptInteractively(), for example a prompt-based setup/configuration path or entire login.
  3. Observe that the CLI behaves as if no promptable terminal is available because the /dev/tty probe fails.

A minimal code-level reproduction is to call interactive.CanPromptInteractively() in a native Windows console without ENTIRE_TEST_TTY=1; it returns false because os.OpenFile("/dev/tty", ...) cannot succeed on Windows.

Fix

The fix centralizes prompt-terminal opening behind interactive.OpenPromptTTY():

  • Unix keeps the existing /dev/tty behavior.
  • Windows uses documented console devices: CONIN$ for input and CONOUT$ for output.
  • Other platforms get an unsupported-terminal error and remain non-interactive.
  • CanPromptInteractively(), login.waitForEnter(), and askConfirmTTY() now use the shared helper instead of hardcoding /dev/tty.

This keeps the existing CI, agent subprocess, and test guards intact while making native Windows terminals prompt-capable again.

Verification

  • mise run lint
  • go test ./cmd/entire/cli/interactive
  • go test ./cmd/entire/cli/strategy
  • go test ./cmd/entire/cli -run 'Test.*Login|TestRunLogin|TestWaitForEnter'\n- GOOS=windows GOARCH=amd64 go test -c ./cmd/entire/cli/interactive -o /tmp/entire-interactive-windows.test.exe\n- GOOS=windows GOARCH=amd64 go test -c ./cmd/entire/cli/strategy -o /tmp/entire-strategy-windows.test.exe\n- GOOS=windows GOARCH=amd64 go test -c ./cmd/entire/cli -o /tmp/entire-cli-windows.test.exe\n\n## Not tested\n\n- Manual interaction in a native Windows terminal.\n- mise run check currently fails on an unrelated date-sensitive TestRunAuthStatus_RendersSessionsTable expectation (2026-01-01 expected, 2026-01-31 rendered).\n

Windows does not expose the Unix /dev/tty device, so the shared interactive gate was treating native Windows terminals as non-interactive. Move prompt terminal opening behind small platform-specific helpers and route login plus commit-link prompts through that helper.

Constraint: Keep existing Unix /dev/tty behavior and CI/agent/test non-interactive guards intact.

Constraint: Windows console input and output use documented CONIN$ and CONOUT$ devices.

Rejected: Use a runtime.GOOS branch inside CanPromptInteractively | would leave prompt readers able to drift back to hardcoded terminal paths.

Rejected: Use bare CON for Windows | less explicit than the documented input/output console devices.

Confidence: medium

Scope-risk: narrow

Reversibility: clean

Directive: Keep prompt detection and prompt I/O on the shared OpenPromptTTY helper so platform behavior stays consistent.

Tested: mise run lint

Tested: go test ./cmd/entire/cli/interactive

Tested: go test ./cmd/entire/cli/strategy

Tested: go test ./cmd/entire/cli -run 'Test.*Login|TestRunLogin|TestWaitForEnter'

Tested: GOOS=windows GOARCH=amd64 go test -c ./cmd/entire/cli/interactive ./cmd/entire/cli/strategy ./cmd/entire/cli via separate output binaries

Not-tested: Native Windows terminal manual interaction.

Not-tested: mise run check fails in existing TestRunAuthStatus_RendersSessionsTable date expectation (expected 2026-01-01; rendered 2026-01-31).
Entire-Checkpoint: e9454c377138
@stale2000 stale2000 requested a review from a team as a code owner June 9, 2026 05:57
@stale2000 stale2000 changed the title Restore native Windows interactive prompts [bug]Restore native Windows interactive prompts Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant