Skip to content

fix(dashboard): run one Task Runner action per run at a time - #29873

Merged
RohanK6 merged 1 commit into
mainfrom
crew/conductor/r111-projects-double-submit
Nov 4, 2026
Merged

RohanK6 merged 1 commit into
mainfrom
crew/conductor/r111-projects-double-submit

Conversation

@RohanK6

@RohanK6 RohanK6 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

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 calls executePlan twice, Restart calls retryTaskRun twice, 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

  • Guarding project renames: a rename must never be dropped, so it stays unguarded.
  • Changing the alert-based Schedule notices.
  • Guarding actions on the compose panel (Run, Plan), which already disable while planning.

What changed (motivation → approach → change)

Symptom: duplicate runs, duplicate cron jobs and false discard errors. Root cause: runAction had no in-flight guard. Change, in ProjectsPage.tsx:

  • runAction takes an optional key, the run it acts on. It defaults to the selected run (read through a new selectedRunIdRef); null leaves the call unguarded. While a key is busy, a second call with the same key returns at once. The key is released in a finally.
  • A busyRuns set mirrors the held keys for rendering. The selected run header buttons (Execute, Chat, Discard, Cancel, Pause, Resume, Restart, Schedule) get disabled={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.
  • The rename passes 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 call createCron once, 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 call executePlan once, 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 touches runAction or 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

  • 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 Apache-2.0 license.

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.
@RohanK6
RohanK6 requested review from a team and KiroCrewCaptain as code owners November 4, 2026 18:59
@RohanK6
RohanK6 requested a review from cruisercohen November 4, 2026 18:59
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: a per-run in-flight guard in runAction is the right layer for this and is in proportion to the double-click harm.

Notes

  • The guard is released in finally once the request resolves, but onOk → load() is not awaited. Execute and Restart turn clickable again while the old planned or completed status is still on screen. A click in that short window can still start a second run. One fix is to hold the key until the reload settles; another is to rely on the backend refusing a run that is already running.

[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 .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

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of e7a93e945329fed7660e3c7720d6adec98730007 — 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. Each guard goes after the cause the author named: runAction had no in-flight guard. The only extra is a detail-panel retry that now shares the run's guard without saying so.

What this change ships

Inventory (8 items) — 7 justified

Intent: 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.

  1. A second click on Execute or Resume while the first is in flight starts no second run — justified
  2. A second click on Restart starts no second retry — justified
  3. A second click on Schedule creates one daily cron job, not two — justified
  4. A second click on Discard or a row's Delete no longer shows a false error — justified
  5. The run header buttons, Chat, Cancel and Pause included, dim while that run's request is in flight — justified
  6. A row's Delete or Cancel is guarded by its own run, so one run's action never holds up another — justified
  7. Renaming a project stays unguarded — justified
  8. A per-task Retry in the detail panel (onRetry → runAction, using the selected run as the default key) is now silently dropped while another action on that run is in flight — undeclared

[FIRST-PRINCIPLES-REVIEWED] e7a93e9

Description read

[DESCRIPTION-READ] c04d4e16cb5bcbc56949a717f28d2f8ab4dc54263446118e1a87aa024a74706e

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

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

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

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

  • Disabled header buttons on the selected run. The diff gives Execute, Chat, Discard, Cancel, Pause, Resume, Restart and Schedule disabled={runBusy} with disabled:opacity-50 disabled:cursor-default. The <!-- no-visual-delta --> marker says nothing changes at rest, but the diff adds a new visible state, and no screenshot shows it. To close: attach a still of the run header taken while one action is held in flight, which the existing test already does by holding the request open.
  • Disabled Delete/Cancel icon on a rail row. The row button gets disabled={busyRuns.has(r.task_id)} with the same 50% dim. To close: attach a still of the rail with one row busy and a neighbouring row still enabled, which shows the guard is per run.

Notes

  • When disabled, the buttons still carry their hover colours (hover:text-danger hover:border-danger, hover:bg-accent, hover:text-warn), so a dimmed Discard or Restart still turns red or purple under the pointer, as if it were clickable. Add disabled:hover: overrides, or use enabled:hover:.
  • At 50% opacity the bare X and Square row icons, which are already text-muted at text-[11px], may become unreadable. Check them in both themes when you take the screenshot.

[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 .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

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] e7a93e9

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

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] e7a93e9

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

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

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Nov 4, 2026
@RohanK6
RohanK6 enabled auto-merge (squash) November 4, 2026 20:49

@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.

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.

@RohanK6
RohanK6 merged commit 55439d8 into main Nov 4, 2026
151 of 154 checks passed
@RohanK6
RohanK6 deleted the crew/conductor/r111-projects-double-submit branch November 4, 2026 23:42
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

task runner: a fast second click starts a second run or a second cron job

2 participants