bug#81514: 32.0.50; Eglot messages progress reporter shows errors

João Távora <[email protected]> Wed, 29 Jul 2026 20:59:45 +0100
Newsgroups gmane.emacs.bugs
Message-ID <CALDnm51=FvXcmaeK=Sa4Swh7rTo_AAiALyVfX31mzUGA58pCxg@mail.gmail.com>
Hi!

If there are confirmed failings in Eglot's usage of progress reporters,
fixes are welcome.

That said, please tread carefully: said fixes must not endanger (or worsen
in any way) the backward compatibility of eglot.el all the way to at least
Emacs 27, where these progress reporters didn't exist or were more
primitive.  I'd also appreciate if said fixes are succinct in nature, and
not architecture-changing...

Thanks!
João









On Wed, Jul 29, 2026, 20:33 Stéphane Marks <[email protected]> wrote:

> On Wed, Jul 29, 2026 at 2:47 PM Stéphane Marks <[email protected]>
> wrote:
>
>> On Wed, Jul 29, 2026 at 11:17 AM Jacek Świerk <[email protected]>
>> wrote:
>>
>>> I can reproduce it with clangd on the following C++ repository:
>>> https://github.com/rui314/mold. It doesn't happen every time but often
>>> enough:
>>>
>>> Debugger entered--Lisp error: (wrong-type-argument sequencep 100)
>>>   ((20 . [1785337541.907988 nil nil "[eglot] mold
>>> backgroundIndexProgress: indexing..." 1 0.2 nil nil]) 20 100)
>>>   progress-reporter-do-update((20 . [1785337541.907988 nil nil "[eglot]
>>> mold backgroundIndexProgress: indexing..." 1 0.2 nil nil]) 100 nil)
>>>   eglot--reporter-update((20 . [1785337541.907988 nil nil "[eglot] mold
>>> backgroundIndexProgress: indexing..." 1 0.2 nil nil]) 100 nil)
>>>   #f(compiled-function (arg1 arg2 arg3 arg4 &rest rest) #<bytecode
>>> 0xa1216d65848076a>)(#<eglot-lsp-server 1022b7360904>
>>> "backgroundIndexProgress" 100 nil)
>>>   #f(compiled-function (arg1 arg2 &rest rest) "Handle $/progress
>>> notification identified by TOKEN from SERVER." #<bytecode
>>> -0xf68beacb9f43862>)(#<eglot-lsp-server 1022b7360904> $/progress :token
>>> "backgroundIndexProgress" :value (:kind "end"))
>>>   apply(#f(compiled-function (arg1 arg2 &rest rest) "Handle $/progress
>>> notification identified by TOKEN from SERVER." #<bytecode
>>> -0xf68beacb9f43862>) #<eglot-lsp-server 1022b7360904> $/progress (:token
>>> "backgroundIndexProgress" :value (:kind "end")))
>>>   eglot-handle-notification(#<eglot-lsp-server 1022b7360904> $/progress
>>> :token "backgroundIndexProgress" :value (:kind "end"))
>>>   apply(eglot-handle-notification #<eglot-lsp-server 1022b7360904>
>>> $/progress (:token "backgroundIndexProgress" :value (:kind "end")))
>>>   #f(compiled-function (server method params) #<bytecode
>>> 0x1f1b657efb0838aa>)(#<eglot-lsp-server 1022b7360904> $/progress (:token
>>> "backgroundIndexProgress" :value (:kind "end")))
>>>   jsonrpc-connection-receive(#<eglot-lsp-server 1022b7360904> (:jsonrpc
>>> "2.0" :method "$/progress" :params (:token "backgroundIndexProgress" :value
>>> (:kind "end"))))
>>>   #f(compiled-function (conn msg) #<bytecode
>>> 0x4e6153735258fd3>)(#<eglot-lsp-server 1022b7360904> (:jsonrpc "2.0"
>>> :method "$/progress" :params (:token "backgroundIndexProgress" :value
>>> (:kind "end"))))
>>>   apply(#f(compiled-function (conn msg) #<bytecode 0x4e6153735258fd3>)
>>> (#<eglot-lsp-server 1022b7360904> (:jsonrpc "2.0" :method "$/progress"
>>> :params (:token "backgroundIndexProgress" :value (:kind "end")))))
>>>   timer-event-handler([t 27242 5829 902968 nil #f(compiled-function
>>> (conn msg) #<bytecode 0x4e6153735258fd3>) (#<eglot-lsp-server 1022b7360904>
>>> (:jsonrpc "2.0" :method "$/progress" :params (:token
>>> "backgroundIndexProgress" :value (:kind "end")))) nil 894000 nil])
>>>
>>> The LSP message that causes it looks like this from the
>>> (eglot-events-buffer):
>>> <-- $/progress
>>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"end"}}}
>>>
>>> Based on my understanding of Eglot code, Eglot creates a non-numeric
>>> progress
>>> reporter because MIN-VALUE and MAX-VALUE arguments are not provided.
>>> However, it
>>> looks like Eglot updates the created progress reporter as it were
>>> numeric:
>>> (eglot--reporter-update pr pcnt msg)
>>>
>>> For the {"kind": "end"} notification, pcnt is set to 100 and msg is nil.
>>> After
>>> commit b6849229003, the pulsing reporter forwards (or update-text value)
>>> as
>>> UPDATE-TEXT. That evaluates to 100. Then progress-reporter-echo-area
>>> tries
>>> (concat (if update-text " " "") update-text) which triggers the shown
>>> error.
>>>
>> I was able to reproduce the issue without eglot and will take a look.
>>
>> Coincidentally, and independent of the issue, eglot seems to want a
>> numeric reporter but instead creates a non-numeric reporter.  eglot-handle-notification
>> method seems to also be missing the call to progress-reporter-done that
>> would clear any stateful reporters it's created such as those in
>> system-taskbar for which a relevant change was made in Tramp recently.  I
>> can take a stab at those.
>>
>
> Here's a patch for progress-reporter.  I can look into eglot separately if
> agreed.
>
> -Stéphane
>