This is an automated email from the ASF dual-hosted git repository.
choo121600 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 3155c298554 Fix auto-triage user_confirm accepting unrecognized keys
as default answer (#63579)
3155c298554 is described below
commit 3155c298554fbca935af9ee6daaa0bd4605b8e43
Author: Yeonguk Choo <[email protected]>
AuthorDate: Mon Mar 16 18:45:51 2026 +0900
Fix auto-triage user_confirm accepting unrecognized keys as default answer
(#63579)
---
dev/breeze/src/airflow_breeze/utils/confirm.py | 57 +++++++++++++-------------
1 file changed, 28 insertions(+), 29 deletions(-)
diff --git a/dev/breeze/src/airflow_breeze/utils/confirm.py
b/dev/breeze/src/airflow_breeze/utils/confirm.py
index d6370ce57e8..0bd712b9d2a 100644
--- a/dev/breeze/src/airflow_breeze/utils/confirm.py
+++ b/dev/breeze/src/airflow_breeze/utils/confirm.py
@@ -88,38 +88,37 @@ def user_confirm(
allowed_answers = allowed_answers.replace(default_answer.value,
default_answer.value.upper())
prompt = f"\n{message} \nPress {allowed_answers}: "
- console_print(prompt, end="")
- try:
- ch = _read_char()
- except (KeyboardInterrupt, EOFError):
- console_print()
- if quit_allowed:
- return Answer.QUIT
- sys.exit(1)
+ while True:
+ console_print(prompt, end="")
- # Ignore multi-byte escape sequences (arrow keys, etc.)
- if len(ch) > 1:
- console_print()
- if default_answer:
+ try:
+ ch = _read_char()
+ except (KeyboardInterrupt, EOFError):
+ console_print()
+ if quit_allowed:
+ return Answer.QUIT
+ sys.exit(1)
+
+ # Ignore multi-byte escape sequences (arrow keys, etc.)
+ if len(ch) > 1:
+ console_print()
+ console_print(f" [warning]Invalid key. Press one of:
{allowed_answers}[/]")
+ continue
+
+ console_print(ch)
+
+ if ch.upper() == "Y":
+ return Answer.YES
+ if ch.upper() == "N":
+ return Answer.NO
+ if ch.upper() == "Q" and quit_allowed:
+ return Answer.QUIT
+ # Enter/Return selects the default
+ if ch in ("\r", "\n", "") and default_answer:
return default_answer
- return Answer.NO
-
- console_print(ch)
-
- if ch.upper() == "Y":
- return Answer.YES
- if ch.upper() == "N":
- return Answer.NO
- if ch.upper() == "Q" and quit_allowed:
- return Answer.QUIT
- # Enter/Return selects the default
- if ch in ("\r", "\n", "") and default_answer:
- return default_answer
- # Any other key — treat as default if available
- if default_answer:
- return default_answer
- return Answer.NO
+
+ console_print(f" [warning]Invalid key. Press one of:
{allowed_answers}[/]")
def confirm_action(