Repository navigation
Don't keep probing after Adaptive Reasoning swallows cancel - #35
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.JobCancelledfrom an emit in Phase 3 was caught by fail-softexcept Exceptionhandlers, logged as "Phase 3 cycle failed — continuing with Phase 2 results", and the scan continued.Distinct from #27 (local_agent overwriting cancel with
completedafter the engine returns). This is the engine itself ignoring cancel mid-scan.Root cause
ReconDirector._run_stepalready re-raisesJobCancelled(seetest_director_reraises_job_cancelled). Later director handlers around Phase 3, planning, multi-host, cognitive layer, and severalrun_scanfail-soft blocks did not.src.cancel.is_job_cancelledmatches on the exception type name so cooperative cancel can cross the API/engine boundary.Fix
Call
reraise_if_cancelledat the start of those fail-softexcept Exceptionhandlers so cancel unwinds tolocal_agent/json_bridgeas intended. Non-cancel failures still log and continue.Validation
test_reasoning_loop.pyfor Phase 3, planning, and multi-host.python3 -m pytest test_reasoning_loop.py test_probers.py::test_director_reraises_job_cancelled -q— 15 passedpython3 -m pytest test_*.py -q— 1755 passed, 5 skipped