Skip to content

refactor: Remove stop_requested and run_id from ThreadInfo; update ex…#15

Merged
Iamsdt merged 1 commit intomainfrom
thread_stop
Sep 23, 2025
Merged

refactor: Remove stop_requested and run_id from ThreadInfo; update ex…#15
Iamsdt merged 1 commit intomainfrom
thread_stop

Conversation

@Iamsdt
Copy link
Copy Markdown
Collaborator

@Iamsdt Iamsdt commented Sep 23, 2025

…ecution state handling for stop requests
This pull request refactors the way stop requests are handled during graph execution, shifting from a metadata-based approach to a state-driven mechanism. The main changes remove the use of stop_requested and run_id fields from thread metadata, and instead rely on the execution state for stop signaling. This improves reliability and ensures stop requests are consistently detected across the system. The logic for checking stop requests has been centralized and streamlined, and legacy node name normalization has been updated for backward compatibility.

Stop Request Handling Improvements

  • Replaced the check for stop requests via thread metadata (stop_requested and run_id) with a direct check on the execution state (is_stopped_requested()), ensuring stop signals are reliably picked up from the state itself. [1] [2] [3] [4]
  • Introduced new _check_stop_requested methods in both invoke_handler.py and stream_handler.py that reload the current state and check for stop requests, replacing the previous is_stop_requested utility and related logic. [1] [2] [3] [4] [5] [6] [7] [8]

State Reload and Utility Refactoring

  • Refactored the is_stop_requested utility into reload_state, which now reloads the latest execution state from the checkpointer, supporting more robust and up-to-date state checks. [1] [2] [3]

Legacy Node Name Normalization

  • Updated node normalization logic to handle legacy values (__start__/__end__) instead of (start/end), improving backward compatibility with older persisted states. [1] [2]

Graph Execution Logic

  • Ensured stop requests are checked both before and after node execution steps, and during streaming, to allow for immediate interruption of graph execution when a stop is requested. [1] [2] [3] [4] [5]

Type and Import Updates

  • Updated imports and type usage to support the new stop request mechanism and state reload functionality.

Let me know if you want to walk through any of these changes in detail!

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 23, 2025

@Iamsdt Iamsdt merged commit 9525743 into main Sep 23, 2025
1 of 2 checks passed
@Iamsdt Iamsdt deleted the thread_stop branch September 23, 2025 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant