Skip to content

Add deterministic Dependabot scheduler - #14750

Merged
williammartin merged 7 commits into
trunkfrom
williammartin-investigate-dependabot-aic
Oct 19, 2026
Merged

williammartin merged 7 commits into
trunkfrom
williammartin-investigate-dependabot-aic

Conversation

@williammartin

@williammartin williammartin commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Description

Fixes #14749

The hourly agentic workflow can finish through its pre-flight noop without invoking a model. However, its successful agent job then has no AIC accounting, so the daily guardrail conservatively charges the configured maximum.

This PR moves polling into a traditional GitHub Actions workflow and runs the deterministic check every 30 minutes. It shares the worklist script with the agentic workflow, then dispatches one agentic run for each ready, unassessed Dependabot PR.

The agentic workflow keeps its manual workflow_dispatch entry point and repeats the worklist check before starting the model. This closes scheduling races and preserves the existing input validation, CI gate, head-SHA deduplication, and comment-only security boundary.

How did you test this change?

I ran the shared gate against the live cli/cli repository. It found #14716, matched the existing assessment to its current head SHA, and wrote an empty worklist.

$ tmpdir=$(mktemp -d) && trap 'rm -rf "$tmpdir"' EXIT && GITHUB_REPOSITORY=cli/cli RUNNER_TEMP="$tmpdir" GITHUB_OUTPUT="$tmpdir/output" bash .github/scripts/dependabot-triage.sh select && printf '\nOutputs:\n' && cat "$tmpdir/output" && printf '\nWorklist:\n' && cat "$tmpdir/gh-aw/dependabot-worklist.json"
PRs with terminal CI: 1
PR #14716: already assessed at 35c2bf381bb42655fb40ec8ebf2e0a0548ef7543, skipping
Work list: 0 PR(s) -> /var/folders/z7/869nt6ns29d77xln9h9bm8680000gn/T/tmp.HH0UX0WnA4/gh-aw/dependabot-worklist.json
Go reachability evidence needed: false

Outputs:
count=0
needs_go=false
reason=no_work
worklist_path=/var/folders/z7/869nt6ns29d77xln9h9bm8680000gn/T/tmp.HH0UX0WnA4/gh-aw/dependabot-worklist.json

Worklist:
[]

I did not perform a live dispatch because the new scheduler is not present on the default branch before this PR merges.

I queried each active workflow-run state used by the duplicate guard. There were no queued, running, waiting, or concurrency-pending Dependabot triage runs.

$ for status in queued in_progress waiting pending; do printf '%s: ' "$status"; gh api "repos/cli/cli/actions/workflows/dependabot-triage.lock.yml/runs?status=$status&per_page=1" --jq '.workflow_runs | length'; done
queued: 0
in_progress: 0
waiting: 0
pending: 0

Key points

  • The scheduler has actions: write only to create workflow_dispatch events. Its other permissions remain read-only.
  • The deterministic poll runs at minutes 9 and 39, reducing recommendation latency without spending AIC on empty checks.
  • The shared script keeps scheduler selection and agent pre-flight validation aligned.
  • The scheduler skips PRs with queued, running, waiting, or concurrency-pending triage runs. A broad manual run pauses scheduler dispatches until it finishes.
  • Each PR gets a separate agentic run, so job-discriminator includes pr_number to keep generated conclusion jobs independent.
  • The agentic workflow still writes noop for stale, pending, assessed, or invalid manual requests.
  • Regeneration preserves the existing download-artifact v8.0.2, upload-artifact v7.0.2, and setup-node v7.1.0 upgrades.

Notes for reviewers

Start with .github/workflows/dependabot-triage-schedule.yml, then read .github/scripts/dependabot-triage.sh. The agentic source calls its select subcommand and removes only its schedule trigger.

github/gh-aw#70252 tracks the underlying accounting gap. This PR avoids the gap without changing the existing daily AIC guardrail.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @williammartin will read and reply directly. Name the account.
  • An agent will draft replies and @username will read them before they are posted.
  • Nobody has explicitly committed to replying.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: d77b7f23-7506-4ff3-8bac-84f17fe6e8d0
@williammartin
williammartin requested a review from a team as a code owner October 19, 2026 12:20
@williammartin
williammartin requested review from niik and a balanced review from Copilot October 19, 2026 12:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Duplicate in-flight dispatches can recreate false credit charges, and regeneration rolls back existing Actions reliability fixes.

2 open issues
What changed in this PR

Moves hourly Dependabot polling into a conventional Actions workflow to avoid starting agent runs when no assessment is needed.

Changes:

  • Adds a scheduler that dispatches ready, unassessed PRs.
  • Shares worklist validation between scheduling and agent pre-flight checks.
  • Removes the agent workflow’s schedule while retaining manual dispatch and credit guardrails.
File Description
.github/​workflows/​dependabot-triage.md Uses shared pre-flight logic and dispatch-only triggers.
.github/​workflows/​dependabot-triage.lock.yml Regenerates workflow triggers, steps, and concurrency settings.
.github/​workflows/​dependabot-triage-schedule.yml Adds hourly polling and per-PR dispatch.
.github/​scripts/​dependabot-triage-worklist.sh Centralizes readiness and assessed-head checks.

Review effort: Balanced

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: d77b7f23-7506-4ff3-8bac-84f17fe6e8d0
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: d77b7f23-7506-4ff3-8bac-84f17fe6e8d0

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Active-run API failures can be silently ignored, allowing duplicate triage dispatches.

1 open issue
2 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: d77b7f23-7506-4ff3-8bac-84f17fe6e8d0

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The duplicate guard misses concurrency-pending runs, allowing redundant dispatches that can recreate empty-run credit charges.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Include pending runs in duplicate guard status checks

.github/​workflows/​dependabot-triage-schedule.yml:50

🛑 Requirement: Include concurrency-pending runs in the duplicate guard

The downstream workflow still serializes runs through its workflow-wide concurrency group (.github/workflows/dependabot-triage.lock.yml:82-84). Runs waiting for that group have status pending, which this loop omits. If a batch spans the next poll, the scheduler can dispatch those PRs again; it also misses a pending broad manual run. After the original assessments post, duplicate runs can take the no-work path and recreate the maximum-credit fallback charges this PR addresses.

Include pending in the queried statuses so the existing title checks cover concurrency-blocked runs too.

References:
https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency

1 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: d77b7f23-7506-4ff3-8bac-84f17fe6e8d0
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: d77b7f23-7506-4ff3-8bac-84f17fe6e8d0

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The duplicate guard misses concurrency-pending runs, allowing redundant dispatches that can recreate no-work credit charges.

1 open issue

Review effort: Balanced

Comment thread .github/scripts/dependabot-triage.sh Resolved
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: d77b7f23-7506-4ff3-8bac-84f17fe6e8d0

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Failed comment lookups can dispatch unnecessary agent runs and recreate no-work credit charges.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Fail selection when assessment comment lookup errors

.github/​scripts/​dependabot-triage.sh:96

🛑 Requirement: Fail selection when assessment comments cannot be read

The trailing fallback hides comment API failures as well as missing markers. In the new scheduler, a failed lookup therefore makes an already-assessed PR eligible for dispatch. If the agent's repeated lookup succeeds, the unnecessary run takes the noop path and can incur the maximum-credit fallback this PR aims to avoid. Fetch comments in a separate assignment that stops selection on failure, and tolerate missing markers only after a successful response.

1 resolved since last review

Review effort: Balanced

@williammartin
williammartin merged commit b1c8c0a into trunk Oct 19, 2026
17 checks passed
@williammartin
williammartin deleted the williammartin-investigate-dependabot-aic branch October 19, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dependabot triage should avoid agent jobs when no work exists

4 participants