feat(cli): add workspace set-runtime and set-model commands #23

Closed
agent-dev-a wants to merge 0 commits from feat/20-set-runtime-model-commands into main
Member

Fixes #22.

Adds molecule workspace set-runtime and molecule workspace set-model commands.

Commands

  • molecule workspace set-runtime <workspace-id> <runtime> — wraps PATCH /workspaces/:id {runtime}.
  • molecule workspace set-model <workspace-id> <model> — wraps PUT /workspaces/:id/model.

Safety / ordering

  • set-runtime fetches the workspace's current model and refuses the switch if
    the model is not in the target runtime's offered-models menu, printing the
    valid alternatives. This prevents the runtime switch from orphaning the
    current model.
  • set-model relies on the workspace-server's fail-closed (runtime, model)
    validation, so an invalid combo (e.g. claude-code + gpt-5.5) is rejected
    by the platform rather than applied.
  • The compat guard only fails-open for unknown/federated runtimes
    (ErrRuntimeNotInRegistry); every other fetch error is treated as ambiguous
    and fail-closed.

Test plan

  • go test ./... -count=1 (green)
  • go build ./... (green)

SOP Checklist

  • Comprehensive testing performed: unit tests for compatible, incompatible, empty-model, unknown-runtime, and 500 fail-closed paths.
  • Local-postgres E2E run: N/A — CLI change; tests use httptest fixtures.
  • Staging-smoke verified or pending: commands wrap existing platform endpoints; integration smoke can be run post-merge.
  • Root-cause not symptom: closes the CLI tooling gap identified in platform-tooling #2056.
  • Five-Axis review walked: correctness (server fail-closed + client guard), readability (clear error messages), architecture (reuses existing client/management layer), security (no new secrets), performance (single extra offered-models lookup only during set-runtime).
  • No backwards-compat shim / dead code added: only additive commands and helpers.
  • Memory/saved-feedback consulted: followed existing molecule workspace command patterns and client error wrapping.

Out-of-scope note: molecule-platform MCP localhost-only limitation is left as a follow-up; no changes here.

🤖 Generated with Claude Code

Fixes #22. Adds `molecule workspace set-runtime` and `molecule workspace set-model` commands. ## Commands - `molecule workspace set-runtime <workspace-id> <runtime>` — wraps `PATCH /workspaces/:id {runtime}`. - `molecule workspace set-model <workspace-id> <model>` — wraps `PUT /workspaces/:id/model`. ## Safety / ordering - `set-runtime` fetches the workspace's current model and refuses the switch if the model is not in the target runtime's offered-models menu, printing the valid alternatives. This prevents the runtime switch from orphaning the current model. - `set-model` relies on the workspace-server's fail-closed (runtime, model) validation, so an invalid combo (e.g. `claude-code` + `gpt-5.5`) is rejected by the platform rather than applied. - The compat guard only fails-open for unknown/federated runtimes (`ErrRuntimeNotInRegistry`); every other fetch error is treated as ambiguous and fail-closed. ## Test plan - `go test ./... -count=1` (green) - `go build ./...` (green) ## SOP Checklist - [x] Comprehensive testing performed: unit tests for compatible, incompatible, empty-model, unknown-runtime, and 500 fail-closed paths. - [x] Local-postgres E2E run: N/A — CLI change; tests use httptest fixtures. - [x] Staging-smoke verified or pending: commands wrap existing platform endpoints; integration smoke can be run post-merge. - [x] Root-cause not symptom: closes the CLI tooling gap identified in platform-tooling #2056. - [x] Five-Axis review walked: correctness (server fail-closed + client guard), readability (clear error messages), architecture (reuses existing client/management layer), security (no new secrets), performance (single extra offered-models lookup only during set-runtime). - [x] No backwards-compat shim / dead code added: only additive commands and helpers. - [x] Memory/saved-feedback consulted: followed existing `molecule workspace` command patterns and client error wrapping. **Out-of-scope note:** molecule-platform MCP localhost-only limitation is left as a follow-up; no changes here. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
agent-dev-a closed this pull request 2026-06-15 12:20:33 +00:00
All checks were successful
CI / Test / test (pull_request) Successful in 41s
Required
Details
Release Go binaries / test (pull_request) Successful in 1m49s
Release Go binaries / release (pull_request) Has been skipped

Pull request closed

Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-cli#23