Skip to content

feat: allow graceful stop for all run statuses. - #131

Merged
marciok merged 3 commits into
v0.1.38-devfrom
stop-all-kinds-of-run
Aug 25, 2026
Merged

feat: allow graceful stop for all run statuses.#131
marciok merged 3 commits into
v0.1.38-devfrom
stop-all-kinds-of-run

Conversation

@marciok

@marciok marciok commented Aug 25, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI 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.

🟡 Changes recommended

The current UI delete interaction can hide rows on the client even when the stop/delete fails, and batch-delete messaging can misreport why runs were skipped.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a “graceful stop” path for DAG runs so UI-driven deletion (single + batch) can stop an active run process first, and allows deletion across more run statuses.

Changes:

  • Extend Gust.DAG.Terminator with a new stop_run/1 callback and implement it via the RunGateway.
  • Teach RunGateway.Default and DAGWorker how to handle a :stop command, including stopping cancellable tasks and tearing down runtime resources.
  • Update Run LiveView delete flows (and tests) to stop active runs prior to deletion, including batch delete.
File summaries
File Description
apps/gust/test/dag/terminator/gateway_test.exs Adds tests for routing run stops through the gateway and handling inactive runs.
apps/gust/test/dag/terminator_test.exs Extends delegations test coverage to include stop_run/1.
apps/gust/test/dag/runner/run_gateway/default_test.exs Adds test ensuring stop errors return without waiting for worker exit.
apps/gust/test/dag/runner/dag_worker_test.exs Adds tests for :stop behavior (stop task workers + teardown; propagate cancellation errors).
apps/gust/lib/gust/dag/terminator/gateway.ex Implements stop_run/1 and treats :run_not_active as already-stopped.
apps/gust/lib/gust/dag/terminator.ex Adds stop_run/1 to the terminator behaviour and public API.
apps/gust/lib/gust/dag/runner/run_gateway/default.ex Implements “safe stop” that waits for worker termination only on successful stop.
apps/gust/lib/gust/dag/runner/dag_worker.ex Adds handle_call(:stop, ...) that cancels active tasks, tears down, and stops the worker.
apps/gust_web/test/gust_web/live/run_live_test.exs Updates delete selectors and adds coverage for stop-before-delete scenarios (single + batch).
apps/gust_web/lib/gust_web/live/run_live/index.html.heex Adds a stable delete link DOM id and updates confirmation message.
apps/gust_web/lib/gust_web/live/run_live/index.ex Stops run processes before deletion and changes batch-delete eligibility to be based on stoppability.
Review details

Suppressed comments (1)

apps/gust_web/lib/gust_web/live/run_live/index.ex:156

  • The batch-delete flash message is still built from skipped_runs statuses via batch_summary/3, but partition_stoppable_runs/1 now skips runs when stop_run/1 fails (not based on status). This can report misleading reasons like "Running runs cannot be deleted" when the actual problem is that the run process could not be stopped.
    {:noreply,
     socket
     |> refresh_run_list()
     |> put_flash(:info, batch_summary(:deleted, deleted_runs, skipped_runs))}
  • Files reviewed: 11/11 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread apps/gust_web/lib/gust_web/live/run_live/index.html.heex
@marciok
marciok merged commit 14d1833 into v0.1.38-dev Aug 25, 2026
4 checks passed
@marciok
marciok deleted the stop-all-kinds-of-run branch August 25, 2026 20:22
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.

2 participants