Skip to content

fix: Skip GitHub prompt in non-interactive shells (#40)#41

Merged
rdwj merged 1 commit into
mainfrom
fix/40-non-tty-github-prompt
May 5, 2026
Merged

fix: Skip GitHub prompt in non-interactive shells (#40)#41
rdwj merged 1 commit into
mainfrom
fix/40-non-tty-github-prompt

Conversation

@rdwj
Copy link
Copy Markdown
Collaborator

@rdwj rdwj commented May 5, 2026

Summary

  • _determine_github_mode now checks sys.stdin.isatty() before calling click.confirm; non-TTY shells (CI, agent-driven, claude-code, piped input) fall back to local mode with a one-line hint about --github / --yes instead of hanging on the prompt
  • Wraps the confirm call in try/except click.exceptions.Abort as defense in depth for environments where isatty() returns true but stdin closes mid-prompt
  • Six Unexpected error: {e} sites now use {e!r} so a future swallowed empty-message exception (like the original click.Abort) surfaces its type instead of going blank
  • Adds TestDetermineGithubMode (8 cases) covering flag short-circuits, gh-missing/unauthenticated paths, --yes, the new non-TTY fallback, and aborted-confirm fallback

The fix lives in the shared helper, so all six create subcommands (mcp-server, agent, gateway, ui, workflow, sandbox) get the new behavior. Closes #40.

Test plan

  • pytest --no-cov — 273 passed (8 new)
  • black --check src tests — clean
  • ruff check src tests — clean
  • Manual repro: echo "" | fips-agents create gateway test-gateway --target-dir … no longer hangs; logs Mode: Local only (non-interactive shell — pass --github or --yes …) and proceeds to scaffold the project. Same verified for create ui.

`fips-agents create gateway` and `create ui` (and the other four create
subcommands, which share the same helper) hung on the
`Create GitHub repository?` prompt when stdin wasn't a TTY, then exited
with an empty `Unexpected error:` because click.confirm raised Abort and
the catch-all swallowed its empty message.

`_determine_github_mode` now checks `sys.stdin.isatty()` before
prompting and falls back to local mode with a one-line hint pointing to
`--github`/`--yes`. As defense in depth the confirm call is wrapped in
`try/except click.exceptions.Abort` for environments where isatty lies.
The six `Unexpected error: {e}` sites switch to `{e!r}` so future
empty-message exceptions surface their type instead of going blank.

Assisted-by: Claude Code (Opus 4.7)
@rdwj rdwj merged commit 70979c5 into main May 5, 2026
4 checks passed
@rdwj rdwj deleted the fix/40-non-tty-github-prompt branch May 5, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fips-agents create gateway/ui hangs on interactive GitHub-repo prompt without --local

1 participant