Skip to content

Commit af263c3

Browse files
committed
move os._exit into run_main to fire before asyncio cleanup spins
1 parent 461116b commit af263c3

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/seclab_taskflow_agent/cli.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ def main(
160160
),
161161
debug=debug,
162162
)
163-
# Force-exit on success to prevent asyncio event loop spin on
164-
# dangling connections/tasks that survive cleanup.
165-
os._exit(0)
166163
except KeyboardInterrupt:
167164
typer.echo("\nInterrupted.", err=True)
168165
raise typer.Exit(code=130)

src/seclab_taskflow_agent/runner.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,3 +771,8 @@ async def _deploy(ra: dict, pp: str) -> bool:
771771
if session is not None and not session.error:
772772
session.mark_finished()
773773
await render_model_output(f"** 🤖✅ Session {session.session_id} completed\n")
774+
775+
# Force-exit: asyncio.run() cleanup spins on dangling tasks/connections
776+
# from the responses API path. Exit here before the event loop hangs.
777+
import os
778+
os._exit(0)

0 commit comments

Comments
 (0)