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 .agents/skills/devops-pr-ci/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ Do not run bare `gh` commands. The `devops ci` and `devops pr` commands enforce
3. Run `uv run devops pr monitor <number>` to wait until the remote checks settle.
4. Run `uv run devops pr threads list <number> --unresolved-only` to inspect open review threads.
5. Run `uv run devops pr threads reply <thread_id> "<body>"` to reply in a review thread.
6. Run `uv run devops pr ready <number>` to mark the pull request ready after all checks pass. A pull request with no checks has nothing to wait for when no workflow can start a check on it, because no workflow runs on pull requests or because branch and path filters skip it: the command says so and marks it ready with no `--force`.
6. Always run `uv run devops pr ready <number>` to mark the pull request ready when all checks pass and no agent work remains on it. A pull request with no checks has nothing to wait for when no workflow can start a check on it, because no workflow runs on pull requests or because branch and path filters skip it: the command says so and marks it ready with no `--force`.
2 changes: 1 addition & 1 deletion .claude/skills/devops-pr-ci/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ Do not run bare `gh` commands. The `devops ci` and `devops pr` commands enforce
3. Run `uv run devops pr monitor <number>` to wait until the remote checks settle.
4. Run `uv run devops pr threads list <number> --unresolved-only` to inspect open review threads.
5. Run `uv run devops pr threads reply <thread_id> "<body>"` to reply in a review thread.
6. Run `uv run devops pr ready <number>` to mark the pull request ready after all checks pass. A pull request with no checks has nothing to wait for when no workflow can start a check on it, because no workflow runs on pull requests or because branch and path filters skip it: the command says so and marks it ready with no `--force`.
6. Always run `uv run devops pr ready <number>` to mark the pull request ready when all checks pass and no agent work remains on it. A pull request with no checks has nothing to wait for when no workflow can start a check on it, because no workflow runs on pull requests or because branch and path filters skip it: the command says so and marks it ready with no `--force`.
2 changes: 1 addition & 1 deletion .kilocode/skills/devops-pr-ci/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ Do not run bare `gh` commands. The `devops ci` and `devops pr` commands enforce
3. Run `uv run devops pr monitor <number>` to wait until the remote checks settle.
4. Run `uv run devops pr threads list <number> --unresolved-only` to inspect open review threads.
5. Run `uv run devops pr threads reply <thread_id> "<body>"` to reply in a review thread.
6. Run `uv run devops pr ready <number>` to mark the pull request ready after all checks pass. A pull request with no checks has nothing to wait for when no workflow can start a check on it, because no workflow runs on pull requests or because branch and path filters skip it: the command says so and marks it ready with no `--force`.
6. Always run `uv run devops pr ready <number>` to mark the pull request ready when all checks pass and no agent work remains on it. A pull request with no checks has nothing to wait for when no workflow can start a check on it, because no workflow runs on pull requests or because branch and path filters skip it: the command says so and marks it ready with no `--force`.
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
3. **Use an open tool before you build.** Name the tool or library that covers the need. To build instead, write the cost in tokens and time. This rule outranks every other convention.
4. **Test new behavior first.** Prove other changes with a command.
5. **Pass the checks.** Never use `--no-verify`. Never lower a security or quality threshold; only the owner can allow it ([exceptions](SECURITY.md#a-finding-with-no-fix)). A check that averages over 5 min + 1 min tolerance is a P0 bug.
6. **Open every pull request as a draft** with `devops pr create`, and mark it ready only after the checks pass.
6. **Open every pull request as a draft** with `devops pr create`. Always mark it ready when checks pass and no agent work remains.
7. **Use `devops gh` and `devops pr`.** Never run bare `gh`. Run one `devops ai` call at a time, only when no file or deterministic check can answer ([ask-jev](.agents/skills/ask-jev/SKILL.md)).
8. **Write as merged.** Make no commit or pull request that only updates tracking. If a change makes a document wrong, fix it in the same pull request.
9. **Write prose in ASD-STE100** ([rules](src/devops_cli/ai/tasks/style_ste100.md)).
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ In bash, `${=F}`, `${(f)...}` and `print -r --` fail. The forms `printf '%s'`, `
- **Drafts First**:
- Open every pull request with `devops pr create`. It always opens a draft.
- `devops pr create` adds the labels that the title gives, with the rule of intake: `fix(ai): ...` gets `type/bug` and `scope/ai`. When a label cannot be added, the command names the pull request and the labels, and exits 1. The pull request stays open.
- When all checks pass, mark the pull request ready with `devops pr ready <pr-number>`. This is the only way out of the draft.
- Always mark the pull request ready with `devops pr ready <pr-number>` when all checks pass and no agent work remains on it. This is the only way out of the draft. Agent work is each step that an agent does or will do on the pull request. Examples are a build, a review, a repair, a reply to a review thread, and a check of the report of a builder. Keep the draft while such work remains. The agent that does the last step marks the pull request ready.
- `devops pr create` checks the title and the body before it opens anything, with the rules below, and exits 1 with every problem when one fails. `devops pr describe <issue> --summary "<summary>"` builds a title and a body that pass the check: the type and the scope come from the issue, the "why" from the proposal of the change folder, and it cuts no text. The module `src/devops_cli/roadmap/pull_form.py` holds the rules. The rules of the body apply where the base branch holds `openspec/config.yaml`. In a repository without it, such as an infrastructure repository, the command checks the title only, and `--repo` with `--head` opens the pull request from a checkout of devops-cli.
- **The Title Is the Changelog Line**:
The pull request title is a Conventional Commit, and the `Semantic PR title` check enforces it. The squash commit takes the title as its subject, and GitHub adds ` (#<number>)` to it. release-please writes the changelog from these titles, so write the title for a reader of the changelog. The scope is one of the `scope/*` labels of `.github/labels.yml`, or `main` for the release pull request, and the `Semantic PR title` check and `devops pr create` refuse another scope. To use a new scope, declare its label in `.github/labels.yml` and add the scope to the `scopes` list of `.github/workflows/pr-title.yml` in the same pull request. The summary, the text after `<type>(<scope>): `, has at most 60 characters (an emoji counts as two, as the check counts UTF-16 units), and both checks refuse a longer one, and a summary that ends with `...` or is a placeholder such as `x`. A hidden type (`docs`, `test`, `build`, `ci`, `style` or `chore`) ships no release, so the title check refuses it when the pull request changes runtime code under `src/devops_cli/` that is not document data; use `feat`, `fix`, `perf`, `refactor` or `revert` for that code (#5224). The summary states the effect of the change. Put the evidence and the steps in the body or in the change folder:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-25
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Design

## Decisions

1. **The duty is in rule 6, and the detail is in `CONTRIBUTING.md`.** `AGENTS.md` is near its cap, and it routes "name a branch or a pull request" to `CONTRIBUTING.md`. Rule 6 holds one new sentence. `CONTRIBUTING.md` says what agent work is and which agent marks the pull request ready.
2. **"The checks pass", not "the checks are complete".** The issue quotes the owner direction with "its checks are complete". `devops pr ready` exits 1 for a failed check (`openspec/specs/pr-merge-readiness/spec.md`), and rule 5 says "Pass the checks". The rule names the state in which the command works.
3. **The agent that does the last step marks the pull request ready.** When a second agent checks the report of a builder, that check is agent work. The builder leaves the draft, and the second agent marks it ready after its check.

## Rejected alternatives

- **The sentence "Always mark it ready when all agent work on it is complete and its checks pass." in `AGENTS.md`**: rejected, because the file then has 4,512 characters, and `test_agents_md_stays_within_character_budget` fails at the cap of 4,500 (`CONST_AGENTS_MD_MAX_CHARS`). A higher cap lowers a quality threshold.
- **A `devops pr monitor` that marks the pull request ready when the checks pass**: rejected, because the command reads only GitHub and cannot know that a review or a repair by an agent remains. Bot pull requests have their own row for this step (`openspec/specs/roadmap-stage/ready/spec.md`).
- **A change of Stage 2 in `docs/SDLC.md`**: rejected, because the text there already gives the duty: "Once all work is completed, CI checks pass, and comments are addressed, agents convert the draft pull request to ready for review" (`docs/SDLC.md`, "Two-Stage PR Review Lifecycle").
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Proposal: #7217

## Why

Issue #7217: rule 6 of `AGENTS.md` says "mark it ready only after the checks pass". The rule gives a limit and no duty, so an agent can complete its work, see the checks pass, and leave the pull request as a draft. The rule also does not name agent work, so a pull request can become ready while a review, a repair or a check of the report of a builder still runs. The owner direction of 2026-11-25 is that agents always mark a draft ready when all agent work on it is complete and its checks are complete.

## What Changes

- Rule 6 of `AGENTS.md`: "Always mark it ready when checks pass and no agent work remains."
- Rule 6 of `src/devops_cli/templates/AGENTS.md.j2`, which `devops ai agents` renders: the same duty with the command `devops pr ready <pr_number>`. The snapshot of the implement step that holds the rendered template changes with it.
- `CONTRIBUTING.md`, "Drafts First": the duty, what agent work is, and which agent marks the pull request ready.
- Step 6 of the `devops-pr-ci` skill in its three roots, and the apply guidance of `openspec/config.yaml`: the same condition.
- One test in `tests/invariants/test_agents_md.py`.
- The text that `devops ai agents` writes is observable, so the change carries a delta for `agent-instructions`. It fits in one pull request.

## Capabilities

### Modified Capabilities
- `agent-instructions`: rule 6 gives the duty to mark a draft ready when the checks pass and no agent work remains.

## Impact

- An agent session marks its own complete draft ready and does not leave it for a person.
- A draft stays a draft while a review, a repair or a check of the report of a builder remains, so a person does not merge a pull request that still changes.
- No command changes. `devops pr ready` refuses a pull request while a check runs or fails, as before.

## Feasibility

Confirmed in the worktree of the change:
- `AGENTS.md` had 4,478 characters against the cap of 4,500 (`CONST_AGENTS_MD_MAX_CHARS`, `test_agents_md_stays_within_character_budget` in `tests/invariants/test_agents_md.py`). With the new sentence it has 4,497.
- `test_the_template_holds_each_rule_of_agents_md_that_is_not_only_for_devops_cli` compares the rule titles of `AGENTS.md` and the template. The title of rule 6 does not change.
- `tests/invariants/test_skills.py` needs the same text of `devops-pr-ci/SKILL.md` in `.agents/skills`, `.claude/skills` and `.kilocode/skills`.
- `openspec/specs/pr-merge-readiness/spec.md` ("pr ready asks the readiness function"): `devops pr ready` exits 8 while a check runs and 1 when a check fails. The instruction cannot make a pull request with a failed check ready.

## Existing Tool Considered

`devops pr ready` and its draft readiness function cover the state of the checks. No tool can know that no agent work remains in a session, so that part is an instruction. No code is built.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## ADDED Requirements

### Requirement: The draft rule gives the duty to mark a draft ready
Rule 6 of `AGENTS.md` and rule 6 of the `AGENTS.md` that `devops ai agents` generates SHALL tell an agent to always mark a draft pull request ready when the checks pass and no agent work remains. `CONTRIBUTING.md` SHALL say what agent work is, and the `devops-pr-ci` skill SHALL give the same condition with `devops pr ready` in each skill root.

#### Scenario: Rule 6 holds the duty
- **WHEN** the invariant test reads rule 6 of `AGENTS.md` and rule 6 of the `AGENTS.md` generated for devops-cli
- **THEN** each holds "Always mark it ready" and "no agent work remains"

#### Scenario: The routed documents give the condition
- **WHEN** the invariant test reads `CONTRIBUTING.md` and `devops-pr-ci/SKILL.md` in `.agents/skills`, `.claude/skills` and `.kilocode/skills`
- **THEN** `CONTRIBUTING.md` says what agent work is, and each skill copy holds "Always run `uv run devops pr ready <number>`" with "no agent work remains"
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Tasks

## 1. Invariant test of the draft rule

Kind: other

- [x] 1.1 Add `test_the_draft_rule_marks_a_draft_ready_when_no_agent_work_remains` to `tests/invariants/test_agents_md.py`. It reads rule 6 of `AGENTS.md`, rule 6 of the generated `AGENTS.md`, `CONTRIBUTING.md` and the three copies of `devops-pr-ci/SKILL.md`, and it fails before the text changes.
- Verification: `$ uv run devops ci test tests/invariants/test_agents_md.py`

## 2. Instructions

Kind: other

- [x] 2.1 Change rule 6 of `AGENTS.md` and of `src/devops_cli/templates/AGENTS.md.j2`, and regenerate the snapshot of `tests/roadmap/implement/test_roadmap_implement_step.py`, which holds the rendered template.
- Verification: `$ uv run devops ci test tests/invariants/test_agents_md.py tests/commands/test_instruction_generator.py tests/roadmap/implement/test_roadmap_implement_step.py`
- [x] 2.2 Change "Drafts First" of `CONTRIBUTING.md`, step 6 of `devops-pr-ci/SKILL.md` in the three skill roots, and the apply guidance of `openspec/config.yaml`.
- Verification: `$ uv run devops ci test tests/invariants/test_agents_md.py tests/invariants/test_skills.py`
- [x] 2.3 Run the document, OpenSpec and lint gates.
- Verification: `$ uv run devops ci --check --only docs,openspec,lint`

## Workflow follow-up

- Pending a person: review the diff in tuicr (tuicr -r <base>..HEAD).
2 changes: 1 addition & 1 deletion openspec/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ operations:
apply:
guidance:
- >-
Implement on a topic branch as AGENTS.md requires: test-first for a group of new behavior, and the verification of the group for any other group. Tick a task in the commit that completes it. Push through the pre-push hook, and mark the pull request ready only after its required checks pass. Do not run sync. The pull request that closes the issue archives its own change as its last commit. Run `uv run devops openspec archive <change>` after every task is ticked. It archives the change, then validates every spec and change.
Implement on a topic branch as AGENTS.md requires: test-first for a group of new behavior, and the verification of the group for any other group. Tick a task in the commit that completes it. Push through the pre-push hook. Always mark the pull request ready when its checks pass and no agent work remains. Do not run sync. The pull request that closes the issue archives its own change as its last commit. Run `uv run devops openspec archive <change>` after every task is ticked. It archives the change, then validates every spec and change.
11 changes: 11 additions & 0 deletions openspec/specs/agent-instructions/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,14 @@ Rule 2 of `AGENTS.md`, `src/devops_cli/templates/AGENTS.md.j2`, and the `devops-
- **WHEN** an agent inspects Rule 2 of `AGENTS.md` or `.agents/skills/devops-roadmap/SKILL.md`
- **THEN** both tell the agent never to return a tracker (`type/epic` or sub-issues) and to work its open sub-issues or related issues instead
- **AND** `AGENTS.md`, `src/devops_cli/templates/AGENTS.md.j2`, and the three skill roots pass all `tests/invariants/test_agents_md.py` and `tests/invariants/test_skills.py` checks

### Requirement: The draft rule gives the duty to mark a draft ready
Rule 6 of `AGENTS.md` and rule 6 of the `AGENTS.md` that `devops ai agents` generates SHALL tell an agent to always mark a draft pull request ready when the checks pass and no agent work remains. `CONTRIBUTING.md` SHALL say what agent work is, and the `devops-pr-ci` skill SHALL give the same condition with `devops pr ready` in each skill root.

#### Scenario: Rule 6 holds the duty
- **WHEN** the invariant test reads rule 6 of `AGENTS.md` and rule 6 of the `AGENTS.md` generated for devops-cli
- **THEN** each holds "Always mark it ready" and "no agent work remains"

#### Scenario: The routed documents give the condition
- **WHEN** the invariant test reads `CONTRIBUTING.md` and `devops-pr-ci/SKILL.md` in `.agents/skills`, `.claude/skills` and `.kilocode/skills`
- **THEN** `CONTRIBUTING.md` says what agent work is, and each skill copy holds "Always run `uv run devops pr ready <number>`" with "no agent work remains"
2 changes: 1 addition & 1 deletion src/devops_cli/templates/AGENTS.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ It uses {% for language, version in toolchains %}{{ language }}{% if version %}
4. **Test new behavior first.** Write the failing test before the code. Prove any other change with a command.{% if python %} A fix pull request shows that its new tests fail on the base with `devops ci fail-to-pass --base <ref>`.{% endif %}

5. **Pass the checks.**{% if check_commands %} Run these before each push: {% for command in check_commands %}`{{ command }}`{% if not loop.last %}, {% endif %}{% endfor %}.{% endif %} Push only when the checks pass. Never lower a threshold unless the owner allows it.
6. **Open every pull request as a draft.** Agents open every pull request with `devops pr create`, which always opens a draft. Watch it with `devops pr monitor <pr_number>`, and mark it ready with `devops pr ready <pr_number>` after the checks pass. Reply to each review comment in its thread. Copilot reviews a pull request only when a person requests it.
6. **Open every pull request as a draft.** Agents open every pull request with `devops pr create`, which always opens a draft. Watch it with `devops pr monitor <pr_number>`. Always mark it ready with `devops pr ready <pr_number>` when the checks pass and no agent work remains. Reply to each review comment in its thread. Copilot reviews a pull request only when a person requests it.
7. **Use `devops gh` and `devops pr`.** Never run bare `gh`: `devops` paces each request against the rate limit. Run one `devops ai` call at a time.
8. **Write as merged.** Make no commit that only updates tracking. If your change makes a document wrong, fix that document in the same pull request.
9. **Keep private data out of the repository.** Never commit a secret, the content of a gitignored file, an internal hostname or a private IP address. Use `example.com` and RFC 5737 addresses.
Expand Down
Loading