From 680cfe1fa5a15be3770d310153258ba9ded13dd8 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 02:35:56 -0300 Subject: dev, runtime: the language servers' client once, through the session's one queue: both frontends start a query with Inbox.startLsp (its task and its id in the Inbox, an older answer turned away at the push and an older one still queued discarded) and land an answer or a status line with Inbox.landLsp; the session loop sets the language client's status sink on its queue from before the first effects and unsets it before the queue goes, a Restore turns the old core's answer away (discardCompletions, the window's way) and the queue's end cancels the query in flight; the terminal's own copy is deleted (its lsp_task, deliverLspRows posting lsp_done to vaxis's queue, a post that BLOCKED the language worker while that queue was full, lspStatusSink, the lsp_done and lsp_status messages and arms, the cancels in close and restoring) and with it its test of a stale answer at apply (the Inbox's rejection is pinned by gui.zig's worker-setup test); what a user sees: a window now shows an LSP status said during the session's first effects (its sink was set only after them), nothing else; the loop's frontend calls stay nine (close and restoring shrank); tui core-test 857/1007 (150 skipped), shell-test 1046/1049 (-1, the deleted test), term 17/17, pane 183/184, kitty 45/45, behaviour-test and --replay 275/275, process-test 0 of 144 failed (hscroll once in the run, passed on its retry), soaks --clients 5 and --bytes --clients 5 diverged 0, unequal 0, quiet checks 651/0 673/0 779/0 and 920/0 723/0 755/0, unlisted 0, corpus scene 22 of 22, no leak; gui unit-test 1643/1647 with only the perf check's BaselineHarnessMismatch; daemon.py plain, --far, --games, --window-clients, --upgrade both ways pass (load 11-16) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- runtime/session.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/session.zig b/runtime/session.zig index 6f8ab4a3..c8b8dc25 100644 --- a/runtime/session.zig +++ b/runtime/session.zig @@ -7,7 +7,8 @@ //! (`file_watch.Watches`): a step, its unit to the clients and theirs //! taken in, an Upgrade or a Restore between steps; and the order its //! parts end in. Its other devices (the LSP's and the pipes' and addons' -//! jobs, the session's own input) are still its frontend's (each `Shell`). +//! jobs, the session's own input) are still its frontend's (each `Shell`); +//! the language servers' answers come through its queue (`Inbox.startLsp`). //! What a frontend does is: //! //! - `options(o)`: before the core: what it gives the core it starts (a @@ -89,6 +90,9 @@ pub fn Loop(comptime Frontend: type) type { l.peers = .{ .gpa = l.gpa, .io = l.io, .name = daemon.name() }; l.inbox = .{ .io = l.io, .gpa = l.gpa, .lsp_allocator = l.allocs.lsp }; defer l.inbox.deinit(); + // The language servers' status lines, from the first effects on. + pardes.lsp.setStatusSink(&l.inbox, host_io.Inbox.lspStatus); + defer pardes.lsp.setStatusSink(null, null); l.ptys = .{ .queue = &l.inbox, .prompt_rcs = &l.prompt_rcs }; defer l.ptys.deinit(); l.watches = .open(l.io, l.gpa, &l.inbox); @@ -157,6 +161,8 @@ pub fn Loop(comptime Frontend: type) type { fn restore(l: *L, path: []const u8) void { const nc = host_io.restoreCore(l.gpa, l.core, path, &l.peers, l.watches.fd, &l.watches.table) orelse return; l.fe.restoring(nc); + // An answer to the old core's query is turned away. + l.inbox.discardCompletions(); l.ptys.stop(); nc.host = l.host; if (l.fs) |f| f.reset(nc); -- cgit v1.3