Skip to content

Commit c5ce11d

Browse files
Kasper JungeRalphify
authored andcommitted
refactor: inline reason alias in run_loop stop-event emit
The `reason = state.status.reason` local was read exactly once on the next line as the `reason=` kwarg to `RunStoppedData(...)`. Collapsing to `reason=state.status.reason` matches the inline-alias pattern from ce487d3 (`text`) / 52e0272 (`msg`) / 497c028 (`agent`) / fc5e1cb (`total_in`). The property access is safe at this call site: the immediately-preceding `if state.status == RunStatus.RUNNING: state.status = RunStatus.COMPLETED` ensures `state.status` is always a terminal status (STOPPED / COMPLETED / FAILED), so `RunStatus.reason` cannot raise. Co-authored-by: Ralphify <noreply@ralphify.co>
1 parent bc13035 commit c5ce11d

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/ralphify/engine.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,10 @@ def run_loop(
369369
if state.status == RunStatus.RUNNING:
370370
state.status = RunStatus.COMPLETED
371371

372-
reason = state.status.reason
373372
emit(
374373
EventType.RUN_STOPPED,
375374
RunStoppedData(
376-
reason=reason,
375+
reason=state.status.reason,
377376
total=state.total,
378377
completed=state.completed,
379378
failed=state.failed,

0 commit comments

Comments
 (0)