Repository navigation
fix(dashboard): run one Task Runner action per run at a time - #29873
Conversation
The Task Runner page sent every Execute, Restart, Resume, Schedule and Discard click straight to the server. A fast second click started a second run, created a second daily cron job, or reported a successful discard as a failure. Each action now holds its run until it settles, and that run's buttons are disabled meanwhile. Renames stay unguarded.
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: a per-run in-flight guard in Notes
[DESIGN-REVIEWED] e7a93e9 Description read[DESCRIPTION-READ] 53c757f0fba2f903123a682f01db0d5b271646b1fd0b8736cfe0703be0f9cb4a 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each guard goes after the cause the author named: What this change shipsInventory (8 items) — 7 justifiedIntent: stop a fast double click on a Task Runner run action from starting two runs, creating two cron jobs, or reporting a discard that worked as a failure. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] e7a93e9 Description read[DESCRIPTION-READ] c04d4e16cb5bcbc56949a717f28d2f8ab4dc54263446118e1a87aa024a74706e That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing a screenshot of the dimmed, disabled run-action buttons while a request is in flight. No image was supplied, so the blind read was not performed. Evidence gaps
Notes
[UX-REVIEWED] e7a93e9 Description read[DESCRIPTION-READ] 6175210d9d578264a61d2e7d6afc1b695587429c6151484abb8758e63ee6b799 That sha256 names everything this verdict read: the PR description, plus the 3 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 |
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: |
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: |
bolichen97
left a comment
There was a problem hiding this comment.
Approving at e7a93e9. All 96 checks on this head have passed.
runAction now holds one action per run at a time. A second call for a run whose action is still in flight returns at once, and the run's buttons are disabled while it is busy. The busy set lives in a ref, so two clicks in the same tick cannot both get through, and the finally releases the run even when the request throws. The run id is read from a ref after the await, so the guard names the run the action was started for. Rename passes null and stays unguarded, as intended.
The tests show that a double click on Schedule creates one cron job and a double click on Execute starts one run, while another run's row actions stay enabled. No regex is added. Your auto-merge is already on, so I left it as it is.
Problem / Motivation
Goal: On the Task Runner page, a fast second click on a run action does nothing extra: one run starts, one cron job is created, and a successful discard is not reported as a failure.
Every run action calls
runAction, which sends the request at once with no in-flight guard, and none of the buttons is disabled while it runs. A double click on Execute or Resume callsexecutePlantwice, Restart callsretryTaskRuntwice, Schedule creates two identical daily cron jobs, and a second Discard or row Delete fails on the already-deleted run and shows an error.Why it matters
Execute and Restart start real agent runs that cost time and spend, and Schedule leaves a duplicate cron job firing every day until someone notices. A double click is an ordinary slip.
Not a goal
What changed (motivation → approach → change)
Symptom: duplicate runs, duplicate cron jobs and false discard errors. Root cause:
runActionhad no in-flight guard. Change, inProjectsPage.tsx:runActiontakes an optionalkey, the run it acts on. It defaults to the selected run (read through a newselectedRunIdRef);nullleaves the call unguarded. While a key is busy, a second call with the same key returns at once. The key is released in afinally.busyRunsset mirrors the held keys for rendering. The selected run header buttons (Execute, Chat, Discard, Cancel, Pause, Resume, Restart, Schedule) getdisabled={runBusy}, and the rail row Delete or Cancel is keyed and disabled by its own run, so an action on one run never holds up another.null.Backwards compatibility
Compatible: a single click behaves exactly as before; only a second click on the same run while its first request is in flight is ignored.
Removes nothing: no control, route or state is taken away.
Tests
ProjectsPage.test.tsx:a fast second click on Schedule creates one cron job, not two: two clicks callcreateCrononce, the button is disabled while it runs and enabled after.a fast second click on Execute starts one run, and the guard is per run: two clicks callexecutePlanonce, and another run row Delete stays enabled.Both fail on main and pass here. The ProjectsPage and ProjectDetailPage suites pass: 166 tests. tsc, eslint and the i18n check are clean.
Proof: not provable -- frontend test (prove.py runs Python only)
Manual verification
N/A — unit coverage sufficient: the tests hold the request open, click twice, then land it.
Screenshots / video
Why no screenshot: at rest nothing renders differently; a run buttons dim only for the length of one in-flight request.
Related Issues
Fixes #29870
Overlap: #21276 and #25471 also edit
ProjectsPage.tsx, on other lines (the Schedule handler body, the alert notices, an import and a block near the run detail). Neither touchesrunActionor the button attributes changed here.Sibling sweep
Swept: git grep -n -E "<(Btn|button)[^>]onClick={[^}](save|delete|remove|run|install|apply|restore|update|create)" -- website/src, filtered for lines with no disabled=
Sibling: website/src/pages/ProjectsPage.tsx -- changed here
Sibling: website/src/pages/members/CrewGoals.tsx -- not affected -- run() returns early on busyRef
Sibling: website/src/pages/overview/MemoryTab.tsx -- tracked in #18831 -- that open PR rewrites the lessons Delete button
Sibling: website/src/components/notifications/NotificationDetailPanel.tsx -- not affected -- a duplicate resolveApproval only logs to the console; no error is shown to the user
Pattern harvest
Rule candidate: review-prompt
Pattern: an async click handler that sends a request with no in-flight guard and no disabled state on its button
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project Apache-2.0 license.