Neovim: the CLI's real shapes, a failed turn said, the agent's life, and a stand-in both editors share

The stand-in agent (tests/fake_agent.py) now answers only as LLeMbas CLI 2.0.0-beta.17 does and
checks what it is sent as the CLI checks it; the Neovim tests also run against the CLI itself when
its source is at hand, with a home of its own.

Fixed in the plugin: a failed turn was silent; token usage and progress were read from fields the
CLI does not send; a file the agent had read here and that was not open could not be edited; a
server failure switched autocomplete off; not being signed in pointed at the model picker; no
request had a time limit; an agent that ignored a stop was left running.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Fable 5.2 committed 2026-12-01 19:18:05 +00:00
1 parent dd2bc2dcae
commit e4381217b4
10 files changed
+2211 -582

No files matched your search

+6 -3
View File
@@ -244,19 +244,22 @@ local function run_edit(buf, first, last, instruction, verb)
if not conn then
rewriting[buf] = nil
written_by_id[id] = nil
return vim.notify("LLeMbas: the agent did not start", vim.log.levels.ERROR)
vim.api.nvim_echo({ { "" } }, false, {})
return vim.notify("LLeMbas: " .. (L._state.start_error or "the agent did not start"), vim.log.levels.ERROR)
end
local body_text = table.concat(text, "\n")
if body_text == "" then body_text = " " end
conn:request("_lembas/edit", {
id = id, cwd = vim.fn.getcwd(), sessionId = L._state.session, path = name ~= "" and name or nil,
text = body_text, before = table.concat(before, "\n"), after = table.concat(after, "\n"),
language = vim.bo[buf].filetype, instruction = instruction, model = L.config.model,
language = vim.bo[buf].filetype ~= "" and vim.bo[buf].filetype or nil, instruction = instruction,
-- With a session its model writes; without one, the model a session here would start on.
model = (not L._state.session) and L.config.model or nil,
}, function(err, r)
if rewriting[buf] == id then rewriting[buf] = nil end
written_by_id[id] = nil
vim.api.nvim_echo({ { "" } }, false, {})
if err then return vim.notify("LLeMbas: " .. tostring(err.message), vim.log.levels.ERROR) end
if err then return vim.notify("LLeMbas: " .. L._say(err), vim.log.levels.ERROR) end
if not r or r.cancelled or not vim.api.nvim_buf_is_valid(buf) then return end
if vim.api.nvim_buf_get_changedtick(buf) ~= tick then
return vim.notify("LLeMbas: the buffer changed while the rewrite was written; nothing is shown. Ask again.", vim.log.levels.WARN)