Skip to content

fix(lsp): handle server requests#101

Merged
bug-ops merged 1 commit into
bug-ops:mainfrom
dergachoff:fix/lsp-server-requests
Apr 29, 2026
Merged

fix(lsp): handle server requests#101
bug-ops merged 1 commit into
bug-ops:mainfrom
dergachoff:fix/lsp-server-requests

Conversation

@dergachoff
Copy link
Copy Markdown
Contributor

@dergachoff dergachoff commented Apr 25, 2026

Description

Classifies inbound LSP JSON-RPC messages with both id and method as server-to-client requests, then replies to common client requests such as client/registerCapability and workspace/configuration.

Also tightens response classification so id-only JSON-RPC messages are treated as protocol errors instead of successful null responses.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)

Breaking Change Note

InboundMessage now includes a Request(JsonRpcRequest) variant and is marked #[non_exhaustive]. Downstream crates that match InboundMessage exhaustively need to add a wildcard arm.

Related Issues

Fixes #100

Checklist

  • I have read the CONTRIBUTING guide
  • My code follows the project's coding style
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass
  • I have updated the documentation accordingly
  • I have updated the CHANGELOG.md (for user-facing changes)

Additional Notes

Verification:

  • RUSTUP_TOOLCHAIN=nightly-aarch64-apple-darwin cargo fmt --check
  • RUSTUP_TOOLCHAIN=1.95-aarch64-apple-darwin cargo nextest run
  • RUSTUP_TOOLCHAIN=1.95-aarch64-apple-darwin cargo test -p mcpls-core
  • RUSTUP_TOOLCHAIN=1.95-aarch64-apple-darwin cargo clippy --all-targets --all-features -- -D warnings

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes mcpls-core mcpls-core crate changes labels Apr 25, 2026
@bug-ops bug-ops requested a review from Copilot April 26, 2026 17:19
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes LSP interoperability with servers (e.g., tsgo) that send server-to-client JSON-RPC requests by correctly classifying inbound messages and sending appropriate client-side responses.

Changes:

  • Extend inbound message classification to include server-to-client requests (id + method).
  • Add handling/auto-responses for common server requests (e.g., client/registerCapability, workspace/configuration).
  • Add focused unit tests and document the fix in the changelog.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
crates/mcpls-core/src/lsp/types.rs Adds InboundMessage::Request variant and minor doc/test annotation update.
crates/mcpls-core/src/lsp/transport.rs Introduces parse_inbound_message to classify inbound JSON-RPC messages (request/response/notification) and adds a unit test.
crates/mcpls-core/src/lsp/client.rs Handles InboundMessage::Request by generating and sending JSON-RPC responses; adds unit tests for server-request responses.
CHANGELOG.md Notes the tsgo timeout fix under “Fixed”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG.md
Comment thread crates/mcpls-core/src/lsp/types.rs
Comment thread crates/mcpls-core/src/lsp/transport.rs Outdated
@dergachoff dergachoff force-pushed the fix/lsp-server-requests branch from 1f17020 to be6f7e7 Compare April 26, 2026 19:12
@dergachoff
Copy link
Copy Markdown
Contributor Author

I pushed be6f7e7 with the follow-ups:

  • tightened response parsing so id-only messages are protocol errors instead of being accepted as null responses
  • added a regression test for that parser case
  • marked InboundMessage as #[non_exhaustive]
  • updated the changelog and PR body to call out the public API impact explicitly

All checks are green now, including both CodeQL jobs. Local validation also passed with fmt, cargo test -p mcpls-core, clippy, and nextest.

@bug-ops
Copy link
Copy Markdown
Owner

bug-ops commented Apr 29, 2026

Nice fix. Good call on #[non_exhaustive] (saves future churn).
Thanks a lot!

@bug-ops bug-ops merged commit 522bad5 into bug-ops:main Apr 29, 2026
16 checks passed
bug-ops added a commit that referenced this pull request Apr 29, 2026
Repository-wide instructions (.github/copilot-instructions.md) cover architecture
overview, lock scope rules, glob anchoring, channel semantics, and deny.toml license
gaps.

Path-specific instruction files cover:
- bridge/lsp: TOCTOU, version overflow, notification_pump deadlock, file watcher
- config/deps: license allow list, serde round-trip tests, TOML defaults
- mcp: 1-based positions, JsonSchema derive, tool dispatch completeness
- tests: #[ignore] hygiene, resync coverage, glob pattern correctness
- ci: feature flag parity, RUSTDOCFLAGS, MSRV guards
- CHANGELOG: breaking change format, PR references

Instructions are derived from findings in PR #101 and #103 reviews.
bug-ops added a commit that referenced this pull request Apr 29, 2026
Repository-wide instructions (.github/copilot-instructions.md) cover architecture
overview, lock scope rules, glob anchoring, channel semantics, and deny.toml license
gaps.

Path-specific instruction files cover:
- bridge/lsp: TOCTOU, version overflow, notification_pump deadlock, file watcher
- config/deps: license allow list, serde round-trip tests, TOML defaults
- mcp: 1-based positions, JsonSchema derive, tool dispatch completeness
- tests: #[ignore] hygiene, resync coverage, glob pattern correctness
- ci: feature flag parity, RUSTDOCFLAGS, MSRV guards
- CHANGELOG: breaking change format, PR references

Instructions are derived from findings in PR #101 and #103 reviews.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation mcpls-core mcpls-core crate changes rust Rust code changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: tsgo server requests are treated as unknown responses

3 participants