Skip to content

feat(framework) Add selectors to stop command - #7974

Open
danielpolimac wants to merge 5 commits into
flwrlabs:mainfrom
danielpolimac:feat/stop-run-selectors
Open

feat(framework) Add selectors to stop command#7974
danielpolimac wants to merge 5 commits into
flwrlabs:mainfrom
danielpolimac:feat/stop-run-selectors

Conversation

@danielpolimac

@danielpolimac danielpolimac commented Aug 22, 2026

Copy link
Copy Markdown

Issue

Description

Stopping a recent run currently requires listing runs, copying an ID, and passing that numeric ID to flwr stop. Stopping every active run requires repeating the process.

Related issues/PRs

Fixes #7945.

Proposal

Explanation

Allow the flwr stop argument to be either a numeric run ID or one of two selectors:

  • latest stops the newest unfinished run.
  • all stops all unfinished runs, newest first.

Unfinished includes pending, starting, and running runs, which ensures a pending run can also be stopped. Existing numeric-ID behavior remains unchanged. The JSON response for all contains a single run-ids list instead of emitting multiple JSON documents.

Arguments are validated before configuration migration or connection setup. Batch execution attempts every selected run before reporting partial failures. A run selected by either latest or all that finishes concurrently is treated as already satisfying the stop request, including when the stop RPC returns an unsuccessful response instead of an API error. Unrelated failures remain visible after the rest of an all batch is attempted.

Add focused tests for numeric IDs, active-run filtering and ordering, real CLI validation before setup, negative IDs, the no-active-runs case, both concurrent-completion response forms, batch failure continuation, RPC order, and JSON output.

Checklist

  • Implement proposed change
  • Write tests
  • Update documentation (the CLI help text documents the new argument values)
  • Address LLM-reviewer comments, if applicable
  • Make local checks pass
  • Make CI checks pass
  • Ping maintainers on Slack (channel #contributions)

Any other comments?

Local verification:

  • python -m pytest py/flwr/cli/stop_test.py py/flwr/cli/cli_test.py -k stop
  • python -m ruff check py/flwr/cli/stop.py py/flwr/cli/stop_test.py --no-respect-gitignore
  • python -m mypy py/flwr/cli/stop.py py/flwr/cli/stop_test.py
  • python -m pylint py/flwr/cli/stop.py py/flwr/cli/stop_test.py
  • uv run --no-sync --python=3.11.14 ./dev/test.sh false

Copilot AI lite review requested due to automatic review settings August 22, 2026 14:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 514abaedbe

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread framework/py/flwr/cli/stop.py Outdated

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.

Pull request overview

Adds latest and all selectors to flwr stop while preserving numeric run IDs.

Changes:

  • Resolves unfinished runs in newest-first order.
  • Supports consolidated JSON output for all.
  • Adds selector validation and resolution tests.

The all path should tolerate runs finishing concurrently, and command-level execution/output coverage is still needed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Summary
framework/py/flwr/cli/stop.py Implements selector resolution and multi-run stopping.
framework/py/flwr/cli/stop_test.py Tests selector validation, filtering, and ordering.

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

Comment thread framework/py/flwr/cli/stop.py Outdated
Comment thread framework/py/flwr/cli/stop.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8269b36e15

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread framework/py/flwr/cli/stop.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ed71b558b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread framework/py/flwr/cli/stop.py Outdated
Comment thread framework/py/flwr/cli/stop.py Outdated
Comment thread framework/py/flwr/cli/stop.py
@github-actions github-actions Bot added the Contributor Used to determine what PRs (mainly) come from external contributors. label Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contributor Used to determine what PRs (mainly) come from external contributors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow "semantic parameters" for flwr stop (such as flwr stop latest)

2 participants