Skip to content

Commit 238e00f

Browse files
committed
os._exit on all run_main paths with correct exit code
1 parent 1550484 commit 238e00f

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/seclab_taskflow_agent/runner.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -773,10 +773,8 @@ async def _deploy(ra: dict, pp: str) -> bool:
773773
session.mark_finished()
774774
await render_model_output(f"** 🤖✅ Session {session.session_id} completed\n")
775775

776-
# Force-exit after successful completion only: asyncio.run() cleanup
777-
# spins on dangling tasks/connections from the responses API path.
778-
# Failure paths (must_complete break, personality mode) use normal exit.
779-
if taskflow_path and session is not None and session.finished:
780-
sys.stdout.flush()
781-
sys.stderr.flush()
782-
os._exit(0)
776+
# Force-exit to prevent asyncio event loop spin on dangling
777+
# tasks/connections from the responses API path. Flush first.
778+
sys.stdout.flush()
779+
sys.stderr.flush()
780+
os._exit(0 if (session is None or session.finished) else 1)

0 commit comments

Comments
 (0)