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
10 changes: 8 additions & 2 deletions docs/ROADMAP_WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ These are all the keys of the job record, by the job that writes them:
| Stage | `stage.needs_fix` | The plan pull request that the Service told about the label `plan/needs-fix` |
| Implement | `implement.group`, `implement.sha`, `implement.branch`, `implement.pr` | The last group that passed, the last commit, the branch and the pull request |
| Implement | `implement.stopped`, `implement.failure`, `implement.spend`, `implement.trace` | The step that stopped the Item, the class of its failure, the spend of its steps, and the trace of its last run |
| Implement | `implement.check`, `implement.check_log` | The check that failed in the stop, and the masked end of its log (at most 2000 characters). A retry and a clear rule of the Service remove both with the stop |
| Implement | `implement.job`, `implement.job_state`, `implement.job_digest` | The runner Job that the Service made, its state after a round reported it, and the digest of the runner image that the Job ran |

## The stop and retry path
Expand All @@ -126,7 +127,7 @@ Each new Job overwrites `implement.job_digest`. So a second stop on the same ima

## The failure classes

A stop has a class (`roadmap/failure.py`, #3065). The classifier is a pure function of the error text, the exit status, the refusal of a tool, the name of the check and the last message of the agent. A failure that no rule matches is `ci_infra`. The stop comment names the class, the action taken and the action left, and the Job log holds one line with the class and the action left. The Service adds 1 to `devops_cli_service_implement_failures_total` with the label `class` when a round reports the Job. A Job that left the Item with no result gets the class of the tail of its log.
A stop has a class (`roadmap/failure.py`, #3065). A stop site that knows its cause passes the class itself (#3476): the classes `no_change_in_fix`, `not_ticked`, `tests_lost`, `head_moved` and `output_cap` come from the step, and no rule makes them. For any other stop, the classifier is a pure function of the error text, the exit status, the refusal of a tool, the name of the check and the log of the check. It never reads the last message of the agent, which is a claim that no check verified. A failure that no rule matches is `ci_infra`. The stop comment starts with the failed check and the end of its log, then names the class, the action taken and the action left. It shows the last message of the agent as a claim that no check verified. The Job log holds one line with the class and the action left. The Service adds 1 to `devops_cli_service_implement_failures_total` with the label `class` when a round reports the Job. A Job that left the Item with no result gets the class of the tail of its log.

| Class | Default action | Meaning |
| :--- | :--- | :--- |
Expand All @@ -135,13 +136,18 @@ A stop has a class (`roadmap/failure.py`, #3065). The classifier is a pure funct
| `test` | `repair` | A test failed |
| `lint` | `repair` | A lint, format, hook or static check failed |
| `types` | `repair` | `mypy` or another type check failed |
| `plan_defect` | `amend` | The plan cannot be run as written: the step changed no file, left a task unticked, its inputs do not fit the window, or the model review of the stage found an open finding. A plan with an open finding stays in draft with `plan/needs-fix` and counts as no staged plan |
| `plan_defect` | `amend` | The plan cannot be run as written: a group step changed no file, its inputs do not fit the window, an archived change holds an unticked task, or the model review of the stage found an open finding. A plan with an open finding stays in draft with `plan/needs-fix` and counts as no staged plan |
| `premise_false` | `return` | The premise of the Item is false |
| `oom` | `raise_limit` | A process was killed for memory |
| `timeout` | `retry` | A command, a model call or the watch of the checks ran out of time |
| `refused_tool` | `wait` | A tool refused the calls of the agent, or came back as a retry too often |
| `conflict` | `wait` | A rebase or the pull request has a merge conflict |
| `ci_infra` | `retry` | The infrastructure failed, and every failure that no other class matches |
| `no_change_in_fix` | `wait` | A fix step changed no file, so the failed check is as it was. A person reads the failed check in the stop |
| `not_ticked` | `amend` | A task of the group is not ticked after the extra turn for the ticks |
| `tests_lost` | `retry` | The agent removed or renamed a test that existed at the start of the step |
| `head_moved` | `retry` | The agent moved HEAD, and a step makes the only commit |
| `output_cap` | `raise_limit` | A model reply reached the output cap of the step |

The Job runs these actions by itself:
- the fix rounds of `roadmap.implement.repair_rounds` for a failed check,
Expand Down
2 changes: 1 addition & 1 deletion k8s/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ kubectl -n devops logs -f job/<name>
9. To rotate a credential, update it in the keyring: `uv run devops config set service.webhook_secrets`, or, for the App, generate a new private key and run `uv run devops config set service.github_app.private_key --from-file <key.pem>`. Then run `uv run devops k8s push-secrets --only devops/devops-cli --rotate`. It restarts `roadmap-service`. Delete the old private key on the App's page after the restart.
10. Run one service per set of repos. While it runs, use `devops roadmap run --dry-run` (#981).
11. The Service keeps three files in `/home/devops/.data/roadmap/` on volume `roadmap-service-home`, beside the `schedule.json` of each repository: `service-halt.json` (GitHub refused the identity), `service-budget.json` (the GitHub requests of the last hour) and `service-failures.json` (the jobs that failed rounds in a row). A restart reads them back, so a restart does not clear a halt, the budget or a suspended job. A round that ends because the Service is stopping, for example in a rollout, does not count as a failed round: the count of its job stays as it was. The log line that suspends a job names the class of the error of each of its failed rounds in a row; the file keeps only the count, so a round that an earlier process counted reads as `unknown`. A rate limit that one request gets stops the requests of all workers until its wait ends. When GitHub refuses the identity, for example because the App's installation is suspended, the Service halts and logs `GitHub refused the identity`. To clear the halt after you fix the cause, remove the file and restart the Service: `kubectl -n devops exec deploy/roadmap-service -- rm /home/devops/.data/roadmap/service-halt.json`, then `kubectl -n devops delete pod -l app.kubernetes.io/name=roadmap-service`.
12. The Service's `/metrics` shows the budget and the suspended jobs (#2475): `devops_cli_service_budget_limit_requests` (the hourly budget), `devops_cli_service_budget_spent_requests` (the GitHub requests of the last hour), `devops_cli_service_budget_holds_total` (one count each time a hold begins), `devops_cli_service_job_suspended` (1 while a job of a repository, by `repo` and `row`, waits for new input after it failed 3 rounds in a row) and `devops_cli_service_implement_failures_total` (one count for each runner Job that left a stop, by the failure `class`, when a round reports the Job; #3065). Each GitHub request counts in `devops_cli_github_requests_total` under its `method`, the `repo` of the worker that sent it and the job `row` (`metrics`, `intake`, `refine`, `stage`, `implement`, `stage_ready` or `alternatives`); a request outside a worker or a row counts as `other`. To find what spent the budget, run `sum by (repo, row, method) (increase(devops_cli_github_requests_total{job="roadmap-service"}[1h]))` in Grafana Explore. A delivery of the App bot's own write counts as outcome `self` in `devops_cli_service_webhook_deliveries_total`.
12. The Service's `/metrics` shows the budget and the suspended jobs (#2475): `devops_cli_service_budget_limit_requests` (the hourly budget), `devops_cli_service_budget_spent_requests` (the GitHub requests of the last hour), `devops_cli_service_budget_holds_total` (one count each time a hold begins), `devops_cli_service_job_suspended` (1 while a job of a repository, by `repo` and `row`, waits for new input after it failed 3 rounds in a row) and `devops_cli_service_implement_failures_total` (one count for each runner Job that left a stop, by the failure `class`, when a round reports the Job; #3065; the 17 values of `class` are the classes in [docs/ROADMAP_WORKFLOW.md](../docs/ROADMAP_WORKFLOW.md), The failure classes, and a panel or rule matches no other value, #3476). Each GitHub request counts in `devops_cli_github_requests_total` under its `method`, the `repo` of the worker that sent it and the job `row` (`metrics`, `intake`, `refine`, `stage`, `implement`, `stage_ready` or `alternatives`); a request outside a worker or a row counts as `other`. To find what spent the budget, run `sum by (repo, row, method) (increase(devops_cli_github_requests_total{job="roadmap-service"}[1h]))` in Grafana Explore. A delivery of the App bot's own write counts as outcome `self` in `devops_cli_service_webhook_deliveries_total`.
13. A refine round writes at most 2 comments on one item in 24 hours. A round that finds 2 refine comments of the last 24 hours on an item leaves the item alone, with no model call and no comment. The item waits on a person and takes no place under the round's limit, so the round refines the next item. For each newest comment on the item that the cap leaves with no answer, the round records the time of that comment in the item's job record (`refine.capped_after`), logs `Refine left #<number> alone and wrote no comment`, and adds 1 to `devops_cli_roadmap_refine_comments_capped_total`. A later round that finds no newer comment does not log or count the item again. A person refines the item at the cap with `devops roadmap refine --item <number> --confirm`. Each Firecrawl search counts in `devops_cli_firecrawl_searches_total` by `result`: `ok`, the HTTP status of a refused search, or `error`. A failed search logs `A Firecrawl web search failed` with the status or the error class, and never the key or the query.
14. The row `alternatives` of the model lane runs after `refine`: on a first run, and 719 minutes after its last success. It runs `devops roadmap alternatives --confirm` for the repository. A round checks at most `roadmap.alternatives.first_pass_limit` items (20 by default) while an item has no check, and at most `roadmap.alternatives.limit` items (5 by default) after. The row runs about twice a day, so a first pass of 141 items takes about 4 days. A round takes first the items with no check, then the items whose check is older than `roadmap.alternatives.recheck_days` (30 by default) or whose text changed. A webhook makes the row due at no other time. The row changes no label and closes no issue. It does nothing, and logs `The alternatives check of <repo> is off`, for a private repository and when no Firecrawl key is set. If the check of an item fails, the row records the failure in the item's job record (`alternatives.failed_at` and `alternatives.failed_error`, the class of the error), writes the other checks and succeeds. The row fails, and counts toward the suspension after 3 failed rounds, only when it tried items and checked none. A round takes a failed item again after `roadmap.alternatives.retry_days` (3 by default). Each written check adds 1 to `devops_cli_roadmap_alternatives_total` by `verdict`: `covers`, `partly`, `none` or `not-applicable`. An item of the type `test`, `docs`, `refactor`, `chore`, `ci` or `perf`, and a `fix` with a Python traceback in its body, gets `not-applicable` with no model call; every other item must run a search before the check accepts a verdict, and gets one more turn to search. A `covers` verdict makes refine ask a person to adopt the tool or to keep the item with a reason. The item waits on a person until a reply answers the question, and Ready items with a new covering tool go back to New. Refine records the tool it asked about in the job record (`refine.alternatives_asked`). `devops roadmap run --dry-run` lists the row when it is due.
15. The row `stage` follows `refine` on the model lane (#2659). It runs `devops roadmap stage --confirm` in the model clone: it is due every 37 minutes, on a first run, and in a round where `refine` set an item Ready. It stages the Ready items that `roadmap.stage.filter` names, at most `roadmap.stage.limit` in a round, and splits a task group over `roadmap.stage.step_tokens`. Each task group has a kind (#3005): a `behavior` group has a failing test, and an `other` group has no test but a command or the steps of a manual check that prove it. The job sends a reply that breaks this rule back to the model once. It leaves out an item whose change folder is on the default branch or in its archive (#2714): a round reads that tree once with `git ls-tree`, so a merged staging pull request never makes a second one. The pull request it opens is a draft with the title `docs(openspec): plan #<issue> <summary>`. The job does not mark it ready: the row `stage_ready` does (step 18). Before it opens one, it checks each path of the plan (`reads`, `changes`, the code spans of the tasks and `verify`) against the tracked files of the commit it plans, read with one `git ls-files` for the round (#3010). A path that is no file there, and that no group up to its own creates, goes back to the model once with the files of the same name. When a later group creates the path, the problem names that group and tells the model to move it before the group that names the path (#3017). A second reply with a missing path stops the item, so no draft opens and the implement Job never meets a wrong path. `k8s/devops/configmap.example.yaml` holds the four settings, and `devops k8s deploy-stack --stack devops` applies them; each also has a variable, `DEVOPS_CLI_ROADMAP_STAGE_FILTER`, `DEVOPS_CLI_ROADMAP_STAGE_LIMIT`, `DEVOPS_CLI_ROADMAP_STAGE_STEP_TOKENS` and `DEVOPS_CLI_ROADMAP_STAGE_TOOLSET`. The setting `roadmap.stage.toolset` is `extended` by default (#3238): a plan run then has three tools more than the nine that read the staged commit. `references` counts a text in every file of the commit. `read_issue` and `find_issues` read issues and pull requests of the repository on GitHub, as GET requests with the token of the Service and no other permission. `base` leaves them out. Each item of a round counts once in `devops_cli_roadmap_stage_total` by its `result`: `staged`, `skipped`, `needs_split` or `failed`. The image carries the pinned OpenSpec and a Node runtime, so the job validates each change before it pushes: `kubectl -n devops exec deploy/roadmap-service -- openspec --version` prints the locked version.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-04
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Design

## The step knows the cause, so the step passes the class

A stop of the implement job used to carry a string. The classifier then read words in that string. The step knows the exact cause when it makes the stop, so the step passes a class, and the classifier is the fallback for a stop whose cause has no class of its own (a failed command, a hook, a provider error).

- `_Failure` (the exit checks of a step) and `_Run` (a turn of the agent) get a `failure_class`. `_attempt` copies the class to the new field `StepOutcome.failure_class`.
- `_stopped_by` copies it to `_StopError.failure_class`, with the check and the log that `_fix` has.
- `Run.stop` uses `_StopError.failure_class` when it is set. Else it classifies the evidence of the stop, which now includes the log of the check.
- The tier decision `_moves_tier` reads `_Run.failure_class`. The class is set once in `_run_turn`, so the decision and the stop comment use the same class. Before, `_moves_tier` classified `run.reason` a second time.

## The new classes and their default actions

| Class | Site | Default action | Why |
| :--- | :--- | :--- | :--- |
| `no_change_in_fix` | a fix step ends with no changed file | `wait` | The cause is unknown: the check may fail for a reason outside the code. A person reads the failed check, which the stop now names. #3460 owns recovery from a no-op group. |
| `not_ticked` | a task of the group is not ticked after the extra turn | `amend` | The plan cannot be run as written, as for `plan_defect` before. |
| `tests_lost` | the agent removed a test that existed | `retry` | A new run can keep the test. The class was `ci_infra`, whose action is `retry`. |
| `head_moved` | the agent moved HEAD | `retry` | The same reason. |
| `output_cap` | a reply reached the output cap | `raise_limit` | The cap is a limit of the run. |

A step with no changed file in a **group** step stays `plan_defect`: the plan asked for a change that the code does not need, and the amend path of #3057 reads that class. Only the fix step gets `no_change_in_fix`.

## The classifier reads the failure, not the claim

`FailureEvidence` loses the field `agent`. The last message of the agent is a claim that no check verified, so no rule reads it. `_PREMISE` reads the text of the failure only. `_PLAN` loses `changed no file` and `task of the group is not ticked`, as both stops are typed now. A new field `log` holds the log of the check that failed. The rules for the checks of the item read the text, then the log.

Rejected: keep `agent` and weight it below the text. The 05:14Z stop of #2116 shows that any read of the claim can give `premise_false` for a fix step that failed for another reason. A rule that never reads the claim cannot make that error.

## The check and its log

`_StopError` gets `check_log`. `_fix(check, log)` and the scoped-check stop pass the name of the check and the log. `Run.stop` masks the log, keeps its last `CONST_ROADMAP_IMPLEMENT_CHECK_LOG_CHARS` characters, shows it in the comment, and writes both to the record keys `implement.check` and `implement.check_log`. A retry clears both keys with the stop. The table shows the check name as the last failing command, as it did for a failed check of the pull request.

Rejected: put the log in the reason. The reason is the text of the failure, and the classifier reads it. A separate field keeps the log out of the cause rules (a test name with `timeout` in it would give the class `timeout`).

## The order of the comment

The comment starts with the failed check: the check that the stop names (a fix step and the scoped checks name one), else the last command of the step that did not exit 0. The log of the check follows when the stop has one. Then come the class lines, the table, the reason, the last message labeled as a claim that no check verified, and the diff. The class lines stay before the reason, as `roadmap-implement-job` requires. The old order started with the class and showed the claim with no label.

## The report reads the item again

`_report` reads the log of the Job, then reads the item again, then decides. A stop that the runner wrote while the log was read has the Status Blocked and a recorded class, so `_settles_as_stop` is false and the recorded class stands.

## The metric labels

`FailureClass` values are the label values. A test reads each file of `k8s/` that names the metric and holds that every `class` matcher in it names a class of the taxonomy. No panel or alert reads the metric today, so the test passes with no match and fails when a later panel uses a wrong value.
Loading
Loading