feat: allow graceful stop for all run statuses. - #131
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 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.Terminatorwith a newstop_run/1callback and implement it via the RunGateway. - Teach
RunGateway.DefaultandDAGWorkerhow to handle a:stopcommand, 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_runsstatuses viabatch_summary/3, butpartition_stoppable_runs/1now skips runs whenstop_run/1fails (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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.