Skip to content

Add opt-in intent-aware Copilot issue assignment tool#2909

Open
boazreicher wants to merge 2 commits into
mainfrom
add-assign-copilot-to-issue-with-intent
Open

Add opt-in intent-aware Copilot issue assignment tool#2909
boazreicher wants to merge 2 commits into
mainfrom
add-assign-copilot-to-issue-with-intent

Conversation

@boazreicher

Copy link
Copy Markdown
Contributor

Adds assign_copilot_to_issue_with_intent in a new non-default toolset copilot_issue_intents. The tool uses GraphQL's object-form assignees: [AssigneeUpdateInput!] so intent metadata (rationale, confidence, is_suggestion) is attached to the Copilot entry only, while existing assignees are preserved.

Refs: github/plan-track-agentic-toolkit#683

Design

  • Object-form assignees (extending our existing UpdateIssueInput) is used instead of assigneeIds. The legacy assign_copilot_to_issue tool is unchanged; the new tool is opt-in.
  • Intent metadata (rationale, confidence, suggest) is set only on the Copilot entry. Preserved assignees are sent with just actorId.
  • `agentAssignment` remains the separate launch configuration and is only sent on direct assignments.
  • The GraphQL-Features header issues_copilot_assignment_api_support is kept, along with the existing repo scope requirement.

Behavior

  • Direct assignment (is_suggestion unset or false): launches Copilot with the same base_ref, custom_instructions, and PR-polling behavior as assign_copilot_to_issue.
  • Suggestion (is_suggestion: true): records a pending Copilot assignment intent, returns a suggestion-shaped result, and does not launch Copilot or poll for a linked PR. base_ref and custom_instructions are ignored in this case.
  • Input validation: rationale capped at 280 characters (schema `maxLength` + runtime rune-count check); confidence restricted to `LOW`/`MEDIUM`/`HIGH` (case-insensitive at runtime, uppercase-only in schema enum).

Toolset

New non-default copilot_issue_intents toolset — available via X-MCP-Tools/--toolsets copilot_issue_intents, all, or explicit tool selection. It is intentionally kept out of the default configuration so its inputs do not add schema bloat to the default tool surface, matching the guidance in the source issue.

Acceptance criteria

  • The tool is absent with `default` toolsets and present via its non-default toolset, `all`, or explicit individual-tool selection.
  • Existing assignees are preserved.
  • `is_suggestion: true` creates a pending Copilot assignment intent, returns a suggestion-shaped result, and does not poll for or claim PR creation.
  • A direct assignment launches Copilot and retains existing base-ref, custom-instruction, and PR-polling behavior.
  • Invalid rationale length and confidence values fail schema/runtime validation.
  • Unit tests cover direct and suggested paths, toolsnaps are updated, generated docs are updated, and the relevant end-to-end coverage is extended.

Testing

  • `script/lint` — clean.
  • `script/test` — all packages pass.
  • New unit tests in `pkg/github/copilot_test.go` cover: direct assignment with existing assignees + rationale/confidence; direct assignment with `base_ref`/`custom_instructions`; suggestion path (asserts no `agentAssignment`, no polling, no `pull_request` in result); invalid rationale length; invalid confidence; and Copilot-not-available. The test also asserts the tool lives in the non-default `copilot_issue_intents` toolset.
  • New toolsnap: `pkg/github/toolsnaps/assign_copilot_to_issue_with_intent.snap`.
  • Regenerated `README.md` and `docs/remote-server.md` via `script/generate-docs`.
  • New e2e test `TestAssignCopilotToIssueWithIntent` exercises the `is_suggestion=true` path end-to-end (skipped when Copilot is not available for the current account, mirroring the existing test).

Add `assign_copilot_to_issue_with_intent` in a new non-default toolset
`copilot_issue_intents`. The tool uses GraphQL's object-form
`assignees: [AssigneeUpdateInput!]` so intent metadata (rationale,
confidence, is_suggestion) is attached to the Copilot entry only, while
existing assignees are preserved.

- Reuses the existing Copilot actor lookup, target-repository
  resolution, base_ref, custom_instructions, GraphQL-Features header,
  and direct-assignment PR polling behavior.
- `is_suggestion: true` records a pending Copilot assignment intent,
  returns a suggestion-shaped result, and does not launch Copilot or
  poll for a linked PR.
- `rationale` is capped at 280 characters (schema + runtime);
  `confidence` is validated against `LOW`/`MEDIUM`/`HIGH`.
- Toolset is non-default so its inputs do not add schema bloat to the
  default tool surface; available via `copilot_issue_intents`,
  `all`, or explicit tool selection.

Includes unit tests for direct assignment (with existing assignees and
with base_ref/custom_instructions), the suggestion path, invalid
rationale length, invalid confidence, and Copilot-not-available; a
generated toolsnap; regenerated docs; and an e2e test for the
suggestion path.

Refs: github/plan-track-agentic-toolkit#683
@boazreicher
boazreicher requested a review from a team as a code owner July 19, 2026 12:43
Copilot AI review requested due to automatic review settings July 19, 2026 12:43

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.

Pull request overview

Adds an opt-in tool for assigning or suggesting Copilot on issues with intent metadata.

Changes:

  • Adds intent-aware direct and suggested assignment flows.
  • Introduces the non-default copilot_issue_intents toolset.
  • Adds unit, snapshot, end-to-end, and generated documentation coverage.
Show a summary per file
File Description
README.md Documents the toolset and tool.
pkg/github/tools.go Registers the opt-in toolset and tool.
pkg/github/copilot.go Implements intent-aware assignment behavior.
pkg/github/copilot_test.go Tests schema, validation, and assignment paths.
pkg/github/__toolsnaps__/assign_copilot_to_issue_with_intent.snap Captures the tool schema.
e2e/e2e_test.go Tests suggested assignment end to end.
docs/remote-server.md Documents remote toolset access.

Review details

  • Files reviewed: 7/7 changed files
  • Comments generated: 0
  • Review effort level: Medium

alondahari
alondahari previously approved these changes Jul 20, 2026
"readOnlyHint": false,
"title": "Assign Copilot to issue with intent"
},
"description": "Assign Copilot to a specific issue with intent metadata attached to the assignment. When is_suggestion is true, a pending Copilot assignment intent is recorded rather than launching the agent; otherwise Copilot is directly assigned and begins work.\n\nThis tool can help with the following outcomes:\n- a Pull Request created with source code changes to resolve the issue (direct assignment)\n- a pending Copilot assignment suggestion is recorded on the issue for later approval (is_suggestion=true)\n\n\nMore information can be found at:\n- https://docs.github.com/en/copilot/using-github-copilot/using-copilot-coding-agent-to-work-on-tasks/about-assigning-tasks-to-copilot\n",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we trim this description a bit? it's too verbose and repeats information, imo which adds to the schema bloat

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we can have an identical description to the assign_copilot_to_issue tool, and just add to it "prefer this tool over assign_copilot_to_issue when available"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — trimmed the description to mirror assign_copilot_to_issue with an appended "Prefer this tool over assign_copilot_to_issue when available" note. Removed the verbose is_suggestion narrative from the schema in bf2defd.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Went with exactly this — description now matches assign_copilot_to_issue plus the preference note. See bf2defd.

Comment thread pkg/github/copilot.go Outdated
Description: "If true, records a pending Copilot assignment intent rather than launching the agent. Approval later supplies the launch context; base_ref and custom_instructions are ignored in this case.",
},
},
Required: []string{"owner", "repo", "issue_number"},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we require the intent fields?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — rationale, confidence, and is_suggestion are now required in both the schema and at runtime. Added missing-field tests. is_suggestion is always sent explicitly on the Copilot AssigneeUpdateInput entry now. See bf2defd.

Per review feedback on #2909:

- Trim the tool description to mirror assign_copilot_to_issue and add
  "Prefer this tool over assign_copilot_to_issue when available",
  removing the verbose is_suggestion narrative from the schema.
- Make rationale, confidence, and is_suggestion required inputs (schema
  and runtime). is_suggestion is now always sent explicitly on the
  Copilot AssigneeUpdateInput entry.
- Update unit tests to supply the newly-required fields and cover the
  missing-rationale and missing-confidence rejection paths.
- Regenerate toolsnap and README.
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.

3 participants