Skip to content

SAIFTRBL0025 ยท permalink

Dependabot pull requests fail the linked work item policy and get abandoned

Set milestone: <work item id> on every updates entry in .github/dependabot.yml, pointing at one standing closed work item. The dependabot@2 task attaches that work item to each pull request it creates.


๐Ÿšจ Symptom

Dependabot pull requests sit active and never merge, and a newer Dependabot pull request later supersedes and abandons them. On the pull request, the linked work items requirement shows as not met and the pull request has no work items under Development. The policy wording depends on the repository's branch policy configuration, so no single error string identifies this case.


๐Ÿ“Œ Applies to

Aspect Value
Component Azure DevOps branch policy "Check for linked work items", dependabot@2 task
Observed on dependabot@2 2.68.7
Not for Pull requests blocked only by required reviewers or failing builds, and files with a root multi-ecosystem-groups section (set milestone on each group instead, see Fix)

Prerequisites and safety

  • Edit access to the repository's .github/dependabot.yml.
  • A work item that you intend to share across all Dependabot pull requests. Forge uses work item 209827 in the SAIF project, a closed Task titled "Dependency updates (Dependabot) - standing work item".
  • milestone links one work item to every pull request from that entry, version and security updates alike. Dependabot cannot create a work item per pull request.

Before changing anything

A shared work item hides the per-change audit trail that the policy normally provides. Confirm with your team that one standing work item satisfies your change-tracking requirement.


โœ… Fix

  1. Add milestone to each entry under updates. If your file has a root multi-ecosystem-groups section, set milestone on each group under multi-ecosystem-groups instead, because Paklo's DependabotConfigSchema rejects milestone under updates when that section exists and the configuration then fails validation:

    updates:
      - package-ecosystem: "npm"
        directory: "/"
        milestone: 209827 # Work item that satisfies the linked-work-item branch policy
        schedule:
          interval: 'cron'
          cronjob: '0 11 * * *'
    
  2. Commit the change and run the Dependabot pipeline.

  3. Link the work item to each existing active Dependabot pull request manually, because milestone applies only to pull requests that Paklo creates after the change. Abandon an older pull request only after you confirm that a newer pull request covers the same updates, and delete the abandoned pull request's source branch, because Paklo refuses to create an update whose source branch already exists (source branch ... already exists).


๐Ÿ”ฌ Verify

Open a pull request that the new run created. The work item appears under Development or Work items. In the tested repository, the pull request carried workItemRefs: [209827].

I confirmed that the link attaches. I did not confirm that the policy turns green for a closed work item in a different project (SAIF) than the pull request's project (Customer). If the policy still fails, check the policy's configuration and whether it accepts cross-project work items.


๐Ÿง  Cause

The dependabot@2 task cannot create work items (tracked in mburumaxwell/paklo#1408). It does support milestone, which it applies as workItemRefs on the pull request, in packages/core/src/dependabot/config.ts and the task wrapper. Paklo attaches the work item only when it creates a pull request. The update_pull_request path in packages/core/src/azure/runner/server.ts refreshes a pull request in place and passes no work items. Without a link, the branch policy blocks completion. The setAutoComplete setting cannot merge the pull request, so the pull request stays active until a newer pull request supersedes it or someone abandons it. Paklo abandons an older pull request as superseded only after it creates a replacement, so a daily scan does not always clear the old pull request.

The abandonment itself comes from that supersede behavior. Whether the work item policy alone blocks completion in a given repository is an inference, because required reviewer policies can block the same pull request.