Skip to content

feat(roadmap): the stage and implement jobs label their pull request from its title #2777

Closed

Description

@dan-petty

Problem or Motivation

Issue #2748 gives devops pr create the labels of the title of a pull request. The stage job and the implement job open pull requests through their own client, so their pull requests still get no type/* and no scope/* label from code.

  • The stage job opens its draft with create_draft_pull in roadmap/stage.py. When GitHub refuses the pull request, it deletes the remote branch. A label that fails must not delete the branch of an open pull request. It must not leave the job marks unset.
  • The implement job sets a new title and body on its pull request after the stage job opened it. The labels must follow the new title, so a second write is needed there.

Proposed Solution & Architectural Design

Give both jobs the labels of the title with the pieces that #2748 added: title_labels and declared_label_names in roadmap/title_labels.py, read_title_labels and add_pull_labels in roadmap/pull_labels.py, and RoadmapStore.label_issue.

  • Stage: after _open_pull, add the labels. A failure is reported in the comment of the job on the item. It keeps the branch and the marks.
  • Implement: after the job sets the title, add the labels of the new title. Remove a type/* or scope/* label that the old title gave and the new title does not give.

Existing Tool Considered

No new tool is needed. The change reuses title_labels and RoadmapStore.label_issue.

Proposed design

Problem statement

The stage job and the implement job open or update pull requests through their own GitHub client. They bypass devops pr create, so their pull requests receive no type/* or scope/* labels derived from the title. This change adds those labels to both jobs using the pieces that issue #2748 already provides.

Acceptance criteria

Requirement: Stage job adds title labels

The stage job SHALL add type/* and scope/* labels to its draft pull request after _open_pull succeeds.

Scenario: Stage job opens a draft pull request with a title that maps to labels

  • WHEN The stage job calls _open_pull and the pull request opens successfully
  • THEN The pull request carries the type/* and scope/* labels derived from its title

Requirement: Stage job label failure keeps branch and marks

A label failure in the stage job SHALL NOT delete the remote branch or unset the job marks.

Scenario: Stage job label call fails after the pull request is open

  • WHEN The label call on the open pull request returns an error
  • THEN The remote branch still exists and the job marks remain set

Requirement: Stage job label failure reported in comment

A label failure in the stage job SHALL be reported in the job comment on the item.

Scenario: Stage job label call fails

  • WHEN The label call on the open pull request returns an error
  • THEN The job comment on the item records the label failure

Requirement: Implement job adds labels for new title

The implement job SHALL add type/* and scope/* labels matching the new title after it sets the title on the pull request.

Scenario: Implement job sets a new title that maps to different labels

  • WHEN The implement job updates the pull request title and body
  • THEN The pull request carries the type/* and scope/* labels derived from the new title

Requirement: Implement job removes stale labels

The implement job SHALL remove any type/* or scope/* label that the old title gave and the new title does not give.

Scenario: New title maps to a different scope than the old title

  • WHEN The implement job sets a new title whose scope differs from the old title
  • THEN The old scope/* label is removed and the new scope/* label is added

Existing Tool Considered

No check has run. The body states no new tool is needed. The change reuses title_labels and declared_label_names in roadmap/title_labels.py, read_title_labels and add_pull_labels in roadmap/pull_labels.py, and RoadmapStore.label_issue, all added by issue #2748.

Key questions

  • How does the stage job handle a label failure after the pull request is open?: It reports the failure in the job comment on the item. It keeps the branch and the job marks. It does not delete the branch. (proposed)
    • Chosen: Report in comment, keep branch and marks. The pull request is already open. Deleting the branch would lose the open pull request. The body records this decision.
    • Rejected: Delete the branch on label failure. This would delete the branch of an already-open pull request. The body rejects this.
  • How does the implement job manage labels when it sets a new title?: It adds the type/* and scope/* labels of the new title. It removes any type/* or scope/* label that the old title gave and the new title does not give. (proposed)
    • Chosen: Add new labels and remove stale ones. The body records this. Stale labels would misrepresent the pull request if left in place.
    • Rejected: Only add new labels, leave old ones. Stale type/* or scope/* labels would remain and misrepresent the pull request.
  • Which existing code pieces does the change reuse?: title_labels and declared_label_names in roadmap/title_labels.py, read_title_labels and add_pull_labels in roadmap/pull_labels.py, and RoadmapStore.label_issue. All are added by issue fix(pr): devops pr create labels the pull request from its title #2748. [sources: src/devops_cli/roadmap/stage.py:799]
  • Where does the stage job call _open_pull?: The stage job calls _open_pull at line 848 of src/devops_cli/roadmap/stage.py. The label call goes after that call. [sources: src/devops_cli/roadmap/stage.py:848]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#2748

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Oct 30, 2026
  2. dan-petty commented on Oct 30, 2026

    @dan-petty
    OwnerAuthor

    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. It closes a labeling gap left by #2748 but does not block a release or break existing behaviour.
    • Value: Medium. It completes automated labeling for roadmap-job PRs, reducing manual label work for maintainers.
    • Effort: Medium. It reuses existing helpers from #2748 but requires changes in two jobs with distinct failure-handling rules.
    • Related: fix(pr): devops pr create labels the pull request from its title #2748, which asks for a different change. Both apply 'type/*' and 'scope/*' labels from the PR title, but #2748 targets 'devops pr create' and the candidate targets the stage and implement jobs.
  3. added
    priority/p2-medium
    on Oct 30, 2026
  4. added
    status/ready
    and removed
    status/new
    on Oct 30, 2026
  5. devops-cli-service commented on Oct 30, 2026

    @devops-cli-service
    Contributor

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

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

    @devops-cli-service
    Contributor

    Staged: branch feat/2777-the-stage-and-implement-jobs-label, draft pull request #3169. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:

    1. Remove a label from a pull request in the store: 27453 tokens
    2. Add and remove the title labels in one call: 17808 tokens
    3. Label the stage job's draft pull request: 20607 tokens
    4. Label the implement job's pull request from the new title: 19938 tokens

    The plan run made 17 model request(s), and used 437959 input tokens and 8308 output tokens. The tool calls, in order:

    1. list_files({"directory":"src/devops_cli/roadmap"})
    2. read_file({"path":"src/devops_cli/roadmap/pull_labels.py"})
    3. read_file({"path":"src/devops_cli/roadmap/stage.py","start_line":1000,"end_line":1200})
    4. read_file({"path":"src/devops_cli/roadmap/implement_pull.py"})
    5. search_code({"text":"set_pull_title"})
    6. search_code({"text":"label_issue"})
    7. search_code({"text":"edit_pull"})
    8. search_code({"text":"update_pull"})
    9. read_file({"path":"src/devops_cli/roadmap/implement_run.py","start_line":520,"end_line":640})
    10. read_file({"path":"src/devops_cli/roadmap/title_labels.py"})
    11. read_file({"path":"src/devops_cli/roadmap/implement_run.py","start_line":580,"end_line":620})
    12. search_code({"text":"remove_pull_label"})
    13. read_file({"path":"src/devops_cli/roadmap/github_store.py","start_line":720,"end_line":820})
    14. search_code({"text":"unlabel"})
    15. read_file({"path":"src/devops_cli/roadmap/store.py","start_line":790,"end_line":850})
    16. read_file({"path":"src/devops_cli/roadmap/memory_store.py","start_line":350,"end_line":400})
    17. list_files({"directory":"src/devops_cli/roadmap"})
    18. list_files({"directory":"tests/roadmap"})
    19. search_code({"text":"update_pull"})
    20. read_file({"path":"src/devops_cli/roadmap/pull_labels.py"})
    21. search_code({"text":"label_issue"})
    22. read_file({"path":"src/devops_cli/roadmap/implement_run.py","start_line":550,"end_line":620})
    23. search_code({"text":"_pull_request"})
    24. search_code({"text":"delivery_title"})
    25. file_symbols({"path":"tests/roadmap/test_roadmap_implement_job.py"})
    26. search_code({"text":"_pull_request("})
    27. search_code({"text":"unlabel"})
    28. read_file({"path":"src/devops_cli/roadmap/store.py","start_line":800,"end_line":850})
    29. read_file({"path":"src/devops_cli/roadmap/stage.py","start_line":1030,"end_line":1175})
  7. added 2 commits that reference this issue on Nov 2, 2026
  8. added
    status/planned
    and removed
    status/ready
    on Nov 2, 2026
  9. added
    status/in-progress
    and removed
    status/planned
    on Nov 3, 2026
  10. added a commit that references this issue on Nov 3, 2026
    7c2af21
  11. added
    status/in-review
    and removed
    status/in-progress
    on Nov 3, 2026
  12. added a commit that references this issue on Nov 3, 2026
    48701e6
  13. removed
    status/in-review
    on Nov 3, 2026
  14. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-03 13:34 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/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions