Skip to content

A pull request description draft is rebuilt from the published pull request in Go #873

Description

@tbhb-agent

Problem

populate-description.sh (108 lines) rebuilds PR_AGENTDESC.md from a published pull request when the draft is gone: frontmatter for base, draft state, labels, reviewers, assignees and milestone, the title and the body. Its core is an inline python3 program, so it needs a Python the toolchain otherwise avoids, and it is under the shell freeze in #588. The title is written exactly as GitHub holds it with surrounding whitespace trimmed; the program does not remove a trailing (#<number>), although the script's closing message says it does.

Part of #324, within #588. Child 13 in #324's Children list. Replaces packages/agents/source/skills/merge-pr/shared/scripts/populate-description.sh.

Acceptance criteria

  1. AC1: Given an open pull request and no draft, when agentrepo merge description runs, then PR_AGENTDESC.md holds base, draft, labels, reviewers: [], assignees and milestone frontmatter, a # <title> heading and the body with carriage returns normalized, byte for byte as the shell script wrote them.
  2. AC2: Given a pull request whose title ends in (#<number>), when it runs, then the heading carries the title unchanged apart from trimmed surrounding whitespace, suffix included.
  3. AC3: Given a draft that already has content and no --force, when it runs, then it leaves the file alone, says so and exits 0; given --force, then it replaces it.
  4. AC4: Given no number and no open pull request for the current branch, when it runs, then it exits 1 asking for a number.
  5. AC5: Given gh is missing or not authenticated, or the pull request cannot be read, when it runs, then it exits 1 with the shell script's message and writes nothing.
  6. AC6: Given a pull request with no labels, assignees or milestone, when it runs, then the empty lists and the empty milestone: key match the shell output.
  7. AC7: Non-functional: it needs no Python, and runs on macOS, Linux and Windows in CI.

Scope and non-goals

Scope: agentrepo merge description and its tests.

Non-goal: validating the description, which lint-pr-description and the pr workflow own. Non-goal: correcting the closing message about the suffix; it is kept as the shell prints it and any change is a follow-up issue. Non-goal: editing the shell script before child 14.

Approach

Meet AC1 to AC7 with failing cases first: golden draft files from the shell script on fake-gh fixtures, including a suffixed title, then Go compared byte for byte. Mechanism is the implementer's choice.

Dependencies

Blocked by: #333.

Prerequisites: #321 GitHub reader and #333.

Size

S. One pull request.

Verify plan

  • AC1, AC2, AC6: golden-file comparison, one fixture with a (#<number>) suffixed title.
  • AC3, AC4, AC5: table-driven cases with a fake gh.
  • AC7: a test with Python absent from PATH; the CI matrix run.
  • Definition of done: D1 each AC is verified at the merged head, with the commands and results cited in the pull request's Verification. D2 an independent review approves the exact merged head, and every finding has a recorded disposition. D3 required checks pass with no gate loosened. D4 the leak scans the repository specifies are clean, and every post made for this work passes the per-post leak review before it is posted. D5 every commit is signed. D6 the documentation matches the change or the Verification says why there is no impact. D7 every commit has an Assisted-by trailer and the pull request has the provenance:agent-assisted label. D8 the pull request stays within the size limits. D9 follow-ups are filed as issues and listed under Related. D10 the merge closes the issue through a closing reference, the board shows Done, and the final Status: comment names the merge commit.

Risks

A changed draft layout could fail the description validator later; golden comparison is the control. Undo: revert; the shell script is untouched.

Operator authority

None.

Activity

  1. tbhb-agent commented on Oct 27, 2026

    @tbhb-agent
    ContributorAuthor

    Refinement: READY — A pull request description draft is rebuilt from the published pull request in Go
    Model: gpt-6-astra

    Child 13 A pull request description draft is rebuilt from the published pull request in Go

    Verdict: READY

    Checked: Title preservation, existing-draft protection, error handling and Python removal remain bounded and verifiable. The suffixed-title contract matches packages/agents/source/skills/merge-pr/shared/scripts/populate-description.sh:84 and packages/agents/source/skills/merge-pr/shared/scripts/populate-description.sh:100. No regression from the round 2 body was identified.

    Gaps: None.

    Split: None needed.

    Definition of done

    The definition of done for this issue (Feature). Tick each item and give its evidence.

    • D1 The author verified each AC on the merged head, and the Verification section of the pull request cites each AC ID with its evidence: the command and its result, or a link.
    • D2 An independent reviewer approved the exact merged head, and the author resolved each finding or filed it as a follow-up.
    • D3 The required checks pass on that head, and any loosened gate has the owner's approval of that exact head.
    • D4 The leak scans come back clean: gitleaks, devtools' check-leaks.sh with the repository's private-strings list, and the leak review of each post.
    • D5 The author signed each commit, the squash included.
    • D6 The docs match the change (README, docs/, CHANGELOG or help text), or the Verification section says "No doc impact" and why.
    • D7 The commits and the squash have Assisted-by trailers, and the pull request has the provenance:agent-assisted label.
    • D8 The pull request stays within the size limits, or the owner approved its exact head over the hard limit.
    • D9 The author files follow-ups and deferred findings as issues with at least a Problem and numbered AC and lists them under the Related section of the pull request. Any work left in the code links its issue.
    • D10 The merge closes the issue through a closing reference and the board shows Done. The final Status: comment names the merge commit.
    • devtools-1 mise run check is green, and so are the coverage floors mise run cover-go-check and mise run cover-py-check, which check doesn't run.
    • devtools-2 A change to skill sources under packages/agents/source/ commits what mise run generate-skills, then mise run skill-tokens, then apm install rewrite, in that order, and check-generated-skills (part of lint) passes.
    • devtools-3 A consumer-visible change (the vendored payload, a skill, a reusable workflow, a task or a pin) has its consumer steps in docs/agent-skills-migration.md or the adoption docs, or the PR's Verification says "No consumer impact" and why.

    Round: 3 of 3

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

    refinement:readyPassed the Definition of Ready; may be picked up

    Fields

    Priority

    None yet

    Work type

    None yet

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions