diff --git a/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/.openspec.yaml b/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/.openspec.yaml new file mode 100644 index 0000000000..25002a8e81 --- /dev/null +++ b/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-11-01 diff --git a/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/design.md b/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/design.md new file mode 100644 index 0000000000..b2c49f086e --- /dev/null +++ b/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/design.md @@ -0,0 +1,14 @@ +# Design + +## Decisions + +- **Remove all three weight functions and their helpers rather than keeping them behind a flag**: The gateway uses least-busy and reads no weight. No other code path calls these functions. The pre-1.0 policy is to delete dead code. +- **Remove recommended_weight and recommended_concurrency from DeploymentTune**: No function computes them after the change. Keeping unset fields in the model misleads the reader. +- **Keep current_weight in DeploymentTune**: It is read from the gateway model info and is informational data. The table does not show it, but JSON output can carry it. +- **Remove ai.gateway_weights and ai.gateway_concurrency settings**: No code reads them after the change. The gateway reads no weight. Keeping dead settings misleads the user. + +## Rejected alternatives + +- **Keep weight columns but mark them informational**: The user cannot apply the value. Keeping it adds noise and implies an action that does not exist. The gateway uses least-busy and reads no weight. +- **Keep the settings for a future routing strategy**: Speculative. The project is pre-1.0 and the pre-1.0 policy is to delete, not keep behind flags. +- **Keep the functions for reuse**: No other code path uses them. Keeping unused functions adds maintenance cost. diff --git a/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/proposal.md b/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/proposal.md new file mode 100644 index 0000000000..82db7198c9 --- /dev/null +++ b/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/proposal.md @@ -0,0 +1,44 @@ +# Proposal + +## Why + +#2592: devops ai gateway tune recommends routing weights and concurrency, and tells the user to set litellm_params.weight. The gateway uses least-busy routing (k8s/llm/gateway/config.yaml), which reads no weight. No deployment sets weight or max_parallel_requests. The recommendation is not actionable. + +## What Changes + +- Remove Weight, Recommended, and Max Parallel columns from the tune report table +- Remove the footer instruction to set litellm_params.weight +- Update the module docstring to describe least-busy routing +- Update the tune command help text to describe measurement, not weight recommendation +- Remove ai.gateway_weights and ai.gateway_concurrency from the settings model +- Remove recommend_weights, calculate_hardware_weights, and calculate_hardware_concurrency from gateway_tune.py +- Remove recommended_weight and recommended_concurrency fields from DeploymentTune +- Update docs/CLI_REFERENCE.md and docs/commands/ai.md +- The change fits one pull request. + +## Capabilities + +### New Capabilities + +None. + +### Modified Capabilities + +- `gateway-tuning`: tune-report-excludes-weight-columns, tune-footer-omits-weight-instruction, tune-docstring-names-least-busy, tune-help-describes-measurement, settings-model-has-no-weight-fields, module-exports-exclude-weight-functions + +## Impact + +- Code: `src/devops_cli/commands/ai_gateway.py`, `src/devops_cli/ai/gateway_tune.py`, `config/settings.py` +- Documents: `docs/CLI_REFERENCE.md`, `docs/commands/ai.md` + +## Feasibility + +- k8s/llm/gateway/config.yaml confirms routing_strategy: least-busy and no deployment sets weight or max_parallel_requests +- src/devops_cli/commands/ai_gateway.py shows the table with Weight, Recommended, Max Parallel columns and the footer referencing litellm_params.weight +- src/devops_cli/ai/gateway_tune.py shows recommend_weights, calculate_hardware_weights, calculate_hardware_concurrency and the simple-shuffle docstring +- The issue confirms ai.gateway_weights is read only in tune_cmd in ai_gateway.py +- First checks: uv run devops ai gateway tune --help to verify help text; grep -r gateway_weights src/ to find all references; grep -r recommend_weights src/ to find all callers; uv run devops ci test tests/test_gateway_tune.py to run existing tests + +## Existing Tool Considered + +LiteLLM least-busy routing strategy covers the gateway's routing need. It picks the deployment with the fewest in-flight requests and reads no weight. The CLI command reports per-deployment measurements; no external tool covers that reporting. The change removes dead code. Nothing new is built. diff --git a/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/specs/gateway-tuning/spec.md b/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/specs/gateway-tuning/spec.md new file mode 100644 index 0000000000..2b84299990 --- /dev/null +++ b/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/specs/gateway-tuning/spec.md @@ -0,0 +1,43 @@ +## ADDED Requirements + +### Requirement: tune-report-excludes-weight-columns +The tune command report table SHALL NOT include columns for current weight, recommended weight, or max parallel requests. + +#### Scenario: table headers exclude weight columns +- **WHEN** the tune command renders its report table +- **THEN** the table headers do not contain Weight, Recommended, or Max Parallel + +### Requirement: tune-footer-omits-weight-instruction +The tune command footer SHALL NOT instruct the user to set litellm_params.weight on any deployment. + +#### Scenario: footer omits weight instruction +- **WHEN** the tune command prints its footer after the table +- **THEN** the footer text does not contain the string litellm_params.weight + +### Requirement: tune-docstring-names-least-busy +The module docstring of gateway_tune.py SHALL describe the least-busy routing strategy and SHALL NOT describe simple-shuffle as the gateway routing method. + +#### Scenario: docstring reflects actual routing +- **WHEN** the module docstring of src/devops_cli/ai/gateway_tune.py is read +- **THEN** it contains least-busy and does not contain simple-shuffle as the routing strategy + +### Requirement: tune-help-describes-measurement +The tune command help text SHALL describe measuring and reporting per-deployment capacity, and SHALL NOT say it recommends routing weights. + +#### Scenario: help text omits weight recommendation +- **WHEN** devops ai gateway tune --help is run +- **THEN** the help text does not contain the phrase recommend routing weights + +### Requirement: settings-model-has-no-weight-fields +The settings model SHALL NOT define gateway_weights or gateway_concurrency fields under the ai section. + +#### Scenario: settings model has no weight fields +- **WHEN** the settings model is loaded and inspected +- **THEN** the ai section has no gateway_weights field and no gateway_concurrency field + +### Requirement: module-exports-exclude-weight-functions +The module gateway_tune.py SHALL NOT define or export recommend_weights, calculate_hardware_weights, or calculate_hardware_concurrency. + +#### Scenario: module exports exclude weight functions +- **WHEN** src/devops_cli/ai/gateway_tune.py is imported +- **THEN** the module __all__ does not contain recommend_weights, calculate_hardware_weights, or calculate_hardware_concurrency diff --git a/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/tasks.md b/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/tasks.md new file mode 100644 index 0000000000..fab8408d7a --- /dev/null +++ b/openspec/changes/2592-devops-ai-gateway-tune-recommends-weights/tasks.md @@ -0,0 +1,37 @@ +# Tasks + +## 1. Remove weight columns and footer from tune report + +Reads: none. Changes: `src/devops_cli/commands/ai_gateway.py`. + +- [ ] 1.1 Write a test that calls _render_tune_report with a TuneReport whose deployments have no recommended_weight or recommended_concurrency, and asserts the table headers do not contain Weight, Recommended, or Max Parallel, and the footer does not contain litellm_params.weight, and verify that `uv run devops ci test tests/test_ai_gateway.py` fails on the base +- [ ] 1.2 In _render_tune_report, remove Weight, Recommended, and Max Parallel from the headers list. Remove the three corresponding row values (current_weight, recommended_weight, recommended_concurrency). Replace the footer text with a statement that the gateway uses least-busy routing and the measurements are informational. In tune_cmd, update the docstring to say Measure each deployment of a gateway model group and report per-deployment capacity. Remove overrides=settings.ai.gateway_weights and concurrency_overrides=settings.ai.gateway_concurrency from the tune_pool call, and verify that `uv run devops ci test tests/test_ai_gateway.py` passes +- [ ] 1.3 Change no document, run `uv run devops docs generate --sync-readme`, and verify that `uv run devops ci docs` passes + +## 2. Remove dead weight functions and fields from gateway_tune + +Reads: none. Changes: `src/devops_cli/ai/gateway_tune.py`. + +- [ ] 2.1 Write a test that imports gateway_tune and asserts recommend_weights, calculate_hardware_weights, and calculate_hardware_concurrency are not in the module namespace. Assert DeploymentTune has no recommended_weight or recommended_concurrency field. Assert the module docstring contains least-busy and does not contain simple-shuffle, and verify that `uv run devops ci test tests/test_gateway_tune.py` fails on the base +- [ ] 2.2 Update the module docstring to describe least-busy routing. Remove the recommend_weights, calculate_hardware_weights, calculate_hardware_concurrency, _resolve_override, _deployment_backend_map, _is_continuous_engine, and _deployment_hardware_score functions. Remove recommended_weight and recommended_concurrency fields from DeploymentTune. In tune_pool, remove the calls to recommend_weights and calculate_hardware_concurrency, and remove the model_copy update that set those fields. Remove the three function names from __all__. Remove imports of CONST_CONTINUOUS_BATCHING_ENGINES, CONST_DEFAULT_CONTINUOUS_CONCURRENCY, CONST_DEFAULT_SERIAL_CONCURRENCY, CONST_ENGINE_MULTIPLIER_CONTINUOUS_BATCHING, and CONST_ENGINE_MULTIPLIER_SERIAL, and verify that `uv run devops ci test tests/test_gateway_tune.py` passes +- [ ] 2.3 Change no document, run `uv run devops docs generate --sync-readme`, and verify that `uv run devops ci docs` passes + +## 3. Remove dead gateway weight settings + +Reads: none. Changes: `config/settings.py`. + +- [ ] 3.1 Write a test that loads the settings model and asserts the ai section has no gateway_weights field and no gateway_concurrency field, and verify that `uv run devops ci test tests/test_settings.py` fails on the base +- [ ] 3.2 Remove the gateway_weights and gateway_concurrency fields from the ai settings section in config/settings.py, and verify that `uv run devops ci test tests/test_settings.py` passes +- [ ] 3.3 Change no document, run `uv run devops docs generate --sync-readme`, and verify that `uv run devops ci docs` passes + +## 4. Update CLI reference and command docs + +Reads: none. Changes: `docs/CLI_REFERENCE.md`, `docs/commands/ai.md`. + +- [ ] 4.1 Write a test that reads docs/CLI_REFERENCE.md and docs/commands/ai.md and asserts neither contains the phrase recommend routing weights, and verify that `uv run devops ci test tests/test_docs.py` fails on the base +- [ ] 4.2 In docs/CLI_REFERENCE.md, update the tune command description to say Measure each deployment of a gateway model group and report per-deployment capacity. In docs/commands/ai.md, make the same change to the tune command description, and verify that `uv run devops ci test tests/test_docs.py` passes +- [ ] 4.3 docs/CLI_REFERENCE.md, docs/commands/ai.md, run `uv run devops docs generate --sync-readme`, and verify that `uv run devops ci docs` passes + +## Workflow follow-up + +- Pending a person: review the diff in tuicr (tuicr -r ..HEAD).