diff --git a/test/test_slack_gateway_run.py b/test/test_slack_gateway_run.py index bbc583f5fd0..57c534443f6 100644 --- a/test/test_slack_gateway_run.py +++ b/test/test_slack_gateway_run.py @@ -173,10 +173,11 @@ async def test_run_raises_on_shutdown(self): new_callable=AsyncMock, ): with patch("os._exit"): - with patch("resource.getrlimit", return_value=(256, 10240)): - with patch("resource.setrlimit"): - # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass - await orch.run() + with patch( + "kiro_crew.platform_compat.raise_nofile_soft_limit" + ): + # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass + await orch.run() finally: kiro_crew.shutdown_event.clear() @@ -249,10 +250,11 @@ def recording_clear_marker(port): new_callable=AsyncMock, ): with patch("os._exit"): - with patch("resource.getrlimit", return_value=(256, 10240)): - with patch("resource.setrlimit"): - # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass - await orch.run() + with patch( + "kiro_crew.platform_compat.raise_nofile_soft_limit" + ): + # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass + await orch.run() finally: kiro_crew.shutdown_event.clear() @@ -353,10 +355,11 @@ def recording_clear_late(port): new_callable=AsyncMock, ): with patch("os._exit"): - with patch("resource.getrlimit", return_value=(256, 10240)): - with patch("resource.setrlimit"): - # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass - await orch.run() + with patch( + "kiro_crew.platform_compat.raise_nofile_soft_limit" + ): + # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass + await orch.run() finally: kiro_crew.shutdown_event.clear() # Release AND drain the stalled writer inside this finally: if an @@ -444,10 +447,11 @@ def failing_write_marker(port): new_callable=AsyncMock, ): with patch("os._exit"): - with patch("resource.getrlimit", return_value=(256, 10240)): - with patch("resource.setrlimit"): - # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass - await orch.run() + with patch( + "kiro_crew.platform_compat.raise_nofile_soft_limit" + ): + # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass + await orch.run() finally: kiro_crew.shutdown_event.clear() @@ -505,8 +509,7 @@ async def _run_and_record_freezes(orch, monkeypatch) -> list[tuple[int, int, boo patch("kiro_crew.session.cleanup_orphaned_sessions"), patch("kiro_crew.dashboard.handlers._bg_mcp_probe", new_callable=AsyncMock), patch("os._exit"), - patch("resource.getrlimit", return_value=(256, 10240)), - patch("resource.setrlimit"), + patch("kiro_crew.platform_compat.raise_nofile_soft_limit"), ): # flake-ok: run() returns because the shutdown event is set before it starts await orch.run() @@ -957,11 +960,10 @@ async def test_run_with_ollama_config(self): ): with patch("os._exit"): with patch( - "resource.getrlimit", return_value=(256, 10240) + "kiro_crew.platform_compat.raise_nofile_soft_limit" ): - with patch("resource.setrlimit"): - # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass - await orch.run() + # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass + await orch.run() finally: pass @@ -1037,17 +1039,15 @@ async def _init_dash(): ): with patch("os._exit"): with patch( - "resource.getrlimit", - return_value=(256, 10240), + "kiro_crew.platform_compat.raise_nofile_soft_limit" ): - with patch("resource.setrlimit"): - # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass - await orch.run() - # Let bg_session task drain - # flake-ok: pre-existing pair of event-loop yields before the URL check, moved verbatim; tracked for a de-flake pass - await asyncio.sleep(0) - # flake-ok: pre-existing event-loop yield, the second of the pair, moved verbatim; tracked for a de-flake pass - await asyncio.sleep(0) + # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass + await orch.run() + # Let bg_session task drain + # flake-ok: pre-existing pair of event-loop yields before the URL check, moved verbatim; tracked for a de-flake pass + await asyncio.sleep(0) + # flake-ok: pre-existing event-loop yield, the second of the pair, moved verbatim; tracked for a de-flake pass + await asyncio.sleep(0) orch.sessions.start_pool.assert_awaited_once_with(blocking=False) @@ -1131,16 +1131,14 @@ async def _tracing_probe(_sessions=None): ): with patch("os._exit"): with patch( - "resource.getrlimit", - return_value=(256, 10240), + "kiro_crew.platform_compat.raise_nofile_soft_limit" ): - with patch("resource.setrlimit"): - # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass - await orch.run() - # flake-ok: pre-existing pair of event-loop yields before the URL check, moved verbatim; tracked for a de-flake pass - await asyncio.sleep(0) - # flake-ok: pre-existing event-loop yield, the second of the pair, moved verbatim; tracked for a de-flake pass - await asyncio.sleep(0) + # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass + await orch.run() + # flake-ok: pre-existing pair of event-loop yields before the URL check, moved verbatim; tracked for a de-flake pass + await asyncio.sleep(0) + # flake-ok: pre-existing event-loop yield, the second of the pair, moved verbatim; tracked for a de-flake pass + await asyncio.sleep(0) assert "url" in trace, f"dashboard URL was never printed; trace={trace}" assert "probe" in trace, f"MCP probe was never awaited; trace={trace}" @@ -1205,17 +1203,15 @@ async def _init_dash(): ): with patch("os._exit"): with patch( - "resource.getrlimit", - return_value=(256, 10240), + "kiro_crew.platform_compat.raise_nofile_soft_limit" ): - with patch("resource.setrlimit"): - # Must not raise. - # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass - await orch.run() - # flake-ok: pre-existing pair of event-loop yields before the boot check, moved verbatim; tracked for a de-flake pass - await asyncio.sleep(0) - # flake-ok: pre-existing event-loop yield, the second of the pair, moved verbatim; tracked for a de-flake pass - await asyncio.sleep(0) + # Must not raise. + # flake-ok: pre-existing unbounded run that the pre-set shutdown event ends, moved verbatim; tracked for a de-flake pass + await orch.run() + # flake-ok: pre-existing pair of event-loop yields before the boot check, moved verbatim; tracked for a de-flake pass + await asyncio.sleep(0) + # flake-ok: pre-existing event-loop yield, the second of the pair, moved verbatim; tracked for a de-flake pass + await asyncio.sleep(0) # Boot carried on past the failed announcement. orch.sessions.start_pool.assert_awaited_once_with(blocking=False) diff --git a/test/windows-expected-failures.txt b/test/windows-expected-failures.txt index 20700ae667b..2c473c02ec0 100644 --- a/test/windows-expected-failures.txt +++ b/test/windows-expected-failures.txt @@ -140,16 +140,6 @@ test/test_session_pid_sig.py::TestNoNofollowPlatform::test_regular_file_still_re test/test_session_pid_sig.py::TestNoNofollowPlatform::test_symlink_present_at_lstat_refused test/test_slack_config_handlers.py::test_write_env_updates_adds_and_preserves test/test_slack_config_handlers.py::test_write_env_updates_is_atomic_and_owner_only -test/test_slack_gateway_run.py::TestBgSessionDashboardBranch::test_bg_session_prints_dashboard_url -test/test_slack_gateway_run.py::TestBgSessionDashboardBranch::test_dashboard_url_is_printed_before_the_mcp_probe_is_awaited -test/test_slack_gateway_run.py::TestBgSessionDashboardBranch::test_failing_url_announcement_does_not_abort_boot -test/test_slack_gateway_run.py::TestRunFreezesBootHeap::test_api_only_boot_freezes_once_after_the_api_server_binds -test/test_slack_gateway_run.py::TestRunFreezesBootHeap::test_dashboard_boot_freezes_once_after_the_dashboard_binds -test/test_slack_gateway_run.py::TestRunMethod::test_run_failed_marker_write_still_clears -test/test_slack_gateway_run.py::TestRunMethod::test_run_no_dashboard_uses_api_server -test/test_slack_gateway_run.py::TestRunMethod::test_run_raises_on_shutdown -test/test_slack_gateway_run.py::TestRunMethod::test_run_stalled_marker_write_does_not_block_shutdown -test/test_slack_gateway_run.py::TestRunSignalAndBgSession::test_run_with_ollama_config test/test_subagent_cwd.py::TestValidateCwd::test_tilde_expanded_in_allowed_roots test/test_subagent_cwd.py::TestValidateCwd::test_tilde_expanded_in_cwd test/test_subagent_sizing.py::TestMacosMemoryProbe::test_computes_available_gb_from_pages