Skip to content

Don't keep probing after Adaptive Reasoning swallows cancel - #35

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-5a1e
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-5a1e

Conversation

@cursor

@cursor cursor Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

Cancelling a --reason / Adaptive Reasoning scan after Phase 2 sensors did not stop the engine. Phase 3, investigation planning, multi-host dispatch, and later engine stages (reachability, fusion, AI) kept running probes on a job the operator had already cancelled.

Trigger: GUI Adaptive Reasoning Loop or Phase Test with do_reason=true, then Cancel during or right after Phase 2. JobCancelled from an emit in Phase 3 was caught by fail-soft except Exception handlers, logged as "Phase 3 cycle failed — continuing with Phase 2 results", and the scan continued.

Distinct from #27 (local_agent overwriting cancel with completed after the engine returns). This is the engine itself ignoring cancel mid-scan.

Root cause

ReconDirector._run_step already re-raises JobCancelled (see test_director_reraises_job_cancelled). Later director handlers around Phase 3, planning, multi-host, cognitive layer, and several run_scan fail-soft blocks did not. src.cancel.is_job_cancelled matches on the exception type name so cooperative cancel can cross the API/engine boundary.

Fix

Call reraise_if_cancelled at the start of those fail-soft except Exception handlers so cancel unwinds to local_agent / json_bridge as intended. Non-cancel failures still log and continue.

Validation

  • New tests in test_reasoning_loop.py for Phase 3, planning, and multi-host.
  • python3 -m pytest test_reasoning_loop.py test_probers.py::test_director_reraises_job_cancelled -q — 15 passed
  • python3 -m pytest test_*.py -q — 1755 passed, 5 skipped
Open in Web View Automation 

Director Phase 3, investigation planning, multi-host, and the cognitive
layer wrapped later work in except Exception, so a cancel after Phase 2
was logged and the scan kept probing. Re-raise JobCancelled first,
matching _run_step.

Co-authored-by: dmitryflynn <dmitryflynn@users.noreply.github.com>
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