Repository navigation
fix(projects): keep the planning banner when a cancel is refused - #36910
Conversation
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
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of 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 shipsInventory (4 items) — 4 justifiedIntent: when a user cancels a plan from the planning banner, they get the truth about whether it stopped. FIX.
[FIRST-PRINCIPLES-REVIEWED] 946d0de Description read[DESCRIPTION-READ] 555b3a805f82032bc12b203fcd948da83c8ed67bf5c4ae0a7d1a05bb7ce5b70b That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of 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
[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 |
UX Review (Opus 5.5) — ✅ PASSUX-level review of 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
[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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
bolichen97
left a comment
There was a problem hiding this comment.
I read the whole diff on this head, and all checks are green.
- On main,
cancelPlanhides the planning banner in afinally, 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_cancelon 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 staletr-planningflag 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.
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.
cancelPlanclearedisPlanningand thetr-planningmarker in afinallyblock. 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
runAction.What changed (motivation → approach → change)
Symptom: the banner disappears on a failed cancel. Root cause: the reset sat in
finally. Change, inwebsite/src/pages/ProjectsPage.tsx:cancelPlanfollowsrunAction's handling. A thrown error or{ ok: false }reply goes to the existing plan-error notice (with the existingaction_failedtext 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 thetr-planningmarker; 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,
tscand eslint pass.Manual verification
Captured with a local Playwright harness (not part of this PR) that mounts the real
ProjectsPagewith 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:
After (this PR): the banner stays and the reason is shown:
Related Issues
Fixes #36909
Overlap: #36808 (open) also edits
ProjectsPage.tsxandProjectsPageCoverage.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
finallyafter a cancel/stop request hides a refused request; reset only on success.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.