fix(lsp): omit params on shutdown and exit instead of sending null - #404
Merged
bug-ops merged 2 commits intoSep 9, 2026
Merged
Conversation
dergachoff
added a commit
to dergachoff/mcpls
that referenced
this pull request
Sep 9, 2026
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, aligns with JSON-RPC optional params semantics, and is covered by focused wire-level tests for both request and notification paths.
Pull request overview
This PR fixes JSON-RPC wire output for LSP params: void methods by omitting the params field entirely (instead of sending "params": null), preventing tsgo from rejecting shutdown/exit and allowing the LSP server process to exit promptly.
Changes:
- Map
serde_json::Value::Nullrequest/notification params toNoneso#[serde(skip_serializing_if = "Option::is_none")]drops theparamskey on the wire. - Serialize notifications via
JsonRpcNotification(instead of a manualjson!object) to consistently applyskip_serializing_if. - Add wire-level tests asserting that
nullparams omit the key while{}params are preserved; add a changelog entry under Unreleased.
File summaries
| File | Description |
|---|---|
| crates/mcpls-core/src/lsp/client.rs | Omits params when null for requests/notifications, switches notification serialization to JsonRpcNotification, and adds wire-format tests. |
| CHANGELOG.md | Documents the tsgo shutdown/exit fix under ## [Unreleased]. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
tsgo rejects `"params": null` on `shutdown` with -32602 and never exits, so every shutdown fell through to the 3s kill fallback. Null params are now dropped in LspClient::request/notify so the key is omitted on the wire.
bug-ops
force-pushed
the
fix/omit-null-params-on-shutdown
branch
from
September 9, 2026 16:46
25c3c11 to
3c09318
Compare
Owner
|
Thanks for the fix: clean root cause analysis, and appreciate routing it through the client layer. |
bug-ops
enabled auto-merge (squash)
September 9, 2026 16:49
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.
Problem
Every mcpls shutdown against tsgo waits the full 3s
CHILD_EXIT_GRACEand kills the child. Closes #403.Root cause
LspClient::request/notifyalways emitSome(params), so theValue::Nullpassed byLspServer::shutdownserializes as"params": null. tsgo rejects that onshutdownwith-32602 expected empty, got: nulland ignores the followingexit.Fix
requestandnotifymapValue::NulltoNone; the notification send path now serializes throughJsonRpcNotificationsoskip_serializing_ifdrops the key. Non-null params are unchanged. Fixed in the client rather than the two call sites so any futureparams: voidmethod is covered. Changelog entry under Unreleased.Validation
cargo +nightly fmt --checkcargo clippy --all-targets --all-features --workspace -- -D warnings(stable 1.98.1)cargo nextest run --workspace: 812 passedclient.rs::tests::void_params_wire: request with null params omits the key, notify with null params omits the key, notify with{}params keeps itshutdownreturnsresult: nulland the child exits in under 10ms withLSP server shut down successfully, versus the 3s kill fallback on v0.5.0