Skip to content

Commit 1865aed

Browse files
Kasper Jungeclaude
authored andcommitted
refactor: consolidate state counter updates in _execute_agent for clarity
Move timed_out and failed counter increments from the except block into the if/elif/else chain where all other counter updates live. This puts every state mutation in one visible location, making the outcome logic easier to audit at a glance. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 42c9d30 commit 1865aed

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/ralphify/engine.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,16 @@ def _execute_agent(
290290
sys.stderr.write(result.stderr)
291291
returncode = result.returncode
292292
except subprocess.TimeoutExpired as e:
293-
state.timed_out += 1
294-
state.failed += 1
295293
if log_path_dir:
296294
log_file = _write_log(log_path_dir, iteration, e.stdout, e.stderr)
297295

298296
elapsed = time.monotonic() - start
299297
duration = format_duration(elapsed)
300298

299+
# All state counter updates in one place for easy auditing.
301300
if returncode is None:
301+
state.timed_out += 1
302+
state.failed += 1
302303
event_type = EventType.ITERATION_TIMED_OUT
303304
state_detail = f"timed out after {duration}"
304305
elif returncode == 0:

0 commit comments

Comments
 (0)