Uh oh!
There was an error while loading. Please reload this page.
fix(account): clear error for password prompts with no TTY - #390
Conversation
Running e.g. `genlayer account export --password <pw>` without --source-password in a non-interactive context (piped stdin, CI, automation) died with `ExitPromptError: User force closed the prompt` — inquirer's message for a force-closed prompt, which reads exactly like the user hit Ctrl-C when in fact a required flag is missing. Guard promptPassword with assertInteractive(): when stdin is not a TTY, throw an actionable error naming the flag(s) that make the command non-interactive (--source-password / --password) instead of letting inquirer force-close. export and import pass contextual hints. confirmPrompt is intentionally left alone (its callers gate on their own --yes/--overwrite flags). Adds non-TTY coverage in baseAction.test.ts; existing prompt tests simulate a TTY (vitest stdin is not one).
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
MuncleUscles
commented
Jul 10, 2026
/run-e2e |
The first cut guarded promptPassword with !process.stdin.isTTY, which was too
blunt: it rejected PIPED stdin outright. But piped stdin is exactly how the e2e
harness (and real automation) supply the keystore password — so `genlayer
deploy` and every keystore-unlock path started failing with 'Maximum password
attempts exceeded' in CI (isTTY is false for a pipe, so the guard threw before
inquirer could read the piped password).
Instead, let inquirer run and catch its ExitPromptError ('User force closed the
prompt') — which only fires on an ACTUAL force-close (no TTY AND no piped
input). Rewrite that into the actionable, flag-naming message. Piped stdin now
reaches inquirer normally; the clear error still appears when there is genuinely
no input.
Verified against a keystore: piped source-password exports OK; empty stdin
yields 'No interactive terminal available for a password prompt. Pass
--source-password ...'. 774/774 unit tests.MuncleUscles
commented
Jul 10, 2026
/run-e2e |
Uh oh!
There was an error while loading. Please reload this page.
What
genlayer account export --password <pw>(without--source-password) — and any password prompt run non-interactively (piped stdin, CI, automation) — died with:That's inquirer's message for a force-closed prompt: it reads exactly like the user hit Ctrl-C, when in fact a required flag is simply missing. Reported from field automation use.
Fix
promptPasswordnow callsassertInteractive()first: when stdin is not a TTY it throws an actionable error naming the flag(s) that make the command non-interactive, instead of letting inquirer force-close.exportandimportpass contextual hints (--source-password/--password).Scope kept tight to the reported password path:
confirmPromptis intentionally untouched (its callers gate on their own--yes/--overwriteflags).Test
tests/libs/baseAction.test.ts: asserts the actionable throw (with and without a flag hint) and that inquirer is never invoked.Depends-On: genlayerlabs/genlayer-consensus#1179