Skip to content

feat: unified management stop event - #6

Open
tomerqodo wants to merge 3 commits into
cursor_only-issues-20260113-cursor_completion_base_feat_unified_management_stop_event_pr171from
cursor_only-issues-20260113-cursor_completion_head_feat_unified_management_stop_event_pr171
Open

feat: unified management stop event#6
tomerqodo wants to merge 3 commits into
cursor_only-issues-20260113-cursor_completion_base_feat_unified_management_stop_event_pr171from
cursor_only-issues-20260113-cursor_completion_head_feat_unified_management_stop_event_pr171

Conversation

@tomerqodo

@tomerqodo tomerqodo commented Jan 20, 2026

Copy link
Copy Markdown

Benchmark PR from qodo-benchmark#171


Note

Centralizes execution stop control via a shared threading.Event managed by GraphEngine, improving coordinated shutdown and cancellation.

  • Engine/runtime: Create shared stop_event in GraphEngine; clear on start and set on stop; attach to GraphRuntimeState and pass to subsystems
  • Dispatcher: Use shared stop_event (remove internal one); reduce join timeout to 2s
  • WorkerPool/Worker: Pass shared stop_event to Worker; make Worker.stop() a no-op; pool stops by joining workers (2s) without per-worker stop signaling
  • Nodes: Add _should_stop() in base Node and check between yields; emit NodeRunFailedEvent with "Execution cancelled" on stop
  • Runtime state: Add stop_event field to GraphRuntimeState
  • Tests: New test_stop_event.py and updates to dispatcher tests validating propagation, resume behavior, and shorter timeouts

Written by Cursor Bugbot for commit ef61c4b. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

worker_id=worker_id,
flask_app=self._flask_app,
context_vars=self._context_vars,
stop_event=self._stop_event,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worker scale-down fails because stop() is now no-op

Medium Severity

The _remove_worker method calls worker.stop() expecting it to stop an individual worker during scale-down operations. However, Worker.stop() is now a no-op that does nothing since workers now rely on a shared stop_event from GraphEngine. This means _try_scale_down will fail to actually stop workers — the join(timeout=2.0) will always timeout and the worker thread continues running in the background, defeating dynamic scaling and causing resource waste.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

2 participants