fix: AutoGen 'No next batch available' when next batch is ready#659
fix: AutoGen 'No next batch available' when next batch is ready#659
Conversation
navigate_to_next_batch relied on a stale total_batches Gradio state to decide whether a next batch exists. The background generator updates total_batches *after* navigate_to_next_batch runs in the .then() chain, so the guard check blocked valid navigation. Changes: - batch_navigation.py: derive total_batches from batch_queue length (mirrors navigate_to_previous_batch which already did this). - batch_management.py: fix early-return path in generate_next_batch_background to update total_batches when the next batch was already completed. - batch_navigation_test.py: add 3 focused unit tests.
📝 WalkthroughWalkthroughThe changes introduce defensive updates to batch management and navigation functions to handle stale Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
acestep/ui/gradio/events/results/batch_navigation_test.py (1)
28-36: Consider renamingkwto_kwor**_to signal intentional discard.The
**kwin the lambda is necessary to accept keyword arguments (e.g.,n=new_idx + 1) passed tot(), but since it's unused in the return value, prefixing with_makes the intent clearer and silences the linter.♻️ Suggested fix
-@patch("acestep.ui.gradio.events.results.batch_navigation.t", side_effect=lambda key, **kw: key) +@patch("acestep.ui.gradio.events.results.batch_navigation.t", side_effect=lambda key, **_kw: key)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@acestep/ui/gradio/events/results/batch_navigation_test.py` around lines 28 - 36, Rename the unused lambda keyword-args parameter in the patch on t() to indicate intentional discard: change the side_effect lambda in the `@patch` on "acestep.ui.gradio.events.results.batch_navigation.t" from "lambda key, **kw: key" to use a prefixed/underscore parameter like "lambda key, **_kw: key" (or "**_:") so the intent is clear to readers and linters; keep the rest of NavigateToNextBatchTests and its helper _run_first_yield unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@acestep/ui/gradio/events/results/batch_navigation_test.py`:
- Around line 28-36: Rename the unused lambda keyword-args parameter in the
patch on t() to indicate intentional discard: change the side_effect lambda in
the `@patch` on "acestep.ui.gradio.events.results.batch_navigation.t" from "lambda
key, **kw: key" to use a prefixed/underscore parameter like "lambda key, **_kw:
key" (or "**_:") so the intent is clear to readers and linters; keep the rest of
NavigateToNextBatchTests and its helper _run_first_yield unchanged.
navigate_to_next_batch relied on a stale total_batches Gradio state to decide whether a next batch exists. The background generator updates total_batches after navigate_to_next_batch runs in the .then() chain, so the guard check blocked valid navigation.
Changes:
Summary by CodeRabbit
Bug Fixes
Tests