Skip to content

fix(pr): pr create sets In Progress after GitHub links the issue #5112

Closed

Description

@dan-petty

Problem Description

devops pr create must set In Progress on the issue that the new pull request closes (_finish_created_pr in src/devops_cli/commands/pr.py, set_delivered_status in src/devops_cli/roadmap/pull_status.py). The step reads closingIssuesReferences of the pull request immediately after it opens. GitHub links the closing issue asynchronously, so the read can give no issue. Then set_delivered_status returns None, the command prints nothing, and the issue keeps its old Status until devops pr ready sets In Review.

Reproduction Steps

  1. Claim an item that holds status/new (for example devops roadmap claim <n> --as agent --confirm).
  2. Push a branch and run devops pr create --title "feat(<scope>): ..." --body "... Closes #<n> ...".
  3. Read the labels of issue <n> after the command exits.

Expected vs Actual Behavior

Expected: the issue holds status/in-progress after devops pr create, or the command says that it found no closing issue.

Actual (2026-11-12, two of two pull requests checked): PR #5111 (opened 15:06:13Z, closes #4685) got its title labels at 15:06:17Z, so _finish_created_pr ran, but #4685 kept status/new. A GraphQL read some minutes later gave #4685 as the closing issue. PR #5109 (opened 14:49:23Z, closes #5018) had the same result: #5018 went from status/new to status/in-review at 14:55:53Z with no status/in-progress between.

Environment Diagnostics

origin/main at 3109817, devcontainer, uv run devops.

Logs, Traces, or Terminal Output

devops pr create printed only "Opened a draft pull request ... When its checks pass, mark it ready with devops pr ready." and exited 0.

Pre-Submission Checklist

  • I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
  • I have checked existing issues and pull requests to ensure this is not a duplicate.

Source: #5111

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

Proposed design

Problem statement

devops pr create reads the closing issue at once. GitHub links the closing issue asynchronously. The read can return no issue, so set_delivered_status returns None, the command prints no message, and the issue keeps its old Status. The fix retries the read for a bounded time and reports a missing link.

Acceptance criteria

Requirement: Retry closing-issue read

devops pr create SHALL retry the closingIssuesReferences read after the pull request opens until GitHub returns a closing issue or the bounded wait ends.

Scenario: Issue linked after the first read

  • WHEN A unit test mocks the first closingIssuesReferences read with no issue and the second read with issue 4685.
  • THEN The test asserts that _finish_created_pr calls set_delivered_status for issue 4685.

Requirement: Warn when no closing issue appears

devops pr create SHALL print a warning that it found no closing issue when the bounded wait ends with no linked issue.

Scenario: No closing issue after the wait

  • WHEN A unit test mocks every closingIssuesReferences read with no issue and runs devops pr create.
  • THEN The test asserts that the command prints the no-closing-issue warning and exits 0.

Requirement: Status setter returns the linked issue

set_delivered_status SHALL return the number of the issue whose status it sets.

Scenario: One linked issue

  • WHEN A unit test gives set_delivered_status a pull request that closes issue 4685, which holds status/new.
  • THEN The test asserts that set_delivered_status returns 4685 and that issue 4685 holds status/in-progress.

Existing Tool Considered

No open, maintained tool or library covers the need. The alternatives check of 2026-11-16 found no tool that waits for GitHub's asynchronous issue-PR link and then sets the issue status label. The fix builds a small project-specific retry in _finish_created_pr and a return value in set_delivered_status: about 20k-40k tokens to build, keep and fix, and 1-2 days elapsed.

Key questions

  • How should devops pr create handle GitHub's asynchronous closing-issue link?: Use a bounded retry of the pull request's closingIssuesReferences read after the pull request opens. Call set_delivered_status when the first issue appears. (best practice) [sources: src/devops_cli/commands/pr.py:1166, src/devops_cli/roadmap/pull_status.py:63, tests/commands/test_pr_status.py]
    • Chosen: Bounded retry of closingIssuesReferences. It uses GitHub's authoritative link and follows the existing poll pattern in pr.py.
    • Rejected: Parse Closes #<n> from the pull request body. The body is text, not the authoritative link, and can name an issue that GitHub does not link.
    • Rejected: Wait without a bound. A missing or malformed closing reference would hang the command.
    • Rejected: Keep the immediate read. The issue shows that GitHub can link the issue after the read, so the status is lost.
  • What wait bound and interval should the retry use?: Add dedicated closing-issue poll constants in src/devops_cli/config/defaults.py and use them in _finish_created_pr. (best practice) [sources: src/devops_cli/config/defaults.py, src/devops_cli/commands/pr.py]
    • Chosen: Add dedicated closing-issue poll constants. It follows the existing PR poll pattern and gives this wait its own meaning.
    • Rejected: Reuse DEFAULT_PR_UPDATE_HEAD_POLL_ATTEMPTS and DEFAULT_PR_UPDATE_HEAD_POLL_INTERVAL_SECONDS. These constants govern a head update, so reuse hides a different wait behind an unrelated name.
    • Rejected: Use a fixed inline delay. It hides the timing in code and does not follow the repository's configured poll pattern.
  • What should devops pr create do when no closing issue appears before the wait ends?: Print a warning that it found no closing issue for the pull request. Exit 0, because the pull request was created. (best practice) [sources: src/devops_cli/commands/pr.py, src/devops_cli/roadmap/pull_status.py:63]
    • Chosen: Warn and exit 0. The pull request exists. A missing link is not a creation failure, and the issue asks for a message.
    • Rejected: Exit 1. A nonzero exit reports a failed create after GitHub opened the pull request.
    • Rejected: Print nothing. The issue reports this silent result as the defect.
  • Should set_delivered_status return the issue number it updates?: Yes. Return the linked issue number after the label update, and return None only when no issue is linked. (best practice) [sources: src/devops_cli/roadmap/pull_status.py:63, tests/roadmap/test_roadmap_status_labels.py]
    • Chosen: Return the issue number. The caller can tell a successful status write from a missing link and print the right message.
    • Rejected: Keep returning None. The caller cannot tell success from a missing link, which causes the silent failure.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/pr
    status/new
    value/medium
    effort/low
    on Nov 12, 2026
  2. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 12, 2026
  4. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The issue is a defect in devops-cli's own devops pr create flow (its _finish_created_pr/set_delivered_status reads closingIssuesReferences before GitHub links the issue), not a capability an external tool supplies. Searches for tools or libraries covering GitHub's async issue-PR link or setting an issue's status label at PR creation found only unrelated Docker images and a GitHub community discussion describing the same race, and no open maintained library exists that covers this need.

    Tool: none found

    Lacks:

    • No open tool or library covers waiting for GitHub's asynchronous issue-PR link and then setting the issue's status label; the fix is project-specific retry/handling in devops-cli.

    Searches run:

    • GitHub pull request closingIssuesReferences not linked immediately after creating PR, poll for linked issue, results: 5
    • GitHub Action set label on linked issue when pull request opened closes, results: 5
    • "closingIssuesReferences" github graphql empty right after creating pull request race condition, results: 5

    Sources:

    Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.

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

    @devops-cli-service
    Contributor

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

  7. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 17, 2026
  8. removed
    status/in-review
    on Nov 17, 2026
  9. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor
  10. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-17 16:55 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/lowpriority/p2-mediumscope/prsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions