Repository navigation
Description
What happened
The implement Job devops-cli-runner-20261030-202214-d182 for #2656 ended Failed (BackoffLimitExceeded). Its pod was OOMKilled (exit code 137) four minutes after it started, at 20:26:31 UTC. The memory limit of the runner container is 4 Gi. Prometheus shows the peak of the working set at 4.13 GB for this pod. The next Job, devops-cli-runner-20261030-203414-7d1e for #2745, peaked at 1.24 GB.
The log ended after a write_file call. It does not name the command that used the memory. The bot comment said only that the Job ended failed and the item is Ready again. The work of the step was lost.
What should happen
- Find the command that used more than 4 Gi. Likely suspects: a whole-tree
pytestrun withxdist, ormypy --stricton a large file set. Measure it in a runner pod with the same limits. - Fix the cause: bound the command (fewer workers, the changed files only), or raise the limit with evidence of the real peak. State the choice in the proposal.
- The Job log names each shell command before it runs (program and the first arguments), so a kill leaves its cause in the log.
Evidence
- Pod
devops-cli-runner-20261030-202214-d182-d8rk7,Terminated reason=OOMKilled, containerrunner. - Prometheus query
max_over_time(container_memory_working_set_bytes{namespace="devops",container="runner"}[30m]).
Acceptance criteria
- The proposal names the command and its peak memory.
- A Job on fix(config): devops config unset stops with a TypeError for a key that a YAML merge key gives #2656 (or a Job with the same step) stays under the limit with margin.
- The tool log line of a shell call names the command.
-
uv run devops cipasses.
Proposed design
Problem statement
The implement runner Job for issue #2656 was OOMKilled at its 4 Gi memory limit. The pod log ended after a write_file call without naming the command that consumed the memory. The work was lost and the cause is unknown. The runner must log each shell command before it runs, and the memory-hungry command must be bounded so the Job completes under the limit.
Acceptance criteria
Requirement: Runner logs shell command before execution
The runner SHALL log the program name and the first arguments of each shell command to stdout before it executes the command.
Scenario: A step runs a shell command and the pod is killed mid-run
- WHEN The runner executes a shell command in a step
- THEN The pod log contains a line naming the program and its first arguments before the command's own output
Requirement: Step completes under memory limit with margin
A Job running the step from issue #2656 SHALL complete with peak working-set memory at or below 80 percent of the container memory limit.
Scenario: Re-run the step that OOMKilled in the original Job
- WHEN A runner pod with the 4 Gi limit runs the step from fix(config): devops config unset stops with a TypeError for a key that a YAML merge key gives #2656
- THEN The pod exits 0 and Prometheus shows peak working-set memory at or below 3.2 Gi
Requirement: CI passes
The command uv run devops ci SHALL exit 0 on the branch that delivers this change.
Scenario: Run the full CI suite on the change branch
- WHEN A developer runs
uv run devops cion the branch - THEN The command exits with code 0
Existing Tool Considered
No check has run. No external tool covers the need to add a log line to the runner's own shell execution or to bound the worker count of a pytest-xdist invocation inside the runner. The fix is code in the runner's step executor (emit a log line before each shell call) and a configuration change (bound pytest-xdist workers or scope mypy to changed files). The written cost is the tokens to modify the step executor to log the program name and first arguments, to adjust the step's command arguments, and to keep both changes passing CI until they match the runner's existing log format.
Key questions
- Where in the code does the runner execute shell commands for a step?: Refine must locate the step executor in the implement job code. The runner's shell checks only the first word of a command (per CONTEXT.md), so the execution path is in the implement job's step runner, not in a generic shell wrapper. [sources: CONTEXT.md]
- Should the fix bound the command's resource usage or raise the container memory limit?: Bound the command. The peak was 4.13 Gi, just over the 4 Gi limit, while the next job peaked at 1.24 Gi. Bounding (fewer xdist workers, mypy scoped to changed files) is more predictable, does not waste cluster memory, and keeps the limit as a safety net rather than a design parameter. Raise the limit only if the bounded command still exceeds 4 Gi, and then with the measured peak as evidence. (best practice) [sources: CONTEXT.md]
- Chosen: Bound the command (fewer xdist workers, mypy on changed files only). Predictable, does not waste cluster memory, keeps the 4 Gi limit as a safety net. The 1.24 Gi peak of the next job shows most work fits well under 4 Gi.
- Rejected: Raise the container memory limit to 8 Gi. Simpler but wastes cluster memory for the common case (1.24 Gi peak). The limit should be a safety net, not a design parameter. Only justified if the bounded command still exceeds 4 Gi.
- What format should the runner's pre-execution log line use?: Log the program name and the first arguments (up to the first flag or a sensible cap) to stdout before the command runs. This matches the pattern of job runners such as GitHub Actions, which log each step name before execution. The line must appear before the command's own output so that a kill leaves the cause in the log. (best practice) [sources: CONTEXT.md]
- Chosen: Log program name and first arguments to stdout before execution. Matches the body's requirement that the log names the command. Appears before the command's output, so a kill leaves the cause. Consistent with job-runner conventions.
- Rejected: Log only the program name. Less informative. Two commands with the same program but different arguments (e.g., pytest vs mypy) would be indistinguishable.
- Rejected: Log the full command line. May leak secrets in arguments. The body asks for the program and first arguments, not the full line.
- What is the current container memory limit and where is it set?: The body states the limit is 4 Gi on the runner container. Refine must confirm the exact value and the file that sets it in the CronJob or Job spec under the k8s/ directory. [sources: k8s/README.md:663]
Open questions
- Which command in the fix(config): devops config unset stops with a TypeError for a key that a YAML merge key gives #2656 step consumed more than 4 Gi of memory? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Oct 30, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(k8s)scope of the title gives the scope.The runner Job loses completed work and blocks delivery of other items until the cause is fixed.Each OOM kill discards the step's output and delays the linked item back to Ready.Requires measuring the peak command, choosing a bound or limit change, and adding a log line before each shell call.Both address OOM kills in k8s workloads, but 135 is a cluster-wide resource-limit review while the candidate fixes one specific runner Job and adds per-command log lines.devops-cli-service commentedon Oct 30, 2026
Refine cannot set this item to Ready at 6c50285 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
chore(main): release 0.23.0 (#2802)
feat(roadmap): size the runner Job resources from the plan (#3848)