Repository navigation
Closed
Labels
priority/p2-mediumPriority P2: standard workscope/aiAI review pipeline, personas, prompts, LLM client, or RAGtype/bugType bug: the code does not do what it must
Milestone
Description
Context & Rationale
3a773b3 (#677) made gateway tune reuse a debug container on the gateway pod. _ensure_sweep_container (ai/gateway_tune.py:517-555) reuses only the container with the fixed name, and that container runs sleep 3600. This causes two problems:
- Once that container exits, every deployment measured creates a new container with a suffixed name. A simulated run over 3 deployments created 3 containers.
- A reused container can also exit in the middle of a sweep, which kills the run. The default exec timeout is 2,460 s per deployment, so a long sweep can easily outlast the container's hour.
Found while checking the #669 fix.
Scope & Deliverables
- Deliverable: a run tracks its active sweep container and creates at most one container. That container lives at least as long as the run's timeout. Tests cover an expired container and a run over several deployments.
- Constraint: none
Strategic Alignment
- Milestone: Backlog (no release)
- Design: none
- Depends on: none
Generated by Claude Code
Proposed design
Problem statement
The gateway tune functionality in the AI module creates a new debug container for each deployment instead of reusing one, leading to resource inefficiency and potential run interruptions when containers expire or are prematurely terminated.
Acceptance criteria
- Criterion 1: A single debug container is created and reused throughout the entire sweep run, regardless of the number of deployments measured.
Verification: Run a gateway tune sweep over multiple deployments and verify only one container is created and reused. - Criterion 2: The sweep container lives at least as long as the run's timeout to prevent premature termination during long sweeps.
Verification: Configure a long-running sweep with a timeout and confirm that the debug container remains active throughout the duration. - Criterion 3: If an existing sweep container expires or terminates, a new one is correctly created and reused for subsequent deployments.
Verification: Simulate a container expiration event and verify that a new container is created and used for continuing deployments.
Key questions
- What is the current behavior of _ensure_sweep_container when the fixed-name container exits?: Once the fixed-name container (running 'sleep 3600') exits, every deployment measured creates a new container with a suffixed name. [sources: src/devops_cli/ai/gateway_tune.py:517]
- What is the default exec timeout per deployment in the sweep?: The default exec timeout is 2,460 seconds per deployment. [sources: src/devops_cli/ai/gateway_tune.py:517]
- What happens to a sweep when the reused container exits in the middle of a sweep?: A reused container can also exit in the middle of a sweep, which kills the run. [sources: src/devops_cli/ai/gateway_tune.py:517]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
priority/p2-mediumPriority P2: standard workscope/aiAI review pipeline, personas, prompts, LLM client, or RAGtype/bugType bug: the code does not do what it must
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 8, 2026
Linked: #909. Both fix the in-pod sweep runner (
ai/gateway_tune.pyhere,ai/gateway_bench.pythere) and add tests totests/test_ai_gateway_tune.py; they land in either order. Found by the 2026-10-08 backlog review.dan-petty commentedon Oct 18, 2026
Status set to Ready at 25e2cda (see proposed design in issue body).
fix(ai): gateway tune attaches one sweep container per run that outli…
dan-petty commentedon Oct 22, 2026
What changed
#1826, merged into
release/v0.2.39as fef712b.4 file(s) changed.
How it was verified
Check runs at a714944:
Acceptance Criteria of
docs/agent/tasks/task-796-gateway-tune-sweep-container.md:No Acceptance Criteria section.
feat(release): v0.2.39 (#1947)