Repository navigation
land: lsp-exit-sweep - #614
Merged
Merged
Conversation
The drain tests read `lsp shutdown_all: servers=N` from the module's exit phase. When the connection ends, the teardown used to quiesce every root by detaching its clients to a per-root background reap thread. Each thread waits 25 ms for Shutdown, then terminates its server. The exit phase then found every manager empty (`phase=lsp_shutdown servers=0`) and counted only the pids those threads had not reaped yet. If the main thread stalled for about 100 ms after quiesce on a loaded runner, all servers were gone, and the summary read `servers=0 ... elapsed_ms=0` (macOS integration shard, main 396d0bf). The race dates from 83f7adb, the commit that added the quiesce of root servers. #588 and #590 do not touch LSP lifecycle. Connection teardown now closes start admission but leaves the clients in their managers (QuiescedLsp::LeaveForExitSweep). The exit phase in run_subc_mode_inner takes them all under its one shared budget, as before. A route goodbye during a session, and loop callers with no exit phase behind them, keep the background reap (QuiescedLsp::ReapInBackground). The drain test assertion goes from `servers >= 3` to exact equality: the exit phase must take every root's server, and the summary must count all of them. With ownership causal, the count no longer depends on timing. Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
jacobocasado
pushed a commit
to starredjaco/aft
that referenced
this pull request
Oct 20, 2026
Rebase the release prep onto origin/main 3faaded and extend .alfonso/release-notes/v0.61.0.md to cover the merges after cortexkit#590: cortexkit#578, cortexkit#596, cortexkit#600, cortexkit#601, cortexkit#612, cortexkit#613, cortexkit#614, cortexkit#616, cortexkit#617, cortexkit#618, cortexkit#619, cortexkit#620, cortexkit#622 and cortexkit#623. Fold and delete the 27 next/ fragments those merges added. Credit cortexkit#465 (@null-axiom) and cortexkit#564 (@iceteaSA), and extend the cortexkit#577 line with the shell timeout task-id fix. Refresh ANNOUNCEMENT_FEATURES in both plugins. Pi leaves out the OpenCode 2 permission line, which does not apply to Pi users. Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Accepted agent delivery; branch-keyed search descriptor included.
Summary by cubic
Fixes a race where the daemon's exit phase could report zero or too few language servers stopped because per-root background reap threads shut them down first.
Written for commit 844e15e. Summary will update on new commits.


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
The PR keeps running language servers in their managers when the SUBC connection ends. The exit phase then collects them under one shared shutdown budget.
Reviewed the code without running tests.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Route closes] --> B[Close start admission] B --> C[Take clients and stop them in background] D[SUBC connection ends] --> E[Close start admission and retain clients] E --> F[Module loop returns] F --> G[Collect clients from all actors] G --> H[Stop clients under one shared budget]Reviews (1) · Last reviewed commit: "release notes and search-quality descrip..." · Reviewed by Greptile