Skip to content

Commit 2356bb9

Browse files
misrasaurabh1claude
andcommitted
fix: avoid nested progress bars causing LiveError
The `_process_candidates` method had a progress bar context that called `get_next_candidate()`, which could recursively call `_process_candidates` again. This created nested progress bars, causing Rich's LiveError: "Only one live display may be active at once". Fixed by moving the `get_next_candidate()` call outside the progress bar context manager. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e8989c2 commit 2356bb9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

codeflash/optimization/function_optimizer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,9 @@ def _process_candidates(
369369
logger.info(success_msg.format(len(candidates), self.candidate_len))
370370

371371
callback()
372-
return self.get_next_candidate()
372+
# Call get_next_candidate() OUTSIDE the progress_bar context to avoid
373+
# nested progress bars (Rich only allows one active Live display at a time)
374+
return self.get_next_candidate()
373375

374376
def _filter_refined_candidates(self, candidates: list[OptimizedCandidate]) -> list[OptimizedCandidate]:
375377
"""We generate a weighted ranking based on the runtime and diff lines and select the best of valid optimizations to be tested."""

0 commit comments

Comments
 (0)