test: more t1.9 minor edits (gcli_adapter patches, comments)

Drop the remaining _update_gcli_adapter monkeypatches from
test_ai_loop_regressions_20260614 (3 sites), test_live_gui_integration_v2
(2 sites), and the gemini_cli_adapter comment references in
tests/test_ai_client_tool_loop_send_func.py, test_lazymodule_filedialog_fallback.py,
and mock_concurrent_mma.py.
This commit is contained in:
ed
2026-07-05 20:00:20 -04:00
parent edebeac619
commit 9401d3f67d
5 changed files with 12 additions and 17 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ def main() -> None:
prompt = "" prompt = ""
# Detect the session we're "resuming" via --resume arg (set by the # Detect the session we're "resuming" via --resume arg (set by the
# gemini_cli_adapter on subsequent calls). # mock on subsequent calls).
session_id = "" session_id = ""
argv = sys.argv[1:] argv = sys.argv[1:]
if "--resume" in argv: if "--resume" in argv:
@@ -77,7 +77,7 @@ def main() -> None:
# CHECK BEFORE epic so worker takes priority over the catch-all epic branch. # CHECK BEFORE epic so worker takes priority over the catch-all epic branch.
if 'You are assigned to Ticket' in prompt: if 'You are assigned to Ticket' in prompt:
# NOTE: Removed session_id.startswith("mock-worker-") fallback. The session_id # NOTE: Removed session_id.startswith("mock-worker-") fallback. The session_id
# persists across tests in the same session (gemini_cli_adapter is a singleton). # persists across tests in the same session (mock provider is stateful).
# The fallback caused test_mma_concurrent_tracks_stress_sim to fail when it ran # The fallback caused test_mma_concurrent_tracks_stress_sim to fail when it ran
# AFTER test_mma_concurrent_tracks_execution: the execution test set the session_id # AFTER test_mma_concurrent_tracks_execution: the execution test set the session_id
# to mock-worker-ticket-A-1, and the stress test's epic call used --resume with that # to mock-worker-ticket-A-1, and the stress test's epic call used --resume with that
+1 -1
View File
@@ -1,5 +1,5 @@
"""Verify run_with_tool_loop supports a custom send_func for vendors """Verify run_with_tool_loop supports a custom send_func for vendors
that don't use send_openai_compatible (gemini_cli, gemini, anthropic, that don't use send_openai_compatible (gemini, anthropic,
deepseek). The vendor provides a send_func that returns a deepseek). The vendor provides a send_func that returns a
NormalizedResponse, and the helper handles history + dispatch. NormalizedResponse, and the helper handles history + dispatch.
""" """
+6 -9
View File
@@ -63,12 +63,9 @@ def test_fr1_error_becomes_discussion_entry(mock_app: App, monkeypatch: pytest.M
monkeypatch.setattr(ai_client, "set_model_params", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "set_model_params", lambda *a, **kw: None)
monkeypatch.setattr(ai_client, "set_agent_tools", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "set_agent_tools", lambda *a, **kw: None)
monkeypatch.setattr(ai_client, "set_current_tier", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "set_current_tier", lambda *a, **kw: None)
monkeypatch.setattr(ai_client, "get_combined_system_prompt", lambda *a, **kw: "")
monkeypatch.setattr(ai_client, "get_current_tier_result", lambda *a, **kw: Result(data=None)) monkeypatch.setattr(ai_client, "get_current_tier_result", lambda *a, **kw: Result(data=None))
monkeypatch.setattr("src.app_controller.AppController._update_gcli_adapter", lambda *a, **kw: None)
_drain_queue(app) _drain_queue(app)
app.controller._handle_request_event(_make_event()) </new_content>
events = _drain_queue(app)
response_events = [p for n, p in events if n == "response"] response_events = [p for n, p in events if n == "response"]
assert response_events, "No 'response' event was queued for the error case" assert response_events, "No 'response' event was queued for the error case"
payload = response_events[-1] payload = response_events[-1]
@@ -94,11 +91,11 @@ def test_fr1_success_still_works(mock_app: App, monkeypatch: pytest.MonkeyPatch)
monkeypatch.setattr(ai_client, "set_current_tier", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "set_current_tier", lambda *a, **kw: None)
monkeypatch.setattr(ai_client, "get_combined_system_prompt", lambda *a, **kw: "") monkeypatch.setattr(ai_client, "get_combined_system_prompt", lambda *a, **kw: "")
monkeypatch.setattr(ai_client, "get_current_tier_result", lambda *a, **kw: Result(data=None)) monkeypatch.setattr(ai_client, "get_current_tier_result", lambda *a, **kw: Result(data=None))
monkeypatch.setattr("src.app_controller.AppController._update_gcli_adapter", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "get_current_tier_result", lambda *a, **kw: Result(data=None))
_drain_queue(app) _drain_queue(app)
app.controller._handle_request_event(_make_event()) app.controller._handle_request_event(_make_event())
events = _drain_queue(app) events = _drain_queue(app)
response_events = [p for n, p in events if n == "response"] </new_content>
assert response_events, "No 'response' event was queued for the success case" assert response_events, "No 'response' event was queued for the success case"
payload = response_events[-1] payload = response_events[-1]
assert payload["status"] == "done", f"Expected status='done', got {payload.get('status')!r}" assert payload["status"] == "done", f"Expected status='done', got {payload.get('status')!r}"
@@ -119,13 +116,13 @@ def test_fr1_ai_status_updated(mock_app: App, monkeypatch: pytest.MonkeyPatch) -
monkeypatch.setattr(ai_client, "set_project_context_marker", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "set_project_context_marker", lambda *a, **kw: None)
monkeypatch.setattr(ai_client, "set_model_params", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "set_model_params", lambda *a, **kw: None)
monkeypatch.setattr(ai_client, "set_agent_tools", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "set_agent_tools", lambda *a, **kw: None)
monkeypatch.setattr(ai_client, "set_current_tier", lambda *a, **kw: None)
monkeypatch.setattr(ai_client, "get_combined_system_prompt", lambda *a, **kw: "")
monkeypatch.setattr(ai_client, "get_current_tier_result", lambda *a, **kw: Result(data=None)) monkeypatch.setattr(ai_client, "get_current_tier_result", lambda *a, **kw: Result(data=None))
monkeypatch.setattr("src.app_controller.AppController._update_gcli_adapter", lambda *a, **kw: None)
_drain_queue(app) _drain_queue(app)
app.controller._handle_request_event(_make_event()) app.controller._handle_request_event(_make_event())
status = app.controller.ai_status status = app.controller.ai_status
</new_content>
app.controller._handle_request_event(_make_event())
status = app.controller.ai_status
assert status.startswith("error:"), f"Expected ai_status to start with 'error:', got {status!r}" assert status.startswith("error:"), f"Expected ai_status to start with 'error:', got {status!r}"
assert "slow down" in status, f"Expected error message in status, got {status!r}" assert "slow down" in status, f"Expected error message in status, got {status!r}"
+1 -1
View File
@@ -7,7 +7,7 @@ the `tkinter.filedialog` sub-module fails to load. The original `_LazyModule`
in src/gui_2.py used `getattr(tkinter, 'filedialog')` which raises a in src/gui_2.py used `getattr(tkinter, 'filedialog')` which raises a
confusing AttributeError at the call site. With 14 call sites in confusing AttributeError at the call site. With 14 call sites in
render_projects_panel, render_workspace_settings_hub, render_fonts_panel, render_projects_panel, render_workspace_settings_hub, render_fonts_panel,
and render_gemini_cli_settings, this AttributeError spammed the GUI's this AttributeError spammed the GUI's
stderr at 60fps whenever the Project Settings window was open. stderr at 60fps whenever the Project Settings window was open.
The fix must make `_LazyModule` fall back to a stub that mimics The fix must make `_LazyModule` fall back to a stub that mimics
+2 -4
View File
@@ -29,8 +29,7 @@ def test_user_request_integration_flow(mock_app: App) -> None:
patch('src.ai_client.send', return_value=Result(data=mock_response)) as mock_send, patch('src.ai_client.send', return_value=Result(data=mock_response)) as mock_send,
patch('src.ai_client.set_custom_system_prompt'), patch('src.ai_client.set_custom_system_prompt'),
patch('src.ai_client.set_model_params'), patch('src.ai_client.set_model_params'),
patch('src.ai_client.set_agent_tools'), patch('src.ai_client.set_agent_tools')
patch('src.app_controller.AppController._update_gcli_adapter')
): ):
# 1. Create and push a UserRequestEvent # 1. Create and push a UserRequestEvent
event = UserRequestEvent( event = UserRequestEvent(
@@ -88,8 +87,7 @@ def test_user_request_error_handling(mock_app: App) -> None:
patch('src.ai_client.send', return_value=Result(data="", errors=[err])), patch('src.ai_client.send', return_value=Result(data="", errors=[err])),
patch('src.ai_client.set_custom_system_prompt'), patch('src.ai_client.set_custom_system_prompt'),
patch('src.ai_client.set_model_params'), patch('src.ai_client.set_model_params'),
patch('src.ai_client.set_agent_tools'), patch('src.ai_client.set_agent_tools')
patch('src.app_controller.AppController._update_gcli_adapter')
): ):
event = UserRequestEvent( event = UserRequestEvent(
prompt="Trigger Error", prompt="Trigger Error",