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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-14
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Design

## Decisions

- **Set `roadmap.implement.max_memory_limit: 16Gi` in the example ConfigMap and keep the code default at 8Gi.**: The value belongs to this cluster and the deploy renders the template, so git holds the limit that the runner Jobs use. The code default stays the product default for every cluster, at `src/devops_cli/config/defaults.py:1054:DEFAULT_ROADMAP_IMPLEMENT_MAX_MEMORY_LIMIT: str = "8Gi"`.
- **Name the smallest node that can run a runner Job as the bound in the description of the setting.**: The parked node is cordoned (#5143) and runs no runner Job, so its 12.8 GiB bounds nothing, and 16Gi is above it. The memory request sets the placement of a Job, so the limit does not place it.
- **Update both the Size and Deadline sections of `docs/CLUSTER.md`.**: The Deadline section explicitly describes Service-created Jobs, which run under the 16Gi limit configured in the template.
- **Reference 2026-11-12, 2026-11-13, #5484 and #3727 in the template comment.**: Telemetry does not preserve the specific Job ID for the 2026-11-12 kill, so referencing the dates and issue numbers provides complete provenance.
- **Keep the other doubled values that the live ConfigMap holds (#5440) out of this change.**: Follow-up issue #5583 handles the other doubled values with their own criteria.
- **Prove the live ConfigMap after the merge with a person's deploy and read, not with a test.**: The runner pod holds no Kubernetes token and no test of the repository reaches the cluster, so the third acceptance criterion is a person's step after the merge.

## Rejected alternatives

- **Raise `DEFAULT_ROADMAP_IMPLEMENT_MAX_MEMORY_LIMIT` to 16Gi instead of setting the value in the template.**: It pushes a 16Gi limit into every cluster, also one whose nodes cannot allocate it, and the comment above the default at `src/devops_cli/config/defaults.py:1052` keeps 8Gi below the 15 Gi of the smallest node.
- **Patch the live ConfigMap and leave the template as it is.**: `src/devops_cli/k8s/configmap.py:57:def render_devops_configmap_content(` writes the whole template config again, so the next `deploy-stack` removes a hand-set value; that removal is the defect of the issue.
- **Keep the phrase "the smallest node of the cluster" in the description.**: The parked node is cordoned (#5143) and runs no runner Job, so its 12.8 GiB bounds nothing, and the 16Gi that the two kills proved necessary is above it, which the old text would refuse.

## Security

The template `k8s/devops/configmap.example.yaml` holds no credential: the change adds a memory limit and a comment, and no key that reads a secret. What crosses a trust boundary is the memory that a runner Job may burst above its request, which bounds the other pods of the node; a person must confirm that the node which runs runner Jobs can allocate 16Gi, and that the parked node (#5143) runs no runner Job. `tests/k8s/test_k8s_configmap_keys.py` fails when the rendered ConfigMap loses the value, and `tests/config/test_k8s_devops_runtime.py` fails when the template holds a credential.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Proposal

## Why

Each `devops k8s deploy-stack --stack devops` renders ConfigMap `devops-cli-config` from `k8s/devops/configmap.example.yaml`, and that template sets no `roadmap.implement.max_memory_limit`. The Service then reads the code default 8Gi, the limit at which the kernel killed two runner Jobs, and the 16Gi that a person set in the live ConfigMap is lost at the next deploy. Git holds no copy of the limit that works, so a deploy keeps the failure (#5484).

## What Changes

- Set `roadmap.implement.max_memory_limit: 16Gi` under `roadmap.implement` in `k8s/devops/configmap.example.yaml`, with a comment that names the two kills of 2026-11-12 and 2026-11-13 (#5484, #3727).
- Hold the value with `test_the_example_holds_the_runner_memory_limit` in `tests/k8s/test_k8s_configmap_keys.py`, which renders the example through `render_active_devops_configmap`.
- Keep the code default `DEFAULT_ROADMAP_IMPLEMENT_MAX_MEMORY_LIMIT` at 8Gi, so a cluster whose nodes cannot allocate 16Gi keeps the product default.
- Change the description of `roadmap.implement.max_memory_limit` in `src/devops_cli/config/settings.py` to name the smallest node that can run a runner Job as the bound.
- Hold the description with `test_the_description_names_the_smallest_node_that_can_run_a_runner_job` in `tests/roadmap/implement/test_roadmap_implement_size.py`.
- Regenerate `docs/ENV_VARS.md` with `uv run devops docs generate`, so its row of the setting states the new bound.
- State the default 8Gi and the example's 16Gi in the Size and Deadline sections of `docs/CLUSTER.md`, and hold the statement with `test_the_size_section_names_the_default_and_the_example_limit` in `tests/config/test_k8s_devops_runtime.py`.
- Leave the other doubled values that the live ConfigMap holds (#5440) out of this change: no acceptance criterion of #5484 names them, and each needs its own proof.
- The change fits one pull request.

## Capabilities

### New Capabilities

None.

### Modified Capabilities

- `roadmap-service-deployment`: The example ConfigMap holds the runner memory limit
- `roadmap-implement-job/runner-job`: The description of the memory limit names the node that runs the Job, The cluster document states both runner memory limits

## Impact

- Code: `k8s/devops/configmap.example.yaml`, `src/devops_cli/config/settings.py`
- Documents: `docs/ENV_VARS.md`, `docs/CLUSTER.md`
- Tests: `tests/k8s/test_k8s_configmap_keys.py`, `tests/roadmap/implement/test_roadmap_implement_size.py`, `tests/config/test_k8s_devops_runtime.py`

## Feasibility

- The probe lines confirm the cited paths of the staging commit: "The path `k8s/devops/configmap.example.yaml` is a file of the staging commit.", "The path `src/devops_cli/k8s/configmap.py` is a file of the staging commit.", "The path `src/devops_cli/config/defaults.py` is a file of the staging commit." and "The path `docs/CLUSTER.md` is a file of the staging commit."
- The probe line "The path `roadmap.implement.max_memory_limit` is no file of the staging commit. No commit in the history deleted or renamed it." confirms that the cited name is a setting and no path, so no module moves and no import is rewritten.
- `read_file` of `src/devops_cli/k8s/configmap.py` lines 45-135 shows `src/devops_cli/k8s/configmap.py:57:def render_devops_configmap_content(`, which sets `config["service"]` and writes the whole config again, and `src/devops_cli/k8s/configmap.py:124:def render_active_devops_configmap(`, which reads the template of the product directory.
- `search_code` with `max_memory_limit` returns no line of `k8s/devops/configmap.example.yaml`, so the template sets no runner memory limit, and the staged default is `src/devops_cli/config/defaults.py:1054:DEFAULT_ROADMAP_IMPLEMENT_MAX_MEMORY_LIMIT: str = "8Gi"`.
- `read_file` of `src/devops_cli/config/defaults.py` lines 1045-1062 shows the comment that the 8Gi is below the 15 Gi of the smallest node, which is why the default stays 8Gi and the cluster value goes into the template.
- `read_file` of `src/devops_cli/config/settings.py` lines 1425-1470 shows `src/devops_cli/config/settings.py:1441:max_memory_limit: Annotated[str, Variable()] = Field(`, the text that the change replaces at `src/devops_cli/config/settings.py:1442:it must fit the smallest node of the cluster`, and the form that it keeps at `src/devops_cli/config/settings.py:1444:pattern=r"^[1-9][0-9]*Gi$",`, which admits 16Gi.
- `search_code` with `smallest node of the cluster` returns `docs/ENV_VARS.md:145:The memory limit of every runner Job that the Service creates, as a whole number of Gi such as` and the same text in the field, so group 3 regenerates that one generated row and no other document.
- `read_file` of `src/devops_cli/roadmap/implement/implement_size.py` lines 70-95 shows `src/devops_cli/roadmap/implement/implement_size.py:74:memory="6Gi",` and `src/devops_cli/roadmap/implement/implement_size.py:81:MIN_MEMORY_LIMIT_GI: Final[int] = max(int(row.memory.removesuffix("Gi")) for row in RUNNER_SIZES)`, so the bound is 6 and the 16Gi of the template clears it.
- `read_file` of `docs/CLUSTER.md` lines 40-80 shows `docs/CLUSTER.md:67:- **Size.** The Service sizes the CPU and the memory request of a Job from its plan (#3193).`, the line that states the setting and its default 8Gi.
- `read_file` of `tests/k8s/test_k8s_configmap_keys.py` lines 1-45 shows `tests/k8s/test_k8s_configmap_keys.py:28:rendered = render_active_devops_configmap(`, so the new case renders the example through `_example_config()` and reads its `roadmap.implement` value.
- `read_file` of `tests/roadmap/implement/test_roadmap_implement_size.py` lines 1-30 and 100-140 shows `tests/roadmap/implement/test_roadmap_implement_size.py:114:def test_the_memory_limit_is_8gi_when_the_setting_is_not_set() -> None:` and the import of the `settings` module, so the description case goes there and reaches the field through `settings.RoadmapImplementConfig`, which `src/devops_cli/config/settings.py:1298:class RoadmapImplementConfig(BaseModel):` defines.
- `read_file` of `tests/config/test_k8s_devops_runtime.py` lines 190-225 shows `tests/config/test_k8s_devops_runtime.py:200:raw = yaml.safe_load(_doc("configmap.example.yaml")["data"]["devops-cli.yaml"])`, the module that already reads the template, so the Size case joins it.
- `search_code` with `docs generate` shows `docs/ROADMAP_WORKFLOW.md:309:Write the generated documents in the docs directory of the checkout` and the amendment that deleted `--sync-readme`, so group 3 runs the generator with no option; the earlier plan cited the deleted option and is corrected here.
- The earlier plan also cited a read of the live ConfigMap as a `devops` command, which no command of the tool implements. This plan names no such command: the live read is a person's step after the merge, with the cluster's own client.
- `render_active_devops_configmap` needs a checkout of the repository: the new case passes `REPO_ROOT / "k8s" / "devops"` as `product_dir` and the function reads `configmap.example.yaml` there; it needs no client of a service and no network.
- `render_devops_configmap_content` needs no checkout, no client and no network: it takes the template text, the repository list and the GitHub App settings as values and returns a text.
- The plan introduces no program and no option: `uv`, `devops` and `pytest` are tools of the runner image, so no failure class is added, no `NOT_IN_RUNNER` entry applies and no pod setting changes from `readOnlyRootFilesystem: true` and `runAsNonRoot: true`.
- The first checks against the real system are `uv run devops ci test tests/k8s/test_k8s_configmap_keys.py` for the rendered limit, `uv run devops ci test tests/roadmap/implement/test_roadmap_implement_size.py` for the description, `uv run devops docs generate` and then `uv run devops docs check` for the generated row, and `uv run devops ci test tests/config/test_k8s_devops_runtime.py` for the Size line.
- The live ConfigMap, the two kills and the allocatable memory of the parked node are not checked by this run: the plan run has no cluster client and runs no command. The third criterion stays a person's step after the merge, which runs `devops k8s deploy-stack --stack devops` and reads the live ConfigMap.
- The related document of #5444 is absent, per the probe line "The path `docs/K8S_PERFORMANCE.md` is no file of the staging commit. No commit in the history deleted or renamed it."; this change creates no such file and records no gap in it.
- The issue can be built as written: the template exists, the render writes every setting that is not `service` again, and the field pattern admits 16Gi above the bound of 6.

## Existing Tool Considered

The example ConfigMap `k8s/devops/configmap.example.yaml` and `devops k8s deploy-stack --stack devops` are the existing controls, and this change adds no tool, library or command. The issue estimates 50,000 tokens and 30 minutes to build the same result as code; this change writes no code and adds no dependency.

## Dependencies

- #5492 changes `docs/CLUSTER.md`, the same document that group 4 edits, so the two edits must not conflict.
- #5547 changes `src/devops_cli/config/defaults.py`, which this change reads for `DEFAULT_ROADMAP_IMPLEMENT_MAX_MEMORY_LIMIT` and does not edit; the default stays 8Gi.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## ADDED Requirements

### Requirement: The description of the memory limit names the node that runs the Job
The description of the setting `roadmap.implement.max_memory_limit` SHALL name the smallest node that can run a runner Job as the bound of the limit, and SHALL name no other node as its bound.

#### Scenario: The description names the node that runs the Jobs
- **WHEN** a test reads the description of the field from the settings model
- **THEN** it names the smallest node that can run a runner Job and not the smallest node of the cluster

### Requirement: The cluster document states both runner memory limits
The Size section of the cluster document SHALL give the code default 8Gi of `roadmap.implement.max_memory_limit` and the 16Gi that the example ConfigMap sets.

#### Scenario: The Size section states both values
- **WHEN** a test reads the Size line of the cluster document
- **THEN** it names the default 8Gi and the 16Gi of the example ConfigMap
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## ADDED Requirements

### Requirement: The example ConfigMap holds the runner memory limit
The example ConfigMap SHALL set `roadmap.implement.max_memory_limit` to 16Gi, with a comment that names the two out-of-memory kills of 2026-11-12 and 2026-11-13, and the render of the ConfigMap SHALL keep that value for every repository.

#### Scenario: The rendered example holds the limit
- **WHEN** a test renders the example ConfigMap for one repository with the GitHub App settings
- **THEN** the rendered config holds 16Gi as the runner memory limit and the service.repos of that repository

#### Scenario: The comment names the two kills
- **WHEN** a test reads the comment above the setting in the example ConfigMap
- **THEN** the comment names 2026-11-12, 2026-11-13, #5484 and #3727
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Tasks

## 1. Put the runner memory limit in the example ConfigMap

Kind: other. Reads: `k8s/devops/configmap.example.yaml`, `tests/k8s/test_k8s_configmap_keys.py`, `src/devops_cli/k8s/configmap.py`. Changes: `k8s/devops/configmap.example.yaml`, `tests/k8s/test_k8s_configmap_keys.py`.

- [ ] 1.1 Add the case `test_the_example_holds_the_runner_memory_limit` to `tests/k8s/test_k8s_configmap_keys.py` first: render the example through `_example_config()` and assert that `config["roadmap"]["implement"]["max_memory_limit"]` is `16Gi`, then read the template text and assert that the comment above the setting names 2026-11-12, 2026-11-13, #5484 and #3727. It fails while the template sets nothing. Then add `max_memory_limit: 16Gi` under `roadmap.implement` in `k8s/devops/configmap.example.yaml`, after `ladder`, with that comment
- Verification: `$ uv run devops ci test tests/k8s/test_k8s_configmap_keys.py` passes

## 2. Name the node that bounds the limit in the setting description

Kind: behavior. Reads: `src/devops_cli/config/settings.py`, `tests/roadmap/implement/test_roadmap_implement_size.py`. Changes: `src/devops_cli/config/settings.py`, `tests/roadmap/implement/test_roadmap_implement_size.py`.

- [ ] 2.1 `test_the_description_names_the_smallest_node_that_can_run_a_runner_job` in `tests/roadmap/implement/test_roadmap_implement_size.py`
- Verification: `$ uv run devops ci test tests/roadmap/implement/test_roadmap_implement_size.py` fails on the base
- [ ] 2.2 Write the case first: read `settings.RoadmapImplementConfig.model_fields["max_memory_limit"].description` and assert that it holds `smallest node that can run a runner Job` and not `smallest node of the cluster`. It fails on the staged description. Then change the `description` of `max_memory_limit` in `src/devops_cli/config/settings.py` so the bound is the smallest node that can run a runner Job, and keep the pattern and the default as they are
- Verification: `$ uv run devops ci test tests/roadmap/implement/test_roadmap_implement_size.py` passes

## 3. Regenerate the environment variable table from the new description

Kind: other. Reads: `docs/ENV_VARS.md`, `src/devops_cli/config/settings.py`. Changes: `docs/ENV_VARS.md`.

- [ ] 3.1 Run `uv run devops docs generate` with no option, so the row of `DEVOPS_CLI_ROADMAP_IMPLEMENT_MAX_MEMORY_LIMIT` in `docs/ENV_VARS.md` holds the new description of the setting, and keep no other change of the generator
- Verification: `$ uv run devops docs check` passes
- [ ] 3.2 Edit `docs/ENV_VARS.md` with the output of `uv run devops docs generate`
- Verification: `$ uv run devops ci docs` passes

## 4. State both limits in the Size and Deadline lines of the cluster document

Kind: other. Reads: `docs/CLUSTER.md`, `tests/config/test_k8s_devops_runtime.py`, `k8s/devops/configmap.example.yaml`. Changes: `docs/CLUSTER.md`, `tests/config/test_k8s_devops_runtime.py`.

- [ ] 4.1 Add the case `test_the_size_section_names_the_default_and_the_example_limit` to `tests/config/test_k8s_devops_runtime.py` first: read the Size and Deadline lines of `docs/CLUSTER.md` and assert that the example ConfigMap sets `16Gi` with #5484 and that the Deadline paragraph reflects the 16Gi template limit; it fails until the update is there. Then update both sections in `docs/CLUSTER.md`
- Verification: `$ uv run devops ci test tests/config/test_k8s_devops_runtime.py` passes
- [ ] 4.2 Edit `docs/CLUSTER.md` so the Size and Deadline sections state the 16Gi template limit
- Verification: `$ uv run devops ci docs` passes

## Criteria

- Group 1: A test proves that the rendered ConfigMap holds `max_memory_limit: 16Gi`.
- Group 3: `uv run devops docs check` passes with the new default text.
- Pending person: Live proof after the merge: after `devops k8s deploy-stack --stack devops`, the live ConfigMap still holds `16Gi`., It needs the cluster and a deploy of the merged commit. The runner pod holds no Kubernetes token, no test reaches the cluster, and only a person runs the deploy and the read of the live ConfigMap.

## Workflow follow-up

- Pending a person: review the diff in tuicr (tuicr -r <base>..HEAD).