Skip to content

refactor: remove legacy CLI runtime helpers and fix GPU worker count#16

Merged
kaiitunnz merged 9 commits into
mainfrom
kaiitunnz/fix/auth-cli
May 5, 2026
Merged

refactor: remove legacy CLI runtime helpers and fix GPU worker count#16
kaiitunnz merged 9 commits into
mainfrom
kaiitunnz/fix/auth-cli

Conversation

@kaiitunnz
Copy link
Copy Markdown
Collaborator

@kaiitunnz kaiitunnz commented May 4, 2026

Purpose

This PR addresses the two pre-release bugs related to FlowMesh CLI mentioned in #1 (comment), including the legacy authentication commands and the usability of the worker creation command. Specifically, we replace the stale logout command with the new commands for persisting and managing FlowMesh config, as well as refactor the worker creation command to allow spawing multi-GPU workers.

Changes

  • cli/src/flowmesh_cli/commands/base.py — replace logout with init, deinit,
    and config commands
  • sdk/stack/src/flowmesh_stack/doctor.py — replace login validation with config file validation in the doctor command.
  • sdk/stack/src/flowmesh_stack/workers.py — fix GPU worker count: count=1 creates
    a single worker with all specified GPUs in cuda_devices; count>1 creates one
    worker per GPU and validates that count matches the number of detected targets
  • tests/cli/test_cli_commands.py — replace TestLogout with TestConfig covering file, env, auto, and invalid cases
  • Minor refactors in cli/src/flowmesh_cli/commands/{node,result,ssh,system,task,trace,worker,workflow}.py, cli/src/flowmesh_cli/core/runtime.py, sdk/src/flowmesh/_base_client.py, etc.

Design

FlowMesh is designed to be simple and focused on serving agentic workflows. Authentication and complex operational logic are therefore deferred to plugin implementation. However, there is still stale code remaining in the CLI and SDK packages. This PR cleans up the stale code and refactors FlowMesh config resolution (prioritizing explicit params → env → config file → defaults) to better support single-user execution.

Moreover, previously, the worker deployment CLI command (flowmesh stack worker up) only supported deploying single-GPU workers. This PR extends the capability to enable deploying either a single multi-GPU worker or multiple single-GPU workers. The behavior is inferred from the requested worker count. If count=1, the command will spawn a single worker with access to the specified target GPUs. Otherwise, the command will deploy multiple workers, each with one GPU, requiring that the requested worker count and the number of GPU targets must match.

Test Plan

uv run pytest tests --ignore=tests/worker/test_mp_executor_cleanup_gpu.py

# End-to-end test
flowmesh stack up
flowmesh stack worker up gpu 1 -t 0,1    # one worker with 2 GPUs
flowmesh stack worker down all
flowmesh stack worker up gpu 2 -t 0,1    # two workers with 1 GPU each
flowmesh stack worker down all
flowmesh stack worker up gpu 3 -t 0,1    # should fail
flowmesh stack clean

Test Result

  • All unit tests pass.
  • End-to-end test runs as expected.

Pre-submission Checklist
  • I have read the contribution guidelines.
  • I have run pre-commit run --all-files and fixed any issues.
  • I have added or updated tests covering my changes (if applicable).
  • I have verified that uv run pytest tests/ passes locally.
  • If I changed shared schemas or proto definitions, I have checked downstream compatibility across Server and Worker.
  • If I changed the SDK or CLI, I have verified the affected packages work (uv sync --all-extras --frozen).
  • If this is a breaking change, I have prefixed the PR title with [BREAKING] and described migration steps above.
  • I have updated documentation or config examples if user-facing behavior changed.

Signed-off-by: Noppanat Wadlom <noppanat.wad@gmail.com>
@kaiitunnz kaiitunnz force-pushed the kaiitunnz/fix/auth-cli branch from 444ee38 to 202b65f Compare May 4, 2026 15:13
Signed-off-by: Noppanat Wadlom <noppanat.wad@gmail.com>
@kaiitunnz kaiitunnz force-pushed the kaiitunnz/fix/auth-cli branch from 202b65f to da7c2fd Compare May 4, 2026 15:14
kaiitunnz added 3 commits May 4, 2026 17:56
Signed-off-by: Noppanat Wadlom <noppanat.wad@gmail.com>
Signed-off-by: Noppanat Wadlom <noppanat.wad@gmail.com>
Signed-off-by: Noppanat Wadlom <noppanat.wad@gmail.com>
@kaiitunnz kaiitunnz requested review from timzsu May 4, 2026 18:27
Copy link
Copy Markdown
Collaborator

@timzsu timzsu left a comment

Choose a reason for hiding this comment

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

A few suggestions. PTAL

Comment thread cli/src/flowmesh_cli/commands/base.py Outdated
Comment thread sdk/src/flowmesh/_base_client.py Outdated
Comment thread sdk/src/flowmesh/_base_client.py Outdated
Comment thread sdk/src/flowmesh/config.py Outdated
Comment thread sdk/stack/src/flowmesh_stack/workers.py Outdated
Comment thread tests/cli/test_cli_commands.py Outdated
Comment thread tests/cli/test_cli_commands.py Outdated
Comment thread tests/cli/test_cli_commands.py Outdated
kaiitunnz added 4 commits May 5, 2026 06:40
Signed-off-by: Noppanat Wadlom <noppanat.wad@gmail.com>
Signed-off-by: Noppanat Wadlom <noppanat.wad@gmail.com>
Signed-off-by: Noppanat Wadlom <noppanat.wad@gmail.com>
Signed-off-by: Noppanat Wadlom <noppanat.wad@gmail.com>
Copy link
Copy Markdown
Collaborator

@timzsu timzsu left a comment

Choose a reason for hiding this comment

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

LGTM.

@kaiitunnz kaiitunnz merged commit 3228428 into main May 5, 2026
10 checks passed
@kaiitunnz kaiitunnz deleted the kaiitunnz/fix/auth-cli branch May 5, 2026 07:05
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