Conversation
rbx
commented
Mar 25, 2026
- Pipe individual session output to log file.
- Add interactive mode with option to terminate individual sessions.
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughReplaced the basic parallel execution loop with a task orchestration framework that introduces per-run log file capture, optional interactive curses TUI for monitoring and terminating runs, and a fallback plain-text progress display mode. Added CLI flag Changes
Sequence DiagramsequenceDiagram
actor User
participant CLI
participant Orchestrator
participant TUI/Logger
participant Subprocess
User->>CLI: Invoke with --no-tui flag (optional)
CLI->>Orchestrator: Call run_all_parallel(no_tui=True/False)
alt isatty() and not no_tui
Orchestrator->>TUI/Logger: Initialize curses TUI mode
Note over TUI/Logger: Display queued/running/completed runs
User->>TUI/Logger: Request termination by index
else
Orchestrator->>TUI/Logger: Initialize plain progress mode
end
loop For each run
TUI/Logger->>Subprocess: Launch with log file capture
Subprocess->>Subprocess: Execute task, stream to disk
Subprocess-->>TUI/Logger: Exit with status
TUI/Logger->>TUI/Logger: Update elapsed time & state
TUI/Logger->>User: Display progress (TUI or plain)
end
TUI/Logger-->>User: Final summary
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@train_iter.py`:
- Around line 175-209: The loop in _run_plain (and the other runner) can leave
child processes and open log_fh handles running if launch() raises or the loop
is exited via an exception; wrap the main scheduling loop in a try/finally (or
add a top-level finally) that iterates over active and for each (proc, label,
log_fh, t0) ensures log_fh.close() and terminates or kills the proc
(proc.terminate(); if still alive after a timeout, proc.kill()), waiting for
proc.wait() to avoid zombies; also guard the launch(combo, seed) call with
try/except to perform the same cleanup for already-started entries before
re-raising the exception so no child processes or file handles are leaked.
- Around line 298-309: The code blocks in the key handler remove the tuple from
active then call proc.wait() synchronously, which freezes the TUI; instead,
after proc.terminate() spawn a short-lived background worker (e.g.,
threading.Thread with daemon=True) that does proc.wait(), closes fh, increments
failure_count and appends to done_log so the main loop is non-blocking. Locate
the key handler logic that manipulates active, proc, fh, failure_count and
done_log and replace the direct
proc.wait()/fh.close()/failure_count++/done_log.append calls with a threaded
reaper function (or schedule the cleanup on the main loop using proc.poll()) to
reap and finalize the process asynchronously.
- Around line 324-333: The final TUI always blocks on stdscr.getch(), which
prevents the CLI from returning to the shell; change the logic in the end-of-run
block around _draw_tui/stddscr.nodelay and summary so it does not
unconditionally call stdscr.getch(): either remove the blocking getch and let
the function return, or make the wait conditional on an interactive terminal
(e.g. check sys.stdin.isatty() / os.isatty(0)) and only call getch (or use
stdscr.timeout with a short non-blocking wait) when interactive; update the code
paths that reference _draw_tui, stdscr.nodelay(False), and stdscr.getch
accordingly.
- Around line 156-166: The proc-log paths and filenames are deterministic and
get clobbered when sessions are reused or labels repeat; update make_log_dir to
create a unique subdirectory (e.g., append high-precision timestamp or a uuid4
nonce to the session folder) and change label_to_filename to append a short
unique suffix (timestamp microseconds or uuid) to each filename so repeated
labels don't overwrite; also audit any code that opens logs (the code around
make_log_dir and the other log-creation block referenced later) to keep using
the unique directory/filename and consider opening files with exclusive/create
semantics rather than plain "w".