github-mcp-server icon indicating copy to clipboard operation
github-mcp-server copied to clipboard

warn that issue_write body REPLACES content, not appends (fixes #2410)

Open jluocsa opened this issue 6 months ago • 3 comments

Summary

Fixes #2410.

The body parameter on issue_write (method='update') replaces the entire issue body — matching REST API semantics, but LLM agents frequently misinterpret body as "add a note about this issue" and end up silently destroying the original issue description. Real-world examples from the linked issue:

  • "Close issue #42 and explain why it was fixed" → agent overwrites the original body with a closing note
  • "Mark issue #17 as duplicate and leave a note" → agent replaces body with "duplicate of #X"
  • "Update issue #8 status to closed with resolution" → body silently destroyed

This PR updates the body parameter description to make the replace-not-append semantics explicit and to point users at add_issue_comment for the common "leave a note" use case.

This is option 1 from the issue (description-only fix). Option 2 (a separate comment parameter) would be a larger schema change; happy to follow up with that as a separate PR if desired.

Before

Issue body content

After

Issue body content (Markdown). On method='update', this REPLACES the entire issue body, it does NOT append. To add a comment to an issue without modifying its body, use the add_issue_comment tool instead.

Files changed (3 files / 3 lines)

  • pkg/github/issues.go — the body parameter description
  • pkg/github/__toolsnaps__/issue_write.snap — regenerated via UPDATE_TOOLSNAPS=true go test ./pkg/github -run ^Test_CreateIssue$
  • README.md — regenerated via go run ./cmd/github-mcp-server generate-docs

The granular issue tools (update_issue_body, add_issue_comment) don't have this confusion and were not modified.

Validation

  • Test_CreateIssue passes
  • go test ./... passes for all 22 packages
  • Toolsnap diff is exactly the description string change
  • README diff is exactly the description string change

Note: I was unable to run script/lint locally (no golangci-lint available in my environment). CI should validate it. Happy to iterate if anything surfaces.

jluocsa avatar May 08 '26 03:05 jluocsa

Rebased onto current main (head b7808ec). The change is still just the single description-string swap on issue_write.body (Go source + toolsnap + auto-gen README) and all three files match. Could a maintainer add ok-to-test so CI can run? Happy to address review comments — fixes #2410.

jluocsa avatar May 22 '26 23:05 jluocsa

Addressed @Copilot's two review comments in 7f20410: dropped the secondary does NOT shouting (kept REPLACES as the single emphatic warning, since that's the whole point of #2410), tightened phrasing, and regenerated the three doc surfaces. Net change is still 5 lines across 5 files (single description string + 3 regenerated doc views + 1 snap).

jluocsa avatar May 22 '26 23:05 jluocsa

Picked this up from the work queue — found and fixed a CI-blocking toolsnap mismatch that would fail once ok-to-test runs.

Root cause

The description change was applied to IssueWrite (feature-flag-enabled) and the canonical issue_write.snap, but:

  • LegacyIssueWrite still had the old "Issue body content" description (this variant owns issue_write.snap per Test_LegacyIssueWrite_Definition)
  • issue_write_ff_remote_mcp_issue_fields.snap was never regenerated (owned by Test_UpdateIssue)

Running the snapshot tests locally reproduces both failures:

Test_LegacyIssueWrite_Definition — snap has new text, LegacyIssueWrite code does not
Test_UpdateIssue — IssueWrite has new text, ff snap does not

Fix (commit d991333)

  1. Applied the same body description to LegacyIssueWrite in pkg/github/issues.go
  2. Regenerated issue_write_ff_remote_mcp_issue_fields.snap via UPDATE_TOOLSNAPS=true go test ./pkg/github -run 'Test_LegacyIssueWrite_Definition|Test_UpdateIssue'
  3. Rebased the branch onto current main (was BEHIND)
  4. go test ./... passes locally

Branch with the fix: https://github.com/advancedresearcharray/github-mcp-server/tree/fix/issue_write-body-description-2410

To pull into this PR:

git fetch https://github.com/advancedresearcharray/github-mcp-server.git fix/issue_write-body-description-2410
git cherry-pick d991333   # or reset/rebase onto that branch
git push

Happy to adjust if maintainers prefer a different approach. A maintainer ok-to-test label would let CI confirm.

advancedresearcharray avatar Jun 06 '26 02:06 advancedresearcharray