From 28db07ae6dcb85af2a6bd95085020d576dcdae85 Mon Sep 17 00:00:00 2001 From: Mason Daugherty <61371264+mdrxy@users.noreply.github.com> Date: Thu, 20 Aug 2026 03:59:46 +0000 Subject: [PATCH] fix(code): hide onboarding cancel hint Co-authored-by: open-swe[bot] --- libs/code/deepagents_code/app.py | 1 + libs/code/deepagents_code/tui/widgets/auth.py | 10 +++++++++- libs/code/tests/unit_tests/test_app.py | 1 + .../unit_tests/tui/widgets/test_auth_widgets.py | 14 ++++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/libs/code/deepagents_code/app.py b/libs/code/deepagents_code/app.py index e8bdaacc252..d52ab9a36f4 100644 --- a/libs/code/deepagents_code/app.py +++ b/libs/code/deepagents_code/app.py @@ -10730,6 +10730,7 @@ async def _prompt_launch_tavily(self) -> None: allow_empty_submit=True, input_placeholder="Tavily API key (optional)", submit_label="Enter save/skip", + show_cancel_hint=False, ) ) if result is not AuthResult.SAVED: diff --git a/libs/code/deepagents_code/tui/widgets/auth.py b/libs/code/deepagents_code/tui/widgets/auth.py index 1b46e35cf64..18dc7257da3 100644 --- a/libs/code/deepagents_code/tui/widgets/auth.py +++ b/libs/code/deepagents_code/tui/widgets/auth.py @@ -633,6 +633,7 @@ def __init__( allow_empty_submit: bool = False, input_placeholder: str | None = None, submit_label: str | None = None, + show_cancel_hint: bool = True, ) -> None: """Initialize the prompt for `provider`. @@ -647,6 +648,7 @@ def __init__( with `AuthResult.CANCELLED` instead of showing a validation error. input_placeholder: Optional placeholder override for the key input. submit_label: Optional help-label override for the Enter action. + show_cancel_hint: Whether the footer advertises the Escape action. """ super().__init__() self._provider = provider @@ -655,6 +657,7 @@ def __init__( self._allow_empty_submit = allow_empty_submit self._input_placeholder = input_placeholder self._submit_label = submit_label + self._show_cancel_hint = show_cancel_hint # LangSmith is configured as a tracing service: it carries an optional # project name and an endpoint chosen from a region selector (US/EU SaaS # or a custom self-hosted URL), and saving a key turns tracing on. @@ -1000,8 +1003,13 @@ def compose(self) -> ComposeResult: save_label = self._submit_label or ( "Enter replace" if self._has_existing else "Enter save" ) + save_help = ( + f"{save_label} {glyphs.bullet} Esc cancel" + if self._show_cancel_hint + else save_label + ) help_parts = [ - f"{save_label} {glyphs.bullet} Esc cancel", + save_help, "F2 advanced", "Ctrl+R reload", ] diff --git a/libs/code/tests/unit_tests/test_app.py b/libs/code/tests/unit_tests/test_app.py index 23b4efa4327..4fd0e5da031 100644 --- a/libs/code/tests/unit_tests/test_app.py +++ b/libs/code/tests/unit_tests/test_app.py @@ -2137,6 +2137,7 @@ def capture_prompt(screen: object) -> AuthResult: assert prompt._allow_empty_submit is True assert prompt._input_placeholder == "Tavily API key (optional)" assert prompt._submit_label == "Enter save/skip" + assert prompt._show_cancel_hint is False assert "Web search is optional" in (prompt._reason or "") apply_credentials.assert_called_once_with() diff --git a/libs/code/tests/unit_tests/tui/widgets/test_auth_widgets.py b/libs/code/tests/unit_tests/tui/widgets/test_auth_widgets.py index c3524be96e9..d4fbb22ae16 100644 --- a/libs/code/tests/unit_tests/tui/widgets/test_auth_widgets.py +++ b/libs/code/tests/unit_tests/tui/widgets/test_auth_widgets.py @@ -82,6 +82,7 @@ def show_prompt( allow_empty_submit: bool = False, input_placeholder: str | None = None, submit_label: str | None = None, + show_cancel_hint: bool = True, ) -> None: """Push the prompt and capture the dismissal result.""" @@ -97,6 +98,7 @@ def handle(result: AuthResult | None) -> None: allow_empty_submit=allow_empty_submit, input_placeholder=input_placeholder, submit_label=submit_label, + show_cancel_hint=show_cancel_hint, ), handle, ) @@ -1155,6 +1157,7 @@ async def test_optional_prompt_customizes_new_user_copy(self) -> None: allow_empty_submit=True, input_placeholder="Tavily API key (optional)", submit_label="Enter save/skip", + show_cancel_hint=False, ) await pilot.pause() @@ -1167,11 +1170,22 @@ async def test_optional_prompt_customizes_new_user_copy(self) -> None: assert key_input.password is True assert "Web search is optional" in copy assert "Enter save/skip" in str(help_text.content) + assert "Esc cancel" not in str(help_text.content) # Services (Tavily) omit the storage note entirely — the title and # reason already explain the key, so it would only be redundant copy. assert has_storage_note is False assert "stores the above key locally" not in copy + async def test_default_prompt_keeps_cancel_hint(self) -> None: + """Regular auth prompts continue to advertise Escape.""" + app = _AuthHostApp() + async with app.run_test() as pilot: + app.show_prompt("openai", "OPENAI_API_KEY") + await pilot.pause() + help_text = app.screen.query_one(".auth-prompt-help", Static) + + assert "Esc cancel" in str(help_text.content) + async def test_optional_prompt_surfaces_save_failure_and_stays_open( self, monkeypatch: pytest.MonkeyPatch ) -> None: