Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/aiperf/config/loader/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def build_benchmark_plan(config: AIPerfConfig) -> BenchmarkPlan:
sweep_dict = envelope_dict.pop("sweep", None)
else:
envelope_dict = config.model_dump(
mode="json", exclude_none=True, exclude_unset=True
mode="python",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The change preserves secrets only in the expanded plan, but multi-run execution writes each sweep cell with JSON redaction and only restores endpoint.api_key, so CLI sweeps that authenticate with --header Authorization/X-API-Key or URL userinfo still run with credentials in the subprocess. Fix: forward and restore endpoint.headers and endpoint.urls secrets through the same subprocess secret-injection path used for api_key.

🤖 AI Fix

Update src/aiperf/orchestrator/local_executor.py LocalSubprocessExecutor._run_benchmark_subprocess to pass run.cfg.endpoint.headers and run.cfg.endpoint.urls via private environment variables, update src/aiperf/orchestrator/subprocess_runner.py main to pop those variables and restore run.cfg.endpoint.headers and run.cfg.endpoint.urls after BenchmarkRun.model_validate, and add a regression test covering CLIConfig with headers=[("Authorization", "Bearer token")], a URL containing userinfo, and concurrency="1,2".

exclude_none=True,
exclude_unset=True,
context={"include_secrets": True},
)
sweep_dict = envelope_dict.pop("sweep", None)
configs, variations = _expand_envelope_variations(envelope_dict, sweep_dict)
Expand Down
20 changes: 20 additions & 0 deletions tests/unit/config/test_cli_magic_list_sugar.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from aiperf.config.flags.cli_config import CLIConfig
from aiperf.config.flags.converter import convert_cli_to_aiperf
from aiperf.config.loader import build_benchmark_plan
from aiperf.config.loader.parsing import (
parse_float_or_float_list,
parse_int_or_int_list,
Expand Down Expand Up @@ -96,6 +97,25 @@ def test_combined_with_concurrency_magic_list(self):
"phases.profiling.prefill_concurrency": [1, 2],
}

def test_concurrency_sweep_preserves_api_key_in_expanded_plan(self):
cli = CLIConfig(
model_names=["m"],
api_key="sk-real-prod-key",
concurrency="1,2",
request_count=1,
)

plan = build_benchmark_plan(convert_cli_to_aiperf(cli))

assert [c.endpoint.api_key for c in plan.configs] == [
"sk-real-prod-key",
"sk-real-prod-key",
]
assert [
next(p for p in c.phases if p.name == "profiling").concurrency
for c in plan.configs
] == [1, 2]


class TestRequestRateMagicList:
"""`--request-rate 10,20,30` -> grid sweep on `phases.profiling.rate`.
Expand Down
Loading