Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

toggle_discussions() doesn't open new window - draft_notes error 404

未关闭
#507 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

已经有一个关联 PR 被合并了。

  • #552 来自 @jakubbortlik —— 已合并

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
lua, neovim
领域
api, devtools

调研方向

从 require("gitlab").toggle_discussions() 和已记录的 draft_notes 请求开始,然后将文档中说明的 API 可用性与报告的 GitLab 13.12 实例进行比较。在进行更改之前,检查相关 pull request 的历史记录。完成的标准应是:通过兼容性或记录在案的限制,明确此服务器版本的讨论窗口行为。

由索引模型根据 Issue 内容生成。

描述

Prerequsities

  • I'm on the latest version of the plugin
  • I've installed the required dependencies
  • I've run :h gitlab.nvim.troubleshooting and followed the steps there

Setup Configuration and Environment

return {
    "harrisoncramer/gitlab.nvim",
    dependencies = {
        "MunifTanjim/nui.nvim",
        "nvim-lua/plenary.nvim",
        "sindrets/diffview.nvim",
        "nvim-tree/nvim-web-devicons"
    },
    lazy = false,
    build = function() require("gitlab.server").build(true) end, -- Builds the Go binary
    keys = function()
        local map = require('map')
        map.map('n', '<leader>gm', function() require("gitlab").choose_merge_request() end, { desc = "[m]erge request view (gitlab)" } )
        map.exportKeys()
    end,
    config = function()
        require("gitlab").setup({
            auth_provider = function()
                return "<redacted>", "<redacted>", nil
            end,
            connection_settings = {
                insecure = true,
            },
            debug = {
                request = true,
                response = true,
                gitlab_request = true,
                gitlab_response = true,
            },
        })
    end,
}

Bug Description

require("gitlab").toggle_discussions() does not open discussion window.
Error notificaiton:
gitlab.nvim: Could not get draft notes: 404 Not Found

Reproduction Steps

  1. Add my plugin configuration file to neovim with Lazy.nvim installed (tested without other plugins).
  2. Run require("gitlab").choose_merge_request(), select MR.
  3. Use gld to open discussion window.
  4. Result: No new windows is opened. Error message about draft_notes being not found appears.

Additional info

Output's of commands from gitlab.nvim.troubleshooting:

  1. checkhealth gitlab
==============================================================================
gitlab:                                       require("gitlab.health").check()

gitlab.nvim ~
- ⚠️ WARNING stevearc/dressing.nvim is a recommended dependency
  1. require("gitlab").print_settings() - prints defaults + changes from my config as expected.

  2. require("gitlab.server").build(true)

gitlab.nvim: Installed successfully!
  1. require("gitlab.server").start(function() print("Server started") end)
gitlab.nvim: Failed to initialize Gitlab client: GitLab instance URL cannot be empty
gitlab.nvim: Golang gitlab server exited: job_id: 3, exit_code: 1

but if I first use require("gitlab").choose_merge_request() and then do require("gitlab.server").restart() then server is restarted without any issue:

gitlab.nvim: Restarted server
  1. I've enabled debug logs and here is example of failure in logs:
-- REQUEST TO GO SERVER --
GET /mr/draft_notes/ HTTP/1.1
Host: localhost:45393
Accept: */*
Private-Token: REDACTED
User-Agent: curl/7.81.0

-- REQUEST TO GITLAB --
GET /api/v4/projects/2253/merge_requests/710/draft_notes HTTP/1.1
Host: <redacted>
Accept: application/json
Private-Token: REDACTED
User-Agent: go-gitlab

-- RESPONSE FROM GITLAB --
HTTP/1.1 404 Not Found
Content-Length: 25
Cache-Control: no-cache
Connection: keep-alive
Content-Type: application/json
Date: Tue, 16 Sep 2025 17:25:01 GMT
Server: nginx
Vary: Origin
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Gitlab-Feature-Category: not_owned
X-Request-Id: 01K59RXX1PQGGYRNDE1B63SDFV
X-Runtime: 0.011073

{"error":"404 Not Found"}

-- RESPONSE FROM GO SERVER --
HTTP/0.0 500 Internal Server Error
Content-Length: 66
Content-Type: application/json

{"message":"Could not get draft notes","details":"404 Not Found"}

Update

One more observation. I am able to create comments, but creation of draft comment fails.
After I create a comment diagnostic symbols for comments are finally loaded and I can list comments via diagnostic listing.

Also:

 curl --insecure --header "PRIVATE-TOKEN: <redacted>" --url "https://<redacted>/api/v4/projects/2253/merge_requests/710/draft_note"

fails with error 404, but:

 curl --insecure --header "PRIVATE-TOKEN: <redacted>" --url "https://<redacted>/api/v4/projects/2253/merge_requests/710/discussions"

returns valid JSON.
And

 curl --insecure --header "PRIVATE-TOKEN: <redacted>" --url "https://<redacted>/api/v4/projects/2253/merge_requests/710/notes"

also returns valid JSON.

Update 2

I've found the root cause, it seems like draft_notes API was introduced in version 16.0 (or at least somewhere between 15.0 and 16.0). The gitlab that I have to use is version 13.12.
Am I correct to assume that there is nothing I can do to make it work?

主要语言
Lua
星标
402
派生
64
平均合并
7 小时 17 分钟
30 天内合并 PR
4

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

harrisoncramer/gitlab.nvim 的其他 Issue

查看 harrisoncramer/gitlab.nvim 的全部 Issue

相似的 Issue

更多 Lua Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。