Skip to content

Always return empty labels/assignees/reviewers in issue and PR read outputs - #3626

Open
timrogers wants to merge 1 commit into
mainfrom
always-return-empty-issue-pr-collections
Open

timrogers wants to merge 1 commit into
mainfrom
always-return-empty-issue-pr-collections

Conversation

@timrogers

Copy link
Copy Markdown
Contributor

Summary

Issue and PR read outputs now always include labels and other core collections (as [] when empty) instead of omitting them, so "no labels" is distinguishable from "not returned".

Why

issue_read get dropped labels entirely for unlabeled issues (via omitempty), while assignees was always present as []. Nothing in the output schema explained that a missing key means "empty", so agents could reasonably treat it as unknown and make an extra get_labels call. This extends the existing MinimalIssue.Assignees convention.

What changed

  • MinimalIssue: labels and comments are always emitted (non-nil [] / 0).
  • IssueDetailsOutput and SubIssueOutput: labels (and comments for details) no longer omitempty.
  • MinimalPullRequest: labels, assignees, requested_reviewers always emitted as non-nil lists.
  • Regenerated toolsnaps; these fields are now required in the output schemas.
  • Updated test expectations.

MCP impact

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

issue_read (get, get_sub_issues), pull_request_read (get) and sub_issue_write outputs now always include these fields. Because the structs are shared, list_issues, search_issues and list_pull_requests text output also gains the empty lists. PR counts (additions, commits, comments, …) intentionally remain omitempty because list_pull_requests doesn't populate them, so emitting 0 would be misleading.

Prompts tested (tool changes only)

  • Covered by unit/wire tests; e.g. "What labels are on issue Fix VS Code inputs link #103?" against an unlabeled issue now returns "labels": [] from issue_read get.

Security / limits

  • No security or limits impact

Adds a few bytes per item for empty lists.

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

Lint & tests

  • Linted locally with ./script/lint — golangci-lint not installed locally; go vet and gofmt clean, relying on CI.
  • Tested locally with ./script/test (go test ./... passes)

Docs

  • Not needed

./script/generate-docs produces no changes.

…utputs

Previously empty collections were omitted via omitempty, making "no labels"
indistinguishable from "labels not returned". issue_read now always returns
labels and comments; pull_request_read always returns labels, assignees and
requested_reviewers. The fields are now required in the output schemas.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@timrogers
timrogers requested a review from a team as a code owner October 30, 2026 06:11
Copilot AI auto review requested due to automatic review settings October 30, 2026 06:11

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.

🟢 Approval recommended

No active review issues are outstanding for the changes that make empty collections explicit in issue and pull request outputs.

No open issues 🎉

What changed in this PR

This PR makes empty collections explicit in GitHub MCP Server issue and pull request outputs, allowing clients to distinguish “empty” from “not returned.”

Changes:

  • Always emit issue labels and comment counts, plus pull request labels, assignees, and requested reviewers.
  • Initialize empty collections as [] and mark the corresponding output schema fields as required.
  • Update wire-output expectations and schema tests while keeping pull request counts optional.
File Description
pkg/​github/​typed_issue_outputs_test.go Expect empty labels and zero comments in issue outputs.
pkg/​github/​typed_granular_issue_outputs_test.go Update sub-issue output and schema expectations.
pkg/​github/​typed_consolidated_pull_request_outputs_test.go Verify required empty pull request collections.
pkg/​github/​typed_consolidated_issue_outputs_test.go Update consolidated issue output and schema cases.
pkg/​github/​typed_consolidated_issue_enrichment_test.go Include empty labels and zero comments in enriched outputs.
pkg/​github/​minimal_types.go Emit required fields and initialize empty collections.
pkg/​github/​consolidated_issue_types.go Make typed issue labels and detail comment counts required.
pkg/​github/​__toolsnaps__/​sub_issue_write.snap Require labels in sub-issue mutation outputs.
pkg/​github/​__toolsnaps__/​reprioritize_sub_issue.snap Require labels in reprioritization outputs.
pkg/​github/​__toolsnaps__/​remove_sub_issue.snap Require labels in sub-issue removal outputs.
pkg/​github/​__toolsnaps__/​pull_request_read.snap Require labels, assignees, and requested reviewers.
pkg/​github/​__toolsnaps__/​issue_read.snap Require labels and issue-detail comment counts.
pkg/​github/​__toolsnaps__/​add_sub_issue.snap Require labels in sub-issue addition outputs.

Review effort: Balanced (auto)

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