Skip to content

Commit bc48cce

Browse files
drandyhaasclaude
andcommitted
Claude tab: cancelled steps show [stopped] not [ok] + accurate Stop tooltip (#364)
A step cancelled mid-run by Stop was still marked '[ok]' when its tab went idle -- the poll loop couldn't tell 'finished' from 'aborted and discarded'. Completion now checks _stop_requested: a cancellable tab's step is marked with the new 'stopped' status ('[stopped] ' in the plan list, stays checked for a re-run, not counted as completed); a non-cancellable tab (fanout) genuinely ran to completion and keeps '[ok]'. The Stop button tooltip now describes the real behavior (cancels the running step, discards its partial results, skips the rest) instead of 'stop after the current step finishes'. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UKFKAEkBFgwTKh1E4oJkaQ
1 parent 2d566c9 commit bc48cce

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

kicad_routing_plugin/claude_gui.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,10 @@ def _create_ui(self):
525525
ctrl_sizer.Add(self.run_all_plan_btn, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, 5)
526526

527527
self.stop_plan_btn = wx.Button(self, label="Stop")
528-
self.stop_plan_btn.SetToolTip("Stop after the currently running step finishes")
528+
self.stop_plan_btn.SetToolTip(
529+
"Cancel the currently running step (it aborts at its next safe "
530+
"point and its partial results are discarded) and stop the plan; "
531+
"remaining steps are not run")
529532
self.stop_plan_btn.Bind(wx.EVT_BUTTON, self._on_stop_plan)
530533
self.stop_plan_btn.Disable()
531534
ctrl_sizer.Add(self.stop_plan_btn, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, 5)
@@ -981,9 +984,11 @@ def _on_plan_step_status(self, index, status):
981984
if not self:
982985
return
983986
from .claude_plan import step_label
984-
mark = {"running": "> ", "done": "[ok] ", "failed": "[FAIL] "}[status]
987+
mark = {"running": "> ", "done": "[ok] ", "failed": "[FAIL] ",
988+
"stopped": "[stopped] "}[status]
985989
self.plan_list.SetString(index, mark + step_label(index + 1, self._plan_steps[index]))
986990
if status == "done":
991+
# Stopped/failed steps stay checked so a re-run picks them up.
987992
self.plan_list.Check(index, False)
988993

989994
def _on_plan_finished(self, completed, aborted_reason):

kicad_routing_plugin/claude_plan.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,9 @@ class PlanExecutor:
599599
until the operation finishes. Stops on the first failed step.
600600
601601
Callbacks (all on the main thread):
602-
on_status(step_index, status) status in 'running' | 'done' | 'failed'
602+
on_status(step_index, status)
603+
status in 'running' | 'done' | 'failed' | 'stopped'
604+
('stopped' = Stop cancelled the step mid-run; it did not complete)
603605
on_finished(completed_count, aborted_reason_or_None)
604606
"""
605607

@@ -912,6 +914,19 @@ def _poll_until_idle(self, index, busy, polls, seen_busy):
912914
# Give it a short grace period before declaring completion.
913915
wx.CallLater(self.POLL_MS, self._poll_until_idle, index, busy, polls + 1, False)
914916
return
917+
if self._stop_requested:
918+
_owner = self._action_owner(self.steps[index]["action"])
919+
if _owner is not None and hasattr(_owner, '_cancel_requested'):
920+
# Stop was pressed while this step ran and its tab is
921+
# cancellable: the engine aborted at its next safe boundary
922+
# and the tab discarded the partial results, so the step did
923+
# NOT complete -- mark it stopped (and leave it checked for a
924+
# re-run), never "[ok]". A non-cancellable tab (fanout) ran
925+
# its step to completion, so it falls through to "done".
926+
self.on_status(index, "stopped")
927+
self.log(f"Claude plan: step {index + 1} stopped (cancelled)")
928+
self._next_step()
929+
return
915930
self._completed += 1
916931
self.on_status(index, "done")
917932
self.log(f"Claude plan: step {index + 1} finished")

0 commit comments

Comments
 (0)