Skip to content

feat(roadmap): the jobs build pull request text with pull_form #3215

Description

@dan-petty

Problem or Motivation

PR #3213 adds src/devops_cli/roadmap/pull_form.py, one module of rules for the title and the body of a pull request, and devops pr describe. devops pr create now refuses a title or body that breaks the form. The stage and implement jobs do not use it yet. They still cut text with textwrap.shorten(..., placeholder="...") in staging_title, delivery_title and the "why" of implement_run.py. A job body can pass 1,000 characters, because implement_pull_body adds Closes and Change: to a "why" that is already cut to 1,000. It also puts Closes first, while the template and the new rules want the text, then Closes, then Change:. So a pull request that the Service opens can break the rules that devops pr create refuses for a person.

Proposed Solution & Architectural Design

  • The stage and implement jobs call build_title and build_body from pull_form, and check the result with title_problems and body_problems.
  • When a check refuses the text, the job sends the problems back to the model once, as it does for a refused plan, and stops the item with the class of a refused reply on a second refusal. The job never writes ... into a title or a body.
  • The implement body changes to the order text, Closes #N, Change:, then the attribution lines.
  • Remove the textwrap.shorten calls for titles and bodies, and SUMMARY_MAX_CHARS is read from pull_form only.
  • Add the follow-up of PR feat(pr): build and check the title and body of a pull request #3213 for devops pr check-readiness: it calls body_problems (see feat(pr): check-readiness warns when a pull request body passes 1,000 characters #2585).

Open questions for the refine step: whether the implement job's "why" should come from a model-written summary field with a hard bound, as the stage job's summary has; and how the change touches stage_change.py, implement_run.py and messages.py, which the content gate (#3200) also changes.

Target Subsystem

src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/implement_run.py, src/devops_cli/roadmap/pull_form.py, src/devops_cli/lang/en/messages.py.

Existing Tool Considered

pull_form already holds the rules, and the jobs have the one-retry pattern for refused replies. No other tool builds a title and body under these rules. Cost to build: about 80k tokens and 4 hours. To keep: nothing new, because the rules have one source.

Related: PR #3213 (the rules and devops pr describe), #3198, #3200, #2585.

Alternatives check of 2026-11-05: none.
Tool: none found.

Proposed design

Problem statement

The implement job still cuts the Why with textwrap.shorten and can write a body in the wrong order or over the body limit. The stage job formats its plan body without the plan body check. The claim that staging_title and delivery_title cut text is false at this commit: both already use pull_form. This change builds the implement body and the stage plan body with pull_form and stops on a refusal. A model retry is a separate item.

Acceptance criteria

Requirement: Implement body uses pull_form

The implement job SHALL build the delivery body with build_body and SHALL check it with body_problems before it updates the pull request.

Scenario: Implement body passes

  • WHEN The implement job builds a body for issue 42 with a why of 200 characters, the archived change and one attribution line.
  • THEN build_body returns the body and body_problems returns no problem.

Requirement: Delivery body order

The implement job SHALL put the why first, then Closes #, then the Change: line, then the attribution lines.

Scenario: Closes before Change

  • WHEN The implement job builds a body for issue 42 with a why and one attribution line.
  • THEN The body starts with the why, holds Closes #42 before the Change: line, and ends with the attribution line.

Requirement: No cut why

The implement job MUST NOT call textwrap.shorten on the why, a title or a body.

Scenario: Long why is not cut

  • WHEN The archived proposal's Why section is longer than BODY_MAX_CHARS.
  • THEN _why returns the issue title and the returned text contains no ....

Requirement: Stage plan body uses pull_form

The stage job SHALL build its plan body with build_plan_body and SHALL check it with plan_body_problems before it opens the draft pull request.

Scenario: Plan body passes

  • WHEN The stage job builds a plan body for issue 42 with a text of 100 characters and the active change folder.
  • THEN plan_body_problems returns no problem and the draft pull request call gets that body.

Requirement: Refused text is not written

The stage and implement jobs MUST stop the item when a title or body check returns a problem and MUST NOT write that text to GitHub.

Scenario: Refused body stops the item

  • WHEN A built body returns at least one problem.
  • THEN The job records the refused-reply failure class, stops the item, and makes no update_pull or create_draft_pull call with that body.

Existing Tool Considered

No open, maintained tool covers the need. The alternatives check found only commit and pull request title linters, Commitizen and static GitHub templates. They do not build a title and body with Closes or Plans, Change: and attribution under a character bound. The project uses its own pull_form module. It has plan_body_problems but no build_plan_body and no job integration. Written cost to build and keep: about 80k tokens and 4 hours; keep cost is nothing new because the rules have one source.

Key questions

  • Do staging_title and delivery_title still cut text with textwrap.shorten at the staging commit?: No. staging_title raises RoadmapStageError when the summary is over SUMMARY_MAX_CHARS, and delivery_title returns the full summary. This change does not modify either title builder. [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/pull_form.py]
  • Does implement_run._why still call textwrap.shorten at the staging commit?: Yes. _why calls textwrap.shorten with CONST_ROADMAP_IMPLEMENT_BODY_MAX_CHARS and the placeholder .... [sources: src/devops_cli/roadmap/implement_run.py]
  • Does pull_form already hold a plan body check?: Yes. plan_body_problems accepts Plans # and refuses a closing keyword. pull_form has no build_plan_body function, so the stage job still formats its plan body in stage_change.pull_request_body. [sources: src/devops_cli/roadmap/pull_form.py, src/devops_cli/roadmap/stage_change.py]
  • Does stage_change.py already read SUMMARY_MAX_CHARS from pull_form?: Yes. It imports SUMMARY_MAX_CHARS from pull_form and uses it for the plan title. The change keeps that import and adds no second limit. [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/pull_form.py]
  • Should the stage job get a separate plan body builder?: Yes. Add build_plan_body to pull_form and call it from stage_change.pull_request_body. The builder uses plan_body_problems and keeps the Plans # rules in one module. (best practice) [sources: src/devops_cli/roadmap/pull_form.py, src/devops_cli/roadmap/stage_change.py, tests/roadmap/test_roadmap_pull_form.py]
    • Chosen: Separate plan builder. It mirrors build_body, checks plan_body_problems, and keeps the plan rules in pull_form.
    • Rejected: Relax body_problems to accept Plans. The delivery form must keep refusing a body with no Closes.
    • Rejected: Keep formatting in stage_change.py. It leaves two places that build a plan body and one of them can drift.
  • How should the implement job get its why after the change removes textwrap.shorten?: Use the archived proposal's Why when it is no longer than BODY_MAX_CHARS and has no closing keyword. Otherwise use the issue title. Let build_body refuse any remaining problem. (best practice) [sources: src/devops_cli/roadmap/implement_run.py, src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/pull_form.py]
    • Chosen: Archived Why with issue-title fallback. It keeps one source for the rationale and writes no cut text.
    • Rejected: Model-written summary field. It duplicates the plan's Why and needs prompt and schema changes.
    • Rejected: Keep textwrap.shorten. It writes ... and can still pass the body limit.
  • What does a job do when a title or body check refuses the text?: Stop the item with the refused-reply failure class and write no title or body. Do not add a model retry in this item; file the retry as a separate issue. (best practice) [sources: src/devops_cli/roadmap/implement_run.py, src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/pull_form.py]
    • Chosen: Stop on refusal and defer retry. The implement job has no free-text model step for the pull request body, and a stop is safe.
    • Rejected: Add a model retry now. It needs a new prompt, a new bounded step and new tests.
    • Rejected: Write a cut body. It breaks the form that devops pr create enforces.
  • How should the implement body carry the attribution lines?: Pass the existing attribution lines to the attribution argument of build_body. Do not put them in the why. (best practice) [sources: src/devops_cli/roadmap/implement_run.py, src/devops_cli/lang/en/messages.py, src/devops_cli/roadmap/pull_form.py]
    • Chosen: Pass attribution to build_body. build_body puts the lines after Change: and body_problems refuses them before Closes.
    • Rejected: Keep attribution in the why. The body check refuses attribution above Closes.
    • Rejected: Remove attribution. It loses the provenance of the generated text.
  • Does this change wait for the content gate in feat(roadmap): refuse a plan with placeholder or cut text #3200?: No. Make minimal edits in stage_change.py, implement_run.py and messages.py. Rebase on feat(roadmap): refuse a plan with placeholder or cut text #3200 if it lands first. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/implement_run.py, src/devops_cli/lang/en/messages.py]
    • Chosen: Minimal edits and rebase if needed. It keeps the conflict surface small and needs no functional wait.
    • Rejected: Wait for feat(roadmap): refuse a plan with placeholder or cut text #3200 as a dependency. The jobs do not need the content gate to work.
    • Rejected: Move all texts to new message classes. It expands the conflict surface in messages.py.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. dan-petty commented on Nov 2, 2026

    @dan-petty
    OwnerAuthor

    Finding for the refine step, from fixing the plan pull requests #3150, #3157 and #3158. pull_form.body_problems (merged in #3213) refuses a correct plan body. A body with Plans #<issue> and the Change: line returns "The body has no line Closes #<issue>.", because the module has one form, the delivery form. The stage job writes the plan body with Plans #N (stage_change.py, pull_request_body), and title_problems accepts the plan title (docs(openspec): plan #N <summary>). If the stage job checks its own body with body_problems, as this issue proposes, every plan body is refused. This issue should add a plan form to pull_form (a body with Plans #<issue> in place of Closes, and the same limit, order and placeholder rules), and a test that the stage job's plan body passes it. The delivery form must keep refusing a body with no Closes.


    Generated by Claude Code

  2. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 2, 2026
  3. 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/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. Service-opened PRs can break rules that devops pr create enforces for humans, creating inconsistency, but no data loss or security risk.
    • Value: Medium. Ensures Service-opened PRs follow the same form rules as human-opened PRs, reducing review friction.
    • Effort: Medium. Requires changes to three files, adding retry logic for refused text, and removing existing textwrap calls; estimated at 4 hours.
    • Related: feat(roadmap): refuse a plan with placeholder or cut text #3200, which asks for a different change. Both change text quality in the stage and implement jobs and touch stage_change.py and implement_run.py, but #3200 refuses plans with placeholder text while the candidate makes the jobs construct PR title and body using pull_form rules.
  4. added
    priority/p2-medium
    status/ready
    and removed
    status/new
    on Nov 2, 2026
  5. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 4571d5f (see proposed design in issue body).

    Moved to new items: #3259.

  6. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    The stage job returned the item to New. The premise of the issue does not hold at the staging commit, so the job planned no change and opened no pull request.

    Evidence:

    placeholder

  7. added
    status/new
    and removed
    status/ready
    on Nov 2, 2026
  8. 1 remaining item

  9. added
    status/ready
    and removed
    status/new
    on Nov 5, 2026
  10. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at d254410 (see proposed design in issue body).

    Moved to new items: #3259, #3599.

  11. added
    owner/agent
    status/in-review
    and removed
    status/ready
    on Nov 6, 2026
  12. removed
    status/in-review
    owner/agent
    on Nov 6, 2026
  13. added a commit that references this issue on Nov 6, 2026
  14. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor
  15. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-06 22:51 UTC

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/roadmaptype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions