Skip to content

[backport] Fix delete:true on issue fields — REST DELETE fallback (upstream main) #18

Closed as not planned

Description

@gastrodon

Summary

Fixes a silent no-op bug: when deleting the last (or only) issue field value, go-github's omitempty tag on IssueRequest.IssueFieldValues strips the empty slice from the PATCH body. The GitHub REST endpoint's if data.include?(ISSUE_FIELD_VALUES) guard then skips the whole block, leaving the field unchanged. The MCP tool reported success.

Fix: detect the empty-after-filter case in UpdateIssue and fire individual DELETE /repos/{owner}/{repo}/issues/{number}/issue-field-values/{field_id} requests per field as fallback. The DELETE endpoint is idempotent (404 for already-absent fields filtered out), and partial failures are accumulated and reported with per-field detail rather than short-circuiting.

New tests in pkg/github/issues_delete_test.go:

  • Test_IssueRequest_EmptyFieldValues_OmittedByJSON — pins the omitempty contract
  • The 1-of-1 fallback path
  • The N-1 set-semantics path (non-empty kept list → PATCH alone)
  • Test_UpdateIssue_DeleteAbsentFieldIsNoOp — already-cleared field is silent no-op
  • Test_UpdateIssue_DeleteFallbackContinuesOnPartialFailure — partial failures aggregated

Upstream reference

Fork conflict

None. The fork does not have issue field write tools; this is in issues.go in the shared area.

Context

Agents using issue_write with delete: true on issue field values received a success response but the field was never cleared. This was invisible without checking the field state after the call, making it a hard-to-debug data integrity bug in automated workflows.

Activity

  1. gastrodon commented on Jun 27, 2026

    @gastrodon
    Author

    No-op. The fork already has pkg/github/issues_delete_test.go with all five test functions covering the omitempty contract, the 1-of-1 fallback, the N-1 set-semantics path, delete-absent-field no-op, and partial failure aggregation. The REST DELETE fallback logic is present in pkg/github/issues.go.

  2. added
    no-opFork already has equivalent functionality
    on Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backportBackport from upstreambugSomething isn't workingno-opFork already has equivalent functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions