Repository navigation
Description
Problem
src/devops_cli/ai/gateway_bench.py does not run in the CLI process. bench_script() (gateway_tune.py:403-405) sends its source over stdin to python - in an ephemeral python:3.14-slim container attached to the gateway pod (gateway_tune.py:584-601), so the module may import only the standard library (module docstring, task-470).
Nothing enforces that. On release PR #905, Copilot asked for _validate_http_url (gateway_bench.py:63) to raise InvalidURLError instead of a bare ValueError, as AGENTS.md's exception taxonomy requires. Applying that would make every devops ai gateway tune sweep fail with ModuleNotFoundError: No module named 'devops_cli', and the current tests would still pass, because they run the script where devops_cli is importable. The ValueError never leaves the script: _get_text turns it into (0, "") (:73) and run_level.one into a last_error string (:132).
Acceptance criteria
-
test_bench_module_imports_only_the_standard_library(tests/test_ai_gateway_tune.py) parsesinspect.getsource(gateway_bench)withastand asserts that every imported top-level module, other than__future__, is insys.stdlib_module_names. It fails on a copy that addsfrom devops_cli.exceptions import InvalidURLError. - A comment above
gateway_bench.py:63says why the module raises the standard library'sValueError: it runs in a container withoutdevops_cli, and the error is caught at:73and:132. -
_validate_http_url's error does not echo the URL. The message reachesrun_level(...)["last_error"]and the sweep's JSON, so a URL with userinfo or a query token would print its credentials in benchmark output. Copilot noted this on feat(release): v0.2.24 #905's re-review as a previously missed issue. A test passesftp://user:s3cr3t@host/x?token=t0k3nand asserts that the error contains neithers3cr3tnort0k3n. -
uv run devops cipasses.
Key questions
- Should AGENTS.md name this exemption? Proposed: no. The comment and the test are enough, and AGENTS.md changes go through
devops ai agents.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsReady
Activity
dan-petty commentedon Oct 8, 2026
Linked: #796. Both fix the in-pod sweep runner and add tests to
tests/test_ai_gateway_tune.py; they land in either order. Found by the 2026-10-08 backlog review.chore(main): release 0.8.3 (#2403)