From 0ff30457a0d9603db86d232c32c01961e45e0b4f Mon Sep 17 00:00:00 2001 From: _Yusaki Date: Fri, 13 Mar 2026 20:23:59 +0700 Subject: [PATCH] Add debug logging and 5min timeout per round to prevent hangs --- backend/scripts/run_reddit_simulation.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/backend/scripts/run_reddit_simulation.py b/backend/scripts/run_reddit_simulation.py index 4d0b0ba..854eeb0 100644 --- a/backend/scripts/run_reddit_simulation.py +++ b/backend/scripts/run_reddit_simulation.py @@ -639,9 +639,18 @@ class RedditSimulationRunner: agent: LLMAction() for _, agent in active_agents } - - await self.env.step(actions) - + + print(f" Round {round_num+1}: stepping with {len(actions)} agents...", flush=True) + try: + await asyncio.wait_for(self.env.step(actions), timeout=300) + except asyncio.TimeoutError: + print(f" Round {round_num+1}: TIMEOUT after 300s, skipping", flush=True) + continue + except Exception as e: + print(f" Round {round_num+1}: ERROR {type(e).__name__}: {e}", flush=True) + continue + print(f" Round {round_num+1}: step complete", flush=True) + if (round_num + 1) % 10 == 0 or round_num == 0: elapsed = (datetime.now() - start_time).total_seconds() progress = (round_num + 1) / total_rounds * 100