Skip to content

fix(projects): keep the planning banner when a cancel is refused - #36910

Merged
bolichen97 merged 1 commit into
mainfrom
crew/conductor/r62-cancel-plan-failure
Nov 14, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
crew/conductor/r62-cancel-plan-failure

Conversation

@RohanK6

@RohanK6 RohanK6 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Cancelling a plan from the planning banner only clears the banner when the cancel actually happened, and says why when it did not.

cancelPlan cleared isPlanning and the tr-planning marker in a finally block. A refused cancel (an { ok: false } reply) or a failed one (a non-2xx or network error) still hid the banner and unlocked the form while the plan kept running server-side, and a thrown error went unhandled.

Why it matters

The user believes the plan was stopped. It is still running, and it can land a plan a few seconds later that they thought they had cancelled, with nothing on screen that said the cancel did not go through.

Not a goal

  • Changing the run header's cancel, which already reports failures through runAction.
  • Retrying the cancel automatically.

What changed (motivation → approach → change)

Symptom: the banner disappears on a failed cancel. Root cause: the reset sat in finally. Change, in website/src/pages/ProjectsPage.tsx: cancelPlan follows runAction's handling. A thrown error or { ok: false } reply goes to the existing plan-error notice (with the existing action_failed text as the fallback) and the banner stays; only a successful cancel clears the planning state. A retry clears the previous error first.

Kept on purpose: if the gateway is unreachable, the banner stays until the existing recovery poll ends it, rather than claiming a cancel nobody confirmed.

Backwards compatibility

Compatible: the same request; only what the page shows after a refused or failed cancel changes.

Removes nothing.

Tests

  • website/src/test/ProjectsPageCoverage.test.tsx: a rejected cancel shows its reason and keeps the banner and the tr-planning marker; an { ok: false } cancel shows its error and keeps the banner. Both fail on main.

Proof: not provable -- frontend test (prove.py runs Python only). Checked by hand: both tests fail against the main-branch page; the file's 64 tests, tsc and eslint pass.

Manual verification

Captured with a local Playwright harness (not part of this PR) that mounts the real ProjectsPage with a restored planning state and a gateway that answers the cancel with 409. It checks in the DOM whether the banner and the error are present before writing each frame. On main the page also logs an unhandled rejection.

Screenshots / video

Projects, English and German: Cancel is clicked on the planning banner and the gateway refuses it.

Before (main): the banner is gone and nothing says the cancel failed:

before en: banner gone, no error

before de: banner gone, no error

After (this PR): the banner stays and the reason is shown:

after en: banner kept, reason shown

after de: banner kept, reason shown

Related Issues

Fixes #36909

Overlap: #36808 (open) also edits ProjectsPage.tsx and ProjectsPageCoverage.test.tsx, in other places; the two merge cleanly in either order (git merge-tree).

Sibling sweep

Swept: grep -n "cancelPlan|finally {" website/src/pages/ProjectsPage.tsx
Sibling: ProjectsPage.tsx planning banner cancel -- changed here
Sibling: ProjectsPage.tsx run header cancel / pause / delete -- already handled by runAction

Pattern harvest

Rule candidate: review-prompt
Pattern: resetting "in progress" UI state in finally after a cancel/stop request hides a refused request; reset only on success.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

The planning banner's Cancel cleared the planning state in a finally
block, so a refused or failed cancel hid the banner while the plan kept
running, and the rejection went unhandled. Report the refusal in the
plan-error notice and keep the banner, as the run header's cancel
already does through runAction.

Fixes #36909
@RohanK6
RohanK6 requested review from a team and KiroCrewCaptain as code owners November 13, 2026 22:47
@RohanK6
RohanK6 requested a review from mbriones98 November 13, 2026 22:47
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 946d0de17d18481212438a36028661df5b71d507 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. This is a mechanism-level fix to the one reset that hid a refused cancel, and both new tests pin the defect from #36909.

What this change ships

Inventory (4 items) — 4 justified

Intent: when a user cancels a plan from the planning banner, they get the truth about whether it stopped. FIX.

  1. A refused or failed cancel now keeps the planning banner and the tr-planning marker, where before the finally block cleared both every time — justified
  2. The reason for a refused cancel now appears in the existing plan-error notice, falling back to the action_failed text — justified
  3. A thrown cancel error is now caught instead of escaping as an unhandled rejection — justified
  4. Clicking Cancel again clears the previous plan error first — justified

[FIRST-PRINCIPLES-REVIEWED] 946d0de

Description read

[DESCRIPTION-READ] 555b3a805f82032bc12b203fcd948da83c8ed67bf5c4ae0a7d1a05bb7ce5b70b

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 946d0de17d18481212438a36028661df5b71d507 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Small fix that makes the banner reflect what the server actually did. Screenshots in four languages back up the visual change, and nothing is removed.

Notes

  • cancelPlan now repeats runAction's check for a thrown error or an { ok: false } reply instead of calling it. If runAction can take a custom error setter, routing through it would leave one place that decides what counts as a failed action.

[DESIGN-REVIEWED] 946d0de

Description read

[DESCRIPTION-READ] 05f30680790cf622a44d9972242dd3512a1d396032b6ce2ee8593f25524b1030

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 946d0de17d18481212438a36028661df5b71d507 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. Screenshots 03 and 04 show the new refused-cancel state, the banner stays visible, and the notice says what happened.

Notes

  • The blind reader saw the notice and the banner disagree: "One still offers Cancel, the other says cancelling failed. I can't tell whether pressing Cancel again is useful." The generic fallback (action_failed, used when the reply has no error text) and the thrown-error text from errText(e) don't say what to do next either. Add a next step to the fallback, e.g. "The plan is still running. Cancel again or wait for it to finish."
  • In the German shot the red error stays in English ("The planner did not stop…"). That is the gateway's own text passed through as-is, so a non-English user gets an untranslated reason. Show a translated lead sentence and keep the gateway's reason after it.

[UX-REVIEWED] 946d0de

Description read

[DESCRIPTION-READ] 541e24d066a651365a1a02a3f60b46700f0efc7deab007fe9ac2d125356824b2

That sha256 names everything this verdict read: the PR description, plus the 7 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 946d0de17d18481212438a36028661df5b71d507 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 946d0de

Verdict parsed from the review's SHA-scoped output markers for commit 946d0de17d18481212438a36028661df5b71d507.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 946d0de17d18481212438a36028661df5b71d507 false-positive: <reason, 20 to 500 characters>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 946d0de17d18481212438a36028661df5b71d507 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 946d0de

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 946d0de17d18481212438a36028661df5b71d507 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 14, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I read the whole diff on this head, and all checks are green.

  • On main, cancelPlan hides the planning banner in a finally, so a refused cancel hid it while the plan kept running. Now the banner hides only when the cancel succeeds. A thrown error or an {ok: false} answer keeps the banner and shows the reason.
  • I checked that this cannot leave a stuck banner. api_taskrunner_plan_cancel on main (dashboard/handlers/taskrunner.py:1147-1165) answers {"ok": True} whether or not a plan is running, and refuses only the non-owner and internal-caller cases. In those cases the plan really is still running. So a stale tr-planning flag with no plan still clears on Cancel, as before.
  • No request changes, and nothing new is refused. The UI only stops claiming a cancel that did not happen. Both failure shapes have a test.
  • No regex.

Approving.

@bolichen97
bolichen97 merged commit 5ec7b24 into main Nov 14, 2026
97 of 100 checks passed
@bolichen97
bolichen97 deleted the crew/conductor/r62-cancel-plan-failure branch November 14, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Projects: the planning banner's Cancel hides the banner even when the cancel is refused

2 participants