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
2 changes: 1 addition & 1 deletion CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ The long-running devops-cli deployment that runs the roadmap jobs when they are
_Avoid_: runner, bot, daemon, worker

**Lane**:
One of the Service's three paths for a repository's jobs, each running one round at a time. The triage lane runs intake. The model lane runs refinement, the retitle job, staging and the alternatives check, which call a model; the retitle row calls the model of the triage task, and runs before the stage row, every 61 minutes, so the stage job reads the shortened titles and the corrected title types (`security` becomes `fix(security)`). The status lane runs the metrics, implement, stage_ready, release_comments, github_status and cloudflare_status rows, which call no model; the stage_ready row marks a staged draft pull request ready when its checks have passed, and the release_comments row comments the version, and the time it runs, on the issues of a release, and the github_status and cloudflare_status rows each read one status page, so a failed read fails its own row. All three get every trigger, and a round in one never waits for a round in the others.
One of the Service's three paths for a repository's jobs, each running one round at a time. The triage lane runs intake. The model lane runs refinement, the retitle job, staging and the alternatives check, which call a model; the retitle row calls the model of the triage task, and runs before the stage row, every 61 minutes, so the stage job reads the shortened titles and the corrected title types (`security` becomes `fix(security)`). The status lane runs the metrics, implement, stage_ready, release_comments, github_status, cloudflare_status and pr_conflicts rows, which call no model; the stage_ready row marks a staged draft pull request ready when its checks have passed, and the release_comments row comments the version, and the time it runs, on the issues of a release, the github_status and cloudflare_status rows each read one status page, so a failed read fails its own row, and the pr_conflicts row comments once on a ready delivery pull request that has merge conflicts with the default branch. All three get every trigger, and a round in one never waits for a round in the others.
_Avoid_: queue, track, worker

## Code review
Expand Down
3 changes: 2 additions & 1 deletion docs/TELEMETRY.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ writes by name.
| `devops_cli_roadmap_alternatives_unchecked_items` | Gauge | `1` | Open items that the alternatives check can take and has not checked, by repo. An item in the retry delay after a failed check counts. An item in progress or from an author with no write access does not. The Service sends it at the start of each round of the check. |
| `devops_cli_roadmap_alternatives_oldest_check_age_seconds` | Gauge | `s` | Age of the oldest alternatives check among the items that the check can take, by repo. The age is the time since the check was written. Not sent while no such item has a check. |
| `devops_cli_roadmap_alternatives_searches` | Histogram | `1` | Web searches that a provider answered for one alternatives check, by verdict. One observation for each check that the alternatives job writes. A search that no provider answered does not count. A check that the job skips for its item class runs no search and observes 0. |
| `devops_cli_roadmap_conflicted_pulls` | Gauge | `1` | Open ready delivery pull requests that GitHub reports with merge conflicts against the default branch, by repo. The Service sends it at the end of each round of the row pr_conflicts. A pull request whose mergeable state GitHub has not computed does not count. |
| `devops_cli_roadmap_page_fetches_total` | Counter | `1` | Calls of the tool fetch_page in refine's investigation and in the alternatives check, by toolset (refine or alternatives) and result: ok for a page whose text the tool returned, refused for a URL that the tool refused before any request (not https, not named by a search result or by the item text, or not on a public host), limit for a call over the limit of fetches for one item, and error for a fetch that failed. The fetches that reach the Crawl4AI service also count in devops_cli_crawl4ai_fetches_total. |
| `devops_cli_roadmap_stage_plan_record_total` | Counter | `1` | Uses of the plan file of the stage job, by result: hit for a plan that the job read from the file and so sent the planner no request, miss for an item with no file of its key, and written for a plan that the job wrote to the file. A miss that plans adds one to miss and one to written. The hit rate is hit divided by the sum of hit and miss. |
| `devops_cli_decision_point_total` | Counter | `1` | Decisions of a registered decision point (ADR 0020), by point, resolver (rule, model or fallback), band (continue, review or flag, or none for a fallback) and mode (shadow or on). A point in the mode off, and a point with no rule while ai.decision_model is empty, count nothing. A point writes only the resolvers that it has: one resolver besides the fallback gives 8 series, and a rule and a model give 14. The registry refuses a catalogue of more than 60 series. The registry holds stage.verify_screen, a model and no rule: 8 series. The decision record and the outcome record of each decision are log lines that share an identifier, and their join gives the false-clear rate of a point. |
Expand All @@ -112,7 +113,7 @@ writes by name.
| `devops_cli_roadmap_item_age_seconds` | Gauge | `s` | Age of the oldest open roadmap item in each status, by repo, state and plan. The state is the status. Plan is true when the item holds a stage pull request. That pull request waits for a person. The age is the time since the status label was set. Zero when no item is in the pair. |
| `devops_cli_roadmap_oldest_item_number` | Gauge | `1` | Issue number of the oldest open roadmap item in each pair of repo, state and plan. The pair is the one that devops_cli_roadmap_item_age_seconds reports. Zero when no item is in the pair. |
| `devops_cli_roadmap_claim_age_seconds` | Gauge | `s` | Age of the oldest claim on an open roadmap item, by repo. The age is the time since the owner label was set. Zero when no open item holds a claim. |
| `devops_cli_roadmap_row_seconds` | Histogram | `s` | Seconds that a roadmap row took to run, one sample for each run, by repo, row and result: success, error or stopped. A row that is not due, that the failure ledger suspends, or that a clone failure keeps from running adds no sample. One repository adds at most 33 series: 11 rows and 3 results. |
| `devops_cli_roadmap_row_seconds` | Histogram | `s` | Seconds that a roadmap row took to run, one sample for each run, by repo, row and result: success, error or stopped. A row that is not due, that the failure ledger suspends, or that a clone failure keeps from running adds no sample. One repository adds at most 36 series: 12 rows and 3 results. |
| `devops_cli_roadmap_step_seconds` | Histogram | `s` | Seconds that one step of a roadmap job took, one sample for each call of the step, by repo, row, step and result: ok or error. The labels are those of devops_cli_roadmap_row_seconds with a step. The stage row sends select, plan, gate, review and apply. The implement row sends checks, publish and watch with the same labels (#4067): checks is one call of the scoped checks with its fix rounds, publish is the push of the branch with the scoped checks left out, and watch is one watch of the checks of the pull request, with the result error when a check failed. The push of a stop is not timed. A refused reply adds a second plan sample and a second gate sample, so a sample is one call and not one item. A gate that finds a problem has the result ok. A job with no review model adds no review sample. One repository adds at most 10 series for the stage row (5 steps and 2 results) and 6 series for the implement row (3 steps and 2 results): 16 series. The histogram buckets add none. |
| `devops_cli_roadmap_intake_candidates_total` | Counter | `1` | Candidates that an intake round decided, one count for each candidate, by repo and result: placed, duplicate, skipped or failed. A candidate that is placed and that the model flags as a possible duplicate counts as duplicate and not as placed: intake still places it. A candidate whose item a person changed since the plan counts as skipped, and the next plan decides it again. A candidate whose write failed counts as failed. A rate limit or an authentication error ends the round, and the candidates after it count nothing. The round sends 0 for the four results before its first candidate. One repository adds 4 series. |
| `devops_cli_roadmap_jev_completeness_total` | Counter | `1` | Decisions of the Jev completeness check of a draft pull request, one count for each check, by outcome: passed (Jev found each acceptance criterion delivered), held (Jev doubts a criterion or the tests, so the draft stays a draft), error (Jev gave no answer, so the draft stays a draft) or skipped (the issue lists no criterion or too many, or the diff is too large). A check adds 1 to its outcome and 0 to the other three, so the four series exist from the first check. The check runs only when the setting roadmap.stage.jev_completeness is true. Series: 4 for each scraped pod. |
Expand Down
5 changes: 3 additions & 2 deletions k8s/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
schema: spec-driven
created: 2026-11-11
skip_specs: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Design

## Decisions

- **A new status-lane row, last.** The status lane runs its rows one at a time, and a row waits for the rows before it. The row reads GitHub once for each open pull request that is not a draft, so it goes after `cloudflare_status` and delays no other row. A failed read fails this row only, as the status reads do (#4052).
- **A comment, not a label.** A comment notifies the people who watch the pull request and needs no repository setting. A `pr/conflicted` label needs a label in each managed repository, sends no notification, and collides with the label families that hold the item fields (ADR 0016). `GitHubClient.comment_on_pull` posts the comment through the GitHub session.
- **No action for a clean pull request that is behind.** The issue design asked for an update-branch request. A catch-up update starts every required check again, and docs/SDLC.md (Phase 1) and the owner requirement of 2026-11-11 forbid it for an open pull request. GitHub merges a branch that is behind unless a ruleset requires an up-to-date branch, and the readiness verdict already treats `behind` as no blocker.
- **Read the candidates through the store and the session.** `store.open_pulls()` gives the open pull requests and their draft flag, so a draft costs no read. `GitHubClient.get_pull_status` reads the one pull request, and `PullStatus` now holds `mergeable`, `mergeable_state`, `base_ref` and `default_branch`. The listing holds no `mergeable` field, so the read of each candidate is necessary. `store.item` reads the one issue that the body closes.
- **A delivery pull request closes exactly one open Item.** `closing_numbers` of `release_feed.py` reads `Closes`, `Fixes` or `Resolves` at the start of a line. A plan pull request closes nothing, and the release pull request closes nothing, so the row skips them.
- **One conflict judgment.** `merge_conflict(mergeable, mergeable_state)` in `merge_readiness.py` returns True for a conflict, None for a state that GitHub has not computed, and False else. The readiness verdict, the implement watch and the row call it, so the three cannot disagree.
- **A ledger beside `schedule.json`.** `pr_conflicts.json` maps the number of each conflicted delivery pull request to the head commit of its comment. A round drops the entry of a pull request with no conflict, keeps the entry of an unknown state, and drops the entries of pull requests that it no longer judges. The round writes the ledger also when a read fails, so a comment that it posted is not posted again. This follows `release_comments.json`.
- **Interval 19 minutes.** Each interval of the Service is a prime that no other row uses (#2965), and 19 is free. GitHub computes the mergeable state after a read asks for it, so a new conflict shows within two rounds, at most 38 minutes. A round costs about two reads for each ready pull request.
- **A gauge, no dashboard.** The row sends `devops_cli_roadmap_conflicted_pulls` by `repo`, as `record_coverage` sends the alternatives gauges.

## Rejected alternatives

- **Send `PUT pulls/{n}/update-branch` for a clean pull request that is behind.** Evidence: docs/SDLC.md, Phase 1: "A pull request that is open needs no rebase to catch up with `main`." The owner plan of 2026-11-11 counted 49 catch-up pushes that started runs in one week. The update also refuses a conflict, so it cannot fix the case that the row reports.
- **eps1lon/actions-label-merge-conflict.** It needs a workflow and a label in each managed repository, has no delivery filter, does not use the judgment of `devops pr check-readiness`, and sends no gauge.
- **Put the check in the `stage_ready` row.** A failed conflict read would then fail the row that marks drafts ready, and the row mixes two jobs.
- **Call `assess_merge_readiness` for each pull request.** It also reads the checks, the review threads and the changed files, which the judgment does not need.
- **One GraphQL query for all pull requests.** It needs a second definition of a conflict (the GraphQL enum names) and leaves the REST payload that `check-readiness` judges.
- **Find an earlier comment by a hidden marker instead of a ledger.** It needs a comment listing for each pull request, and it cannot tell a conflict that returns after a clean round at the same head commit.
- **Post the comment through `store.comment`.** The store writes comments on issues, and the in-memory store refuses a pull request number. The session client is the interface for a pull request comment.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Proposal: #4027

## Why

The roadmap Service marks a delivery pull request ready when its checks pass. A later merge into the default branch can make a conflict with that open pull request, and GitHub sends no event or alert for the new conflict. The pull request then stays blocked until a person opens its page or runs `devops pr check-readiness`. Pull request #3961 had this problem. Closes #4027.

## What Changes

- A new status-lane row, `pr_conflicts`, runs after `cloudflare_status`. It is due every 19 minutes and on a first run, calls no model and needs no clone.
- A round lists the open pull requests and reads each one that is not a draft. It takes only a delivery pull request: one into the default branch whose body closes exactly one issue, and that issue is an open Item.
- A conflict gets one comment that names the default branch and the head commit. The ledger `pr_conflicts.json` beside `schedule.json` keeps the head commit of each conflict that has its comment. The row comments again for a new head commit, or for a conflict that returns after a round with no conflict.
- A clean pull request that is only behind the default branch gets no action. The row sends no update-branch request. The issue design asked for a catch-up update, but docs/SDLC.md (Phase 1) and the owner requirement of 2026-11-11 forbid a catch-up update of an open pull request: every push starts the required checks again.
- A mergeable state that GitHub has not computed changes nothing. The next round reads it again.
- `devops pr check-readiness`, the implement watch and the row judge a conflict with one function, `merge_conflict`.
- The row sends the gauge `devops_cli_roadmap_conflicted_pulls`, by `repo`, at the end of each round.
- The Service behavior changes, so the change carries a spec delta.

## Capabilities

- `roadmap-pr-conflicts` (new): the row, its candidates, its comments, its ledger, its gauge and its failures.
- `pr-merge-readiness`: one conflict judgment for the readiness verdict and the row.
- `roadmap-implement-job`: the status lane holds `pr_conflicts` last.
- `metric-instruments`: the due table has 12 rows, so `devops_cli_roadmap_row_seconds` adds at most 36 series for one repository.

## Impact

- Code: `src/devops_cli/roadmap/pr_conflicts.py` (new), `src/devops_cli/roadmap/run.py`, `src/devops_cli/github/merge_readiness.py`, `src/devops_cli/github/client.py` (`PullStatus` holds the merge state, the base branch and the default branch), `src/devops_cli/roadmap/implement/implement_pull.py`, `src/devops_cli/telemetry/instruments.py`, the constants, the defaults and the messages.
- GitHub requests: one listing of the open pull requests, one read of each open pull request that is not a draft, one read of the issue that a candidate closes, and one comment for each new conflict, every 19 minutes.
- Documents: k8s/README.md, CONTEXT.md, docs/TELEMETRY.md.
- No setting, manifest, ConfigMap or Secret changes. The new ledger file is written on the volume of the Service at the first round.
- The change fits one pull request.

## Feasibility

- The REST read of one pull request returns `mergeable`, `mergeable_state`, `base.ref` and `base.repo.default_branch` (https://docs.github.com/rest/pulls/pulls#get-a-pull-request). Command output of 2026-11-11 for an open pull request of this repository: `{"base":"main","default":"main","draft":false,"mergeable":null,"mergeable_state":"unknown"}`. So a read can return the unknown state while GitHub computes it, and the row must wait for the next round.
- The listing of the open pull requests holds the body and the base, but no `mergeable` field (command output: `{"default":"main","has_body":true,"has_mergeable":false}`). So the row reads each candidate on its own, as `release/merge_candidate.py` does.
- GitHub has no webhook event for a conflict that a merge into the base branch makes, so the row polls (ADR 0003).
- `GitHubClient.comment_on_pull` posts a comment on the issue of a pull request, and `closing_numbers` of `release_feed.py` reads the closing keywords of a body.

## Existing Tool Considered

- eps1lon/actions-label-merge-conflict (https://github.com/eps1lon/actions-label-merge-conflict), a maintained GitHub Action, labels a pull request with conflicts and can comment on it after a push to the base branch. It needs a workflow file in each managed repository and a `dirtyLabel` label, and a new label family collides with the label families that hold the item fields (ADR 0016). It does not filter delivery pull requests, does not use the conflict judgment of `devops pr check-readiness`, and sends no gauge to the Service's metrics. The Service already polls each managed repository with its own identity, so a row adds no workflow, label or token.
- GitHub's native mergeable state is the source of the judgment. The row adds no other tool.
- Cost to build: about 18,000 tokens to build, about 4,000 tokens a year to keep and fix, and about 2 hours of elapsed time, as the issue estimates.
- Internal code that the change deletes: the copy of the conflict states in `implement_pull.py` (`_CONFLICT_STATES`) and the inline conflict test in `merge_readiness.py`, which now call `merge_conflict`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## MODIFIED Requirements

### Requirement: The row seconds histogram is declared and documented
`INSTRUMENTS` SHALL hold `devops_cli_roadmap_row_seconds` as a histogram with the unit `s` and the attributes `repo`, `row` and `result`. `docs/TELEMETRY.md` SHALL list it. One repository SHALL add at most 36 series: 12 rows x 3 results, and the buckets add no series.

#### Scenario: The registry and the document list the histogram
- **WHEN** a test reads `INSTRUMENTS` and `docs/TELEMETRY.md`
- **THEN** both list `devops_cli_roadmap_row_seconds`, and the registry gives the kind histogram and the unit `s`

#### Scenario: The series of one repository are bounded
- **WHEN** a test counts the rows of the due table and the results of a job
- **THEN** it finds 12 rows and 3 results
Loading