Skip to content

Add rationale and confidence to closing an issue#2802

Draft
iulia-b wants to merge 1 commit into
mainfrom
iunia/issues-granular-update-state
Draft

Add rationale and confidence to closing an issue#2802
iulia-b wants to merge 1 commit into
mainfrom
iunia/issues-granular-update-state

Conversation

@iulia-b

@iulia-b iulia-b commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Similar to fields and type, this PR adds the ability of suggesting a "close issue" intent, with confidence, rationale, and support for duplicate issue .

Why

Fixes https://github.com/github/plan-track-agentic-toolkit/issues/343

What changed

  • Rewrote the granular update_issue_state tool as a standalone function (off the issueUpdateTool helper)
  • added four new optional params: rationale, confidence, is_suggestion, and duplicate_of
  • When intent params are provided, the tool sends the state as an object {"state": {"value": "closed", ...}} to the REST API instead of a plain string
  • duplicate_of accepts an issue number and resolves it to a DB id before sending duplicate_issue_id in the request body.
  • Suggestion closes as duplicate require duplicate_of. Direct closes do not.

MCP impact

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

Prompts tested (tool changes only)

Security / limits

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

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

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
  • Tested locally with ./script/test

Docs

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

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

This PR extends the granular update_issue_state tool to support “close issue” intent metadata (rationale, confidence, and suggestion semantics) and adds support for closing as a duplicate by resolving an issue number to a database ID for duplicate_issue_id.

Changes:

  • Reworks update_issue_state into a standalone tool handler so it can send either the standard REST body or an object-form state payload with intent metadata.
  • Adds new optional parameters: rationale, confidence, is_suggestion, and duplicate_of (with lookup to duplicate_issue_id).
  • Updates tests, tool schema snapshot, and feature-flag documentation for the new parameters.
Show a summary per file
File Description
pkg/github/issues_granular.go Implements object-form state update payload (intent metadata) and duplicate resolution flow for update_issue_state.
pkg/github/granular_tools_test.go Adds coverage for suggestion mode, duplicate handling, and validation errors for the updated tool behavior.
pkg/github/toolsnaps/update_issue_state.snap Updates the tool snapshot to reflect new schema fields and updated description.
docs/feature-flags.md Documents the new update_issue_state parameters for feature-flagged granular issues tools.

Review details

  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment on lines +744 to +748
stateReason, err := OptionalParam[string](args, "state_reason")
if err != nil {
return utils.NewToolResultError(err.Error()), nil, nil
}
rationale, err := OptionalParam[string](args, "rationale")
Comment thread docs/feature-flags.md
- **update_issue_state** - Update Issue State
- **Required OAuth Scopes**: `repo`
- `confidence`: How confident you are in this choice. Use 'HIGH' for clear signal or explicit user request, 'MEDIUM' for reasonable inference with some ambiguity, 'LOW' for best guess with limited signal. (string, optional)
- `duplicate_of`: The issue number this issue is a duplicate of. Only valid when state_reason is 'duplicate' and is_suggestion is true. (number, optional)
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