Skip to content

Add Dependabot alert update tool - #3887

Merged
belaltaher8 merged 2 commits into
mainfrom
belaltaher8-oss-dependabot-alert-update
Nov 19, 2026
Merged

belaltaher8 merged 2 commits into
mainfrom
belaltaher8-oss-dependabot-alert-update

Conversation

@belaltaher8

@belaltaher8 belaltaher8 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add update_dependabot_alert to the opt-in Dependabot toolset for reopening, dismissing, or assigning alerts. Preserve exact alert IDs and return only the actual update response fields.

Why

Dependabot tools currently retrieve alerts but cannot apply a triage decision or change ownership. This adds the public REST update operation alongside those reads without changing their behavior. No linked issue.

What changed

  • Register the write tool using the existing inventory, scope, authenticated client, and security-alert labeling conventions; exclude it in read-only mode.
  • PATCH only supplied state/dismissal/assignee fields, inheriting the configured client's API version, base URL, authentication, and transport exactly like existing alert reads. An empty assignee array clears assignments; omitted fields stay untouched. No host-specific version override or mutation retry is introduced.
  • Validate positive exact int64 alert numbers from original JSON, optional-field nulls, dismissal requirements, and comment length. Reject unknown fields, including unsupported agent_assignment.
  • Return the API's actual state and narrow response, with the alert number encoded as a decimal string. Copilot assignment requests remediation, not a guaranteed fix or pull request.
  • If a successful HTTP response cannot be decoded or validated, warn that the update may already have applied and direct callers to get_dependabot_alert before retrying; retain diagnostic details and never retry automatically.
  • Add registered-call, direct-call, inventory, CLI, scope, and schema coverage; update the tool snapshot, generated README, and security triage skill.

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
  • New tool added

update_dependabot_alert requires separate owner, repo, and integer alertNumber, plus state or assignees. It is opt-in through dependabot; existing tools are unchanged. Cross-field requirements are checked at runtime without top-level schema combinators.

Prompts tested (tool changes only)

Equivalent tool calls were tested against mocked REST responses, not through live natural-language sessions:

  • "Dismiss Dependabot alert 42 in octo/widgets as tolerable risk with an empty comment."
  • "Assign Dependabot alert 42 in octo/widgets to copilot-swe-agent[bot]."
  • "Clear all assignees from Dependabot alert 42 in octo/widgets without changing its state."
  • "Reopen Dependabot alert 9007199254740993 in octo/widgets."

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Uses existing authentication and the classic OAuth security_events scope, matching the alert reads; fine-grained tokens need Dependabot alerts write permission. GitHub continues to enforce permissions, licensing, repository policies, and delegated-dismissal review. No new grants or confirmation field are introduced. Success returns a narrow, security-labeled response; API errors are surfaced without fallback writes. Comments are limited to 280 characters. Tests cover exact 9007199254740993 and max-int64 IDs, fractional/overflow rejection, nulls, omission, and both supported protocol eras.

The public 2022-11-28 OpenAPI schema includes all PATCH fields used here, including assignment; no newer API version is required. Cloud and enterprise requests retain client defaults. Unsupported features remain explicit API errors. Unusable successful responses are not evidence that the mutation failed: inspect the alert before any retry.

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

No existing tool names change.

Note: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.

Lint & tests

  • Linted locally with ./script/lint — passed, zero issues, including the review fixes.
  • Tested locally with ./script/test — passed, full race-enabled suite, including the review fixes.

Additional validation:

  • UPDATE_TOOLSNAPS=true go test ./... — passed for the initial tool addition; review fixes do not alter schemas.
  • go test ./pkg/github ./pkg/inventory ./pkg/skills/catalog ./cmd/github-mcp-server -run 'TestUpdateDependabotAlert|TestDependabotUpdateListScopes|TestCatalogToolRequirementsAreRegistered|TestCreateToolScopeFilter|TestTypedSecurity' -count=1 — passed matching tests; inventory had no matching selectors and was covered by the full suite.
  • go test ./pkg/github -run TestUpdateDependabotAlert -count=1 — passed after removing version overrides and adding uncertain-outcome handling; covers client defaults/authentication/base URLs, unsupported enterprise assignment, successful decode/validation failures, and exact single-PATCH counts.
  • go build ./cmd/github-mcp-server — passed.
  • ./github-mcp-server list-scopes --toolsets=dependabot --output=json — passed; reports security_events for the write tool.
  • ./github-mcp-server list-scopes --toolsets=dependabot --read-only --output=json — passed; excludes the write tool.
  • git diff --check — passed.

Live API/e2e tests were not run; no repository alerts were modified.

Docs

  • Not needed
  • Updated (README / docs / examples)

script/generate-docs — passed; README tool documentation regenerated. Review fixes preserve the tool schema and generated documentation.

Skills

  • Updated relevant skills or confirmed no bundled skill applies

Updated the security-alert-triage skill, alert source reference, and tool mapping to cover requested Dependabot updates without treating a recommendation as a completed update. The skill also requires inspecting the alert before retrying an update with an uncertain result.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@belaltaher8
belaltaher8 requested a review from a team as a code owner November 18, 2026 19:18
Copilot AI adaptive review requested due to automatic review settings November 18, 2026 19:18
Comment thread pkg/github/update_dependabot_alert.go Resolved
@belaltaher8 belaltaher8 mentioned this pull request Nov 18, 2026
8 of 14 tasks

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 unconditional API version breaks some Enterprise Server requests, and treating successful responses with unusable bodies as update failures risks duplicate non-idempotent Copilot remediation requests.

2 open issues
What changed in this PR

Adds update_dependabot_alert to the opt-in Dependabot toolset, enabling alert triage updates alongside existing read tools.

Changes:

  • Supports reopening, dismissing, and replacing assignees, with strict validation and exact alert-number handling.
  • Applies existing authentication, scope, security-labeling, and read-only filtering conventions.
  • Adds behavioral and integration coverage, a schema snapshot, and updated documentation.
File Description
README.md Documents the new tool and its parameters.
pkg/​skills/​catalog/​tools.go Maps the update tool to the security triage skill.
pkg/​skills/​catalog/​skills/​security-alert-triage/​SKILL.md Explains confirmed updates and accurate outcome reporting.
pkg/​skills/​catalog/​skills/​security-alert-triage/​references/​alert-sources.md Lists the optional Dependabot update capability.
pkg/​github/​update_dependabot_alert.go Implements validation, PATCH requests, and narrow responses.
pkg/​github/​update_dependabot_alert_test.go Covers updates, validation, exact numbers, protocols, and inventory.
pkg/​github/​typed_security_outputs_test.go Adds output-schema support for the new tool’s tests.
pkg/​github/​tools.go Registers the tool in the inventory.
pkg/​github/​__toolsnaps__/​update_dependabot_alert.snap Records tool metadata and input/output schemas.
cmd/​github-mcp-server/​main_test.go Tests scope reporting and read-only exclusion.

Review effort: Max (adaptive)

Comment thread pkg/github/update_dependabot_alert.go Resolved
Comment thread pkg/github/update_dependabot_alert.go Resolved
@belaltaher8
belaltaher8 added this pull request to stack #3890 November 18, 2026 19:38
Comment thread pkg/github/update_dependabot_alert.go Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread pkg/github/update_dependabot_alert.go Dismissed
@belaltaher8
belaltaher8 merged commit 05bfb0c into main Nov 19, 2026
21 checks passed
@belaltaher8
belaltaher8 deleted the belaltaher8-oss-dependabot-alert-update branch November 19, 2026 17:01
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.

4 participants