Skip to content

fix: apply_suggestion uses wrong API endpoint causing 404 errors #115

@polaz

Description

@polaz

Problem

When using apply_suggestion or apply_suggestions actions in manage_mr_discussion tool, GitLab returns 404 errors even when the suggestion exists.

Error example:

{
  "error_code": "NOT_FOUND",
  "tool": "manage_mr_discussion",
  "action": "apply_suggestion",
  "http_status": 404,
  "message": "Resource not found or you don't have access to it"
}

Root Cause

We were using incorrect nested endpoints:

  • PUT /projects/:id/merge_requests/:iid/suggestions/:sid/apply
  • PUT /projects/:id/merge_requests/:iid/suggestions/batch_apply

But GitLab Suggestions API uses global endpoints:

  • PUT /suggestions/:id/apply
  • PUT /suggestions/batch_apply

Suggestion IDs are globally unique and don't require project/MR context in the URL.

Solution

Update the handler in src/entities/mrs/registry.ts to use the correct global endpoints.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions