mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(batch_runner): mark discarded no-reasoning prompts as completed (#9950)
Cherry-picked from PR #10005 by @houziershi. Discarded prompts (has_any_reasoning=False) were skipped by `continue` before being added to completed_in_batch. On --resume they were retried forever. Now they are added to completed_in_batch before the continue. - Added AUTHOR_MAP entry for @houziershi Closes #9950
This commit is contained in:
parent
7242afaa5f
commit
6cdab70320
3 changed files with 32 additions and 1 deletions
|
|
@ -12,7 +12,7 @@ import pytest
|
|||
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
|
||||
|
|
@ -157,3 +157,32 @@ class TestResumePreservesProgress:
|
|||
|
||||
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() == ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue