Skip to content

feat(pr): build and check the title and body of a pull request #3198

Closed

Description

@dan-petty

Problem or Motivation

The title and the body of a pull request are free text today, and they break the project form often. devops pr create takes --title and --body and checks neither. CONTRIBUTING.md sets the form: a Conventional Commit title with a summary of at most 60 characters and a scope that .github/labels.yml declares; a body of at most 1,000 characters that ends with Closes #<issue> and the Change: line. In one session of agent work, the first drafts of several titles had a summary over 60 characters, and a body put the attribution lines before Closes. The Service cuts text with textwrap.shorten(..., placeholder="...") (staging_title, delivery_title, and the "why" in implement_run.py). A cut title or body reads as broken, and a model that writes x or placeholder for the body gets a pull request with that text (#3167, #3174, #3175).

Proposed Solution & Architectural Design

  • Add devops pr describe. It reads the change folder (openspec/changes/<issue>-<slug>/ or its archive) and the issue, and it takes a summary of at most 60 characters from the caller. It prints the title and the body, built by code: type and scope from the issue title, the "why" from the proposal, Closes #<issue>, the Change: line, and the attribution lines when given.
  • It refuses, and does not cut: a summary over 60 characters, a scope without a label, a body over 1,000 characters (the caller shortens the "why"), a missing Closes or Change: line, and placeholder text.
  • devops pr create calls the same check on --title and --body, and refuses a pull request that breaks the form. It keeps opening a draft.
  • The stage and implement jobs call the same functions, so the Service and a person get the same title and body. The jobs stop cutting with ... and instead send the refusal back to the model once, as they do for a plan.
  • The check reuses the existing limit CONST_ROADMAP_IMPLEMENT_BODY_MAX_CHARS and the label list, and one module holds the rules.

Open questions for the refine step: whether the Semantic PR title workflow and the pull request template can read the same rule list, so the rule has one source; and whether check-readiness (see #2585) should call the body check.

Target Subsystem

src/devops_cli/commands/pr.py, a new module for the form, src/devops_cli/roadmap/stage_change.py (staging_title, delivery_title), src/devops_cli/roadmap/implement_run.py.

Existing Tool Considered

commitlint and the Semantic PR title action check a title, and GitHub's template guides a body. None builds a body from the change folder, checks the 1,000-character limit, or runs offline in the jobs. The project already holds the title rules in its own code. Cost to build: about 100k tokens and 5 hours. To keep: one module of rules and its tests. The cost of today's approach is a rework round for each pull request with a broken form.

Related: #2585 (check-readiness warns when a body passes 1,000 characters), #3188.

Proposed design

Problem statement

The pull request title and body are free text today. devops pr create checks neither. The stage and implement jobs cut text with ..., and a model can write placeholder text. The change adds one form module, a devops pr describe command, and the same check in devops pr create and the jobs.

Acceptance criteria

Requirement: Describe builds the title and body

devops pr describe SHALL build the pull request title and body from the change folder and the issue.

Scenario: Describe a change

  • WHEN the caller runs devops pr describe --summary for a change folder or its archive and an issue
  • THEN the command prints a title with the issue type and declared scope, and a body with the why, Closes #, and the Change: line

Requirement: Describe refuses a long summary

devops pr describe SHALL refuse a summary longer than 60 characters without cutting it.

Scenario: Summary over 60 characters

  • WHEN the caller gives a summary of 61 characters
  • THEN the command exits with a non-zero status, names the 60-character limit, and prints no title or body

Requirement: Describe refuses an undeclared scope

devops pr describe SHALL refuse a title scope that .github/labels.yml does not declare.

Scenario: Undeclared scope

  • WHEN the issue title has a scope with no scope/ label
  • THEN the command exits with a non-zero status and names the missing label

Requirement: Describe places attribution before Closes

devops pr describe SHALL place each attribution line before Closes # when the caller gives one.

Scenario: Attribution line

  • WHEN the caller gives an attribution line
  • THEN the printed body holds that line before Closes #

Requirement: Form check refuses a long body

The shared form check SHALL refuse a body longer than CONST_ROADMAP_IMPLEMENT_BODY_MAX_CHARS without cutting it.

Scenario: Body over the limit

  • WHEN the body has more characters than CONST_ROADMAP_IMPLEMENT_BODY_MAX_CHARS
  • THEN the check returns a refusal that names the limit, and the body is unchanged

Requirement: Form check requires the closing and change lines

The shared form check SHALL require the body to end with Closes # and the Change: line.

Scenario: Missing trailer

  • WHEN the body has no Closes # line or no Change: line
  • THEN the check returns a refusal that names each missing line

Requirement: Form check refuses placeholder text

The shared form check SHALL refuse placeholder text in the title or body.

Scenario: Placeholder body

  • WHEN the body is x or placeholder, or still holds an angle-bracket field from the template
  • THEN the check returns a refusal and the caller prints no title or body

Requirement: Create checks the title and body

devops pr create SHALL call the shared form check on --title and --body and SHALL refuse a pull request that breaks the form.

Scenario: Create with a broken title

  • WHEN the caller runs devops pr create with a summary over 60 characters
  • THEN the command exits with a non-zero status, sends no create request, and opens no pull request

Requirement: Create keeps the draft behavior

devops pr create SHALL keep opening a draft when the title and body pass the form check.

Scenario: Create with a valid title and body

  • WHEN the caller runs devops pr create with a valid title and body
  • THEN the command sends the create request with draft=true

Requirement: Jobs use the shared form and refuse instead of cutting

The stage and implement jobs SHALL call the shared form functions and SHALL NOT cut a title or body with ....

Scenario: Job gets a title that breaks the form

  • WHEN the stage or implement job builds a title or body that fails the form check
  • THEN the job sends the refusal to the model one time and does not update the pull request with a cut text

Requirement: One module holds the rules

One module SHALL hold the title and body rules, and it SHALL reuse CONST_ROADMAP_IMPLEMENT_BODY_MAX_CHARS and the labels file.

Scenario: Rules from one module

  • WHEN devops pr describe, devops pr create, the stage job, and the implement job check a title or body
  • THEN they call the same functions in src/devops_cli/github/pr_form.py, and no caller holds a second copy of the 60-character or 1,000-character limit

Existing Tool Considered

No alternatives check has run. commitlint and the Semantic PR title action check a title. GitHub's template guides a body. None builds a body from the change folder, checks the 1,000-character limit, or runs offline in the jobs. Written cost to build: about 100k tokens and 5 hours. To keep: one module of rules and its tests.

Key questions

  • Should the new form module reuse CONST_ROADMAP_IMPLEMENT_BODY_MAX_CHARS for the 1,000-character body limit?: Yes. Reuse CONST_ROADMAP_IMPLEMENT_BODY_MAX_CHARS (1,000) for the body limit. It measures the same pull request body that the implement job writes. A second constant would put the same number in two places. (best practice) [sources: src/devops_cli/config/constants.py:3079, src/devops_cli/roadmap/implement_run.py:60, CONTRIBUTING.md]
    • Chosen: Reuse CONST_ROADMAP_IMPLEMENT_BODY_MAX_CHARS. One constant holds the 1,000-character limit for the pull request body.
    • Rejected: Add a new body-limit constant. The same 1,000-character rule would have two values that can drift.
  • Can the Semantic PR title workflow and the pull request template read the same rule list as the form module?: No for the template, and not directly for the workflow. The template is human guidance. The workflow scopes input is a literal list. Keep .github/labels.yml as the scope source, have the form module read it, and add a test that the workflow scopes list equals the scope/* labels. (best practice) [sources: CONTRIBUTING.md, .github/labels.yml, .github/pull_request_template.md]
    • Chosen: Keep .github/labels.yml as the scope source and test the workflow list. GitHub Actions and Markdown cannot import the Python module. The test keeps the lists equal.
    • Rejected: Make the workflow and template read the form module. The workflow runs in GitHub Actions and the template is Markdown. Neither can import Python code offline.
    • Rejected: Leave the lists duplicated with no test. A scope added to one list and not the other would pass one check and fail another.
  • Should devops pr check-readiness call the shared body check?: Yes, when feat(pr): check-readiness warns when a pull request body passes 1,000 characters #2585 lands. The check should call the shared body check so the 1,000-character rule has one implementation. This issue does not add the call. feat(pr): check-readiness warns when a pull request body passes 1,000 characters #2585 owns the advisory and its tests. (best practice) [sources: src/devops_cli/commands/pr.py, openspec/changes/2585-check-readiness-warns-when-a-pull/proposal.md]
  • Where should the shared title and body rules live?: Put them in src/devops_cli/github/pr_form.py. The CLI and the roadmap jobs can import that module. The command module stays a thin CLI layer. (best practice) [sources: src/devops_cli/commands/pr.py, src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/implement_run.py]
    • Chosen: src/devops_cli/github/pr_form.py. A pull request form is a GitHub concern. Both the CLI and the roadmap jobs can import it.
    • Rejected: src/devops_cli/commands/pr.py. The roadmap jobs should not import a command module.
    • Rejected: src/devops_cli/roadmap/stage_change.py. That module is stage-specific and holds the plan schema.
  • What placeholder text does the shared form check refuse?: Refuse a title or body whose non-whitespace text is empty, x, placeholder, todo, tbd, n/a, or .... Refuse text that still holds an angle-bracket field from .github/pull_request_template.md. (best practice) [sources: .github/pull_request_template.md, CONTRIBUTING.md]
    • Chosen: Refuse the listed placeholder texts and template fields. The check stops the known empty and template text.
    • Rejected: Refuse only empty text. A body of x or placeholder would pass.
    • Rejected: Refuse any short body. A short but valid body would be refused.
  • Which command line does devops pr describe take?: devops pr describe --summary [--attribution ...]. It reads the change folder for `` and the issue, and prints the title and body. (best practice) [sources: src/devops_cli/commands/pr.py, CONTRIBUTING.md]
    • Chosen: Use --summary and repeatable --attribution. The caller gives the summary and the optional attribution lines.
    • Rejected: Read the summary from the issue title. The issue title can have a long summary and no caller control.
    • Rejected: Put the attribution after Closes. The body form puts attribution before Closes.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    scope/pr
    status/new
    value/medium
    effort/medium
    on Nov 2, 2026
  2. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/pr. The (pr) scope of the title gives the scope.
    • Priority: P2-Medium. It prevents rework rounds for broken PR forms but does not block a release or fix a defect.
    • Value: Medium. It removes a recurring source of broken pull requests and saves a rework round per affected PR.
    • Effort: Medium. It adds a new command, a shared rules module, and changes to pr create, stage, and implement jobs.
    • Related: feat(pr): check-readiness warns when a pull request body passes 1,000 characters #2585, which asks for a different change. Both check PR body length, but #2585 adds a warning to check-readiness while the candidate builds a new pr describe command and validation for pr create and the stage and implement jobs.
  3. removed
    status/new
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/prtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions