From 75a0dc70bc1f5e8ff3708b4e57825f558f760159 Mon Sep 17 00:00:00 2001 From: Felix Martin Date: Thu, 11 Jun 2026 09:08:54 -0400 Subject: [PATCH] test: verify delayed prompt injection Fix pre-existing ty error in action_new_session by typing the sandbox element as SandboxPolicy | None instead of object. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/hqt/tui/app.py | 4 +++- tests/test_tui.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hqt/tui/app.py b/src/hqt/tui/app.py index 5f00532..e19ff82 100644 --- a/src/hqt/tui/app.py +++ b/src/hqt/tui/app.py @@ -12,6 +12,7 @@ from textual.theme import Theme from textual.widgets import Footer from hqt import sandbox +from hqt.sandbox import SandboxPolicy from hqt.config import get_settings from hqt.git import worktree from hqt.db.engine import ensure_db, get_engine, get_session_factory @@ -270,7 +271,8 @@ class HqtApp(App): project_path = project.path def on_dismiss( - result: tuple[str, str, str | None, str | None, object] | None, + result: tuple[str, str, str | None, str | None, SandboxPolicy | None] + | None, ) -> None: if result: harness_name, nickname, model, worktree_branch, sandbox_policy = result diff --git a/tests/test_tui.py b/tests/test_tui.py index 1bf7a65..77b2111 100644 --- a/tests/test_tui.py +++ b/tests/test_tui.py @@ -1782,7 +1782,9 @@ async def test_schedule_prompt_action_calls_service_and_refreshes(): with patch.object(app, "notify", side_effect=capture_notify): app.action_schedule_prompt() await pilot.pause() - app.screen.dismiss(("continue", __import__("datetime").timedelta(minutes=30))) + app.screen.dismiss( + ("continue", __import__("datetime").timedelta(minutes=30)) + ) await pilot.pause() await app.workers.wait_for_complete()