Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions batch_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ def _process_batch_worker(args: Tuple) -> Dict[str, Any]:
if not reasoning.get("has_any_reasoning", True):
print(f" 🚫 Prompt {prompt_index} discarded (no reasoning in any turn)")
discarded_no_reasoning += 1
completed_in_batch.append(prompt_index)
continue

# Get and normalize tool stats for consistent schema across all entries
Expand Down
31 changes: 30 additions & 1 deletion tests/test_batch_runner_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import sys
sys.path.insert(0, str(Path(__file__).parent.parent))

from batch_runner import BatchRunner
from batch_runner import BatchRunner, _process_batch_worker


@pytest.fixture
Expand Down Expand Up @@ -157,3 +157,32 @@ def test_different_run_name_starts_fresh(self, runner):

assert checkpoint_data["completed_prompts"] == []
assert checkpoint_data["run_name"] == "test_run"


class TestBatchWorkerResumeBehavior:
def test_discarded_no_reasoning_prompts_are_marked_completed(self, tmp_path, monkeypatch):
batch_file = tmp_path / "batch_1.jsonl"
prompt_result = {
"success": True,
"trajectory": [{"role": "assistant", "content": "x"}],
"reasoning_stats": {"has_any_reasoning": False},
"tool_stats": {},
"metadata": {},
"completed": True,
"api_calls": 1,
"toolsets_used": [],
}

monkeypatch.setattr("batch_runner._process_single_prompt", lambda *args, **kwargs: prompt_result)

result = _process_batch_worker((
1,
[(0, {"prompt": "hi"})],
tmp_path,
set(),
{"verbose": False},
))

assert result["discarded_no_reasoning"] == 1
assert result["completed_prompts"] == [0]
assert not batch_file.exists() or batch_file.read_text() == ""