fix(app): add stop button for queued/running scheduled task runs across web UI#34
Conversation
…ss web UI Adds cancel controls to three surfaces: - Cron task list (stop button for queued/running last runs) - Shared sidebar cron rail (hover/focus stop, always-visible on mobile) - Archived cron session dock in session view Also wires the stop mutation from the session page, extracts shared stop-action models for testability, and updates the API docs to list the new cron runs and cancel endpoints. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-Authored-By: codeplane-agent[bot] <287208015+codeplane-agent[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds UI affordances to cancel queued/running scheduled task (cron) runs across the app, backed by a shared stop-action model/presentation layer and the existing /global/cron/runs/:runID/cancel API.
Changes:
- Adds reusable “stop/cancel run” eligibility helpers + action-model builders + shared stop button components.
- Wires cancel controls into the cron task list, the shared sidebar cron rail, and the archived cron session read-only dock.
- Adds/extends client + tests and updates API docs for listing runs and cancelling a run.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
site/app/docs/api/page.tsx |
Documents the list-runs and cancel-run cron endpoints. |
packages/app/src/utils/cron-client.test.ts |
Adds a unit test verifying CronClient.cancelRun POSTs to the encoded cancel endpoint. |
packages/app/src/pages/session/composer/session-composer-region.tsx |
Adds a read-only dock stop button for cron sessions when cancellation is available. |
packages/app/src/pages/session.tsx |
Adds a mutation + wiring to cancel the current cron run for a cron-driven session. |
packages/app/src/pages/layout/sidebar-cron.tsx |
Adds per-run stop control in the sidebar cron rail and cancels via CronClient.cancelRun. |
packages/app/src/pages/cron.tsx |
Adds a stop button to each cron task row when the last run is queued/running. |
packages/app/src/pages/cron-stop.ts |
Introduces shared eligibility + sidebar visibility-class helpers. |
packages/app/src/pages/cron-stop.test.ts |
Adds unit tests for eligibility and visibility helper behavior. |
packages/app/src/pages/cron-stop-model.ts |
Adds surface-specific stop action “models” (rendering/visibility/disabled/callback shaping). |
packages/app/src/pages/cron-stop-actions.tsx |
Adds shared presentational stop-action components for the three surfaces. |
packages/app/src/pages/cron-stop-actions.test.ts |
Adds tests covering the stop action model helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { Icon } from "@codeplane-ai/ui/icon" | ||
| import { IconButton } from "@codeplane-ai/ui/icon-button" | ||
| import { Spinner } from "@codeplane-ai/ui/spinner" | ||
| import { Tooltip } from "@codeplane-ai/ui/tooltip" | ||
| import { showToast } from "@codeplane-ai/ui/toast" |
| import { describe, expect, test } from "bun:test" | ||
| import { | ||
| getCronSessionStopAction, | ||
| getCronSidebarStopAction, | ||
| getCronTaskStopAction, | ||
| } from "./cron-stop-model" |
Triage — Keep OpenConfirmed real defects in this PR. Copilot review flagged them; no past agent commentary here. Defects found
Why not closeBoth are real maintainability/quality issues. Keep open. |
Review: stop button for queued/running scheduled task runs across web UIStatus: Merge candidate All CI checks are green. 659 tests pass. The three-surface stop button implementation is well-structured with shared action models. Will merge in sequence with PR #35 (backend companion). |
Summary
Adds Cancel run controls to three web surfaces so users can stop queued or running automated scheduled tasks from the cron page, the shared sidebar cron rail, and the archived cron session dock.
Changes
packages/app/src/pages/cron.tsx: Stop button on each cron task row for queued/running last runs usingCronClient.cancelRunpackages/app/src/pages/layout/sidebar-cron.tsx: Hover/focus stop button for active cron runs in the shared sidebar rail; always-visible on mobilepackages/app/src/pages/session.tsx: WiresuseMutationto cancel the current cron run for archived cron sessionspackages/app/src/pages/session/composer/session-composer-region.tsx: Stop button in the readonly cron session dock (renders only when a busy cron run is present)packages/app/src/pages/cron-stop.ts: Shared helpers for stop eligibility and sidebar visibility classespackages/app/src/pages/cron-stop-model.ts: Surface-specific action models (render/no-render, visibility classes, disabled state, click callback) for the task list, sidebar, and session dockpackages/app/src/pages/cron-stop-actions.tsx: Shared presentational stop-action components consumed by the three surfacessite/app/docs/api/page.tsx: DocumentsGET /global/cron/:taskID/runsandPOST /global/cron/runs/:runID/cancelVerification
bun turbo typecheck— all 8 workspace packages passbun lint— 0 errorsbun --cwd packages/app test— 659 pass, 0 fail (includes new tests for action models and CronClient.cancelRun)bun --cwd site typecheck— passbun --cwd site run build— pass