@@ -141,10 +141,10 @@ def test_valid_llm_response_produces_fast_plan_result(self) -> None:
141141 )
142142 mock_response = _make_mock_response (plan )
143143
144- with patch ("swe_af.fast.planner.AgentAI" ) as MockAgentAI :
145- instance = MagicMock ()
146- instance . run = AsyncMock (return_value = mock_response )
147- MockAgentAI . return_value = instance
144+ with patch ("swe_af.fast.planner._note" ), \
145+ patch ( "swe_af.fast.planner.fast_router" ) as mock_router :
146+ mock_router . harness = AsyncMock (return_value = mock_response )
147+ mock_router . note = MagicMock ()
148148
149149 result = _run (fast_plan_tasks (
150150 goal = "Build a REST API" ,
@@ -164,10 +164,10 @@ def test_llm_parsed_none_triggers_fallback(self) -> None:
164164
165165 mock_response = _make_mock_response (None )
166166
167- with patch ("swe_af.fast.planner.AgentAI" ) as MockAgentAI :
168- instance = MagicMock ()
169- instance . run = AsyncMock (return_value = mock_response )
170- MockAgentAI . return_value = instance
167+ with patch ("swe_af.fast.planner._note" ), \
168+ patch ( "swe_af.fast.planner.fast_router" ) as mock_router :
169+ mock_router . harness = AsyncMock (return_value = mock_response )
170+ mock_router . note = MagicMock ()
171171
172172 result = _run (fast_plan_tasks (
173173 goal = "Build something" ,
@@ -184,11 +184,11 @@ def test_llm_parsed_none_triggers_fallback(self) -> None:
184184 def test_llm_exception_triggers_fallback (self ) -> None :
185185 """When AgentAI.run() raises, the fallback plan is returned."""
186186 from swe_af .fast .planner import fast_plan_tasks
187-
188- with patch ("swe_af.fast.planner.AgentAI" ) as MockAgentAI :
189- instance = MagicMock ()
190- instance . run = AsyncMock (side_effect = RuntimeError ("LLM connection error" ))
191- MockAgentAI . return_value = instance
187+
188+ with patch ("swe_af.fast.planner._note" ), \
189+ patch ( "swe_af.fast.planner.fast_router" ) as mock_router :
190+ mock_router . harness = AsyncMock (side_effect = RuntimeError ("LLM connection error" ))
191+ mock_router . note = MagicMock ()
192192
193193 result = _run (fast_plan_tasks (
194194 goal = "Build something" ,
@@ -205,10 +205,10 @@ def test_fallback_contains_at_least_one_task(self) -> None:
205205
206206 mock_response = _make_mock_response (None )
207207
208- with patch ("swe_af.fast.planner.AgentAI" ) as MockAgentAI :
209- instance = MagicMock ()
210- instance . run = AsyncMock (return_value = mock_response )
211- MockAgentAI . return_value = instance
208+ with patch ("swe_af.fast.planner._note" ), \
209+ patch ( "swe_af.fast.planner.fast_router" ) as mock_router :
210+ mock_router . harness = AsyncMock (return_value = mock_response )
211+ mock_router . note = MagicMock ()
212212
213213 result = _run (fast_plan_tasks (goal = "Any goal" , repo_path = "/repo" ))
214214
@@ -229,10 +229,10 @@ def test_max_tasks_one_truncates_result(self) -> None:
229229 plan = FastPlanResult (tasks = many_tasks , rationale = "Many tasks." )
230230 mock_response = _make_mock_response (plan )
231231
232- with patch ("swe_af.fast.planner.AgentAI" ) as MockAgentAI :
233- instance = MagicMock ()
234- instance . run = AsyncMock (return_value = mock_response )
235- MockAgentAI . return_value = instance
232+ with patch ("swe_af.fast.planner._note" ), \
233+ patch ( "swe_af.fast.planner.fast_router" ) as mock_router :
234+ mock_router . harness = AsyncMock (return_value = mock_response )
235+ mock_router . note = MagicMock ()
236236
237237 result = _run (fast_plan_tasks (
238238 goal = "Build a thing" ,
@@ -250,10 +250,10 @@ def test_max_tasks_respected_when_llm_returns_exact_count(self) -> None:
250250 plan = FastPlanResult (tasks = tasks , rationale = "Exactly 3 tasks." )
251251 mock_response = _make_mock_response (plan )
252252
253- with patch ("swe_af.fast.planner.AgentAI" ) as MockAgentAI :
254- instance = MagicMock ()
255- instance . run = AsyncMock (return_value = mock_response )
256- MockAgentAI . return_value = instance
253+ with patch ("swe_af.fast.planner._note" ), \
254+ patch ( "swe_af.fast.planner.fast_router" ) as mock_router :
255+ mock_router . harness = AsyncMock (return_value = mock_response )
256+ mock_router . note = MagicMock ()
257257
258258 result = _run (fast_plan_tasks (
259259 goal = "Build a thing" ,
0 commit comments