Skip to content
Open
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
6 changes: 5 additions & 1 deletion agent/turn_finalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ def finalize_turn(
# We route through ``_record_task_failure(outcome="timed_out")``
# rather than ``kanban_block`` so this counts toward the dispatcher's
# consecutive-failure circuit breaker (#29747 gap 2).
# Hold the claim (release_claim=False) so the dispatcher cannot
# spawn a second worker into the same worktree while this process
# is still alive — the goal loop will continue with a fresh
# iteration budget until goal_max_turns is exhausted (#71175).
_kanban_task = os.environ.get("HERMES_KANBAN_TASK")
if _kanban_task:
try:
Expand All @@ -167,7 +171,7 @@ def finalize_turn(
"iterations"
),
outcome="timed_out",
release_claim=True,
release_claim=False,
end_run=True,
event_payload_extra={
"budget_used": api_call_count,
Expand Down
2 changes: 1 addition & 1 deletion tests/agent/test_turn_finalizer_iteration_limit_exit.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def test_pending_response_records_kanban_timeout(monkeypatch):
"within the allowed iterations"
),
outcome="timed_out",
release_claim=True,
release_claim=False,
end_run=True,
event_payload_extra={"budget_used": 60, "budget_max": 60},
)
Expand Down
2 changes: 1 addition & 1 deletion tests/run_agent/test_run_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5994,7 +5994,7 @@ def test_kanban_block_called_on_iteration_exhaustion(self, agent, monkeypatch):
# Positional: (conn, task_id, ...)
assert call.args[1] == "t_test_task_123"
assert call.kwargs.get("outcome") == "timed_out"
assert call.kwargs.get("release_claim") is True
assert call.kwargs.get("release_claim") is False
assert call.kwargs.get("end_run") is True
assert "Iteration budget exhausted" in call.kwargs.get("error", "")

Expand Down
Loading