Skip to content

MCP-417 Improve proxied server resilience#335

Merged
nquinquenel merged 3 commits intomasterfrom
bug/nq/MCP-417-check-proxied
Apr 21, 2026
Merged

MCP-417 Improve proxied server resilience#335
nquinquenel merged 3 commits intomasterfrom
bug/nq/MCP-417-check-proxied

Conversation

@nquinquenel
Copy link
Copy Markdown
Member

No description provided.

@hashicorp-vault-sonar-prod
Copy link
Copy Markdown

hashicorp-vault-sonar-prod Bot commented Apr 13, 2026

MCP-417

@sonarqube-agent
Copy link
Copy Markdown

sonarqube-agent Bot commented Apr 13, 2026

SonarQube Remediation Agent

SonarQube found 1 issue in this PR that the agent can fix for you. Est. time saved: ~15 min

1 issue found
  • 🟠 Either re-interrupt this method or rethrow the "InterruptedException" that can be caught here.ProxiedToolsLoader.java:150
  • Run Remediation Agent
    Select the checkbox above to enable this action.

View Project in SonarCloud

💡 Got issues in your backlog? Let the agent fix them for you.

@nquinquenel nquinquenel force-pushed the bug/nq/MCP-417-check-proxied branch 2 times, most recently from 3bf2d1e to 2a48101 Compare April 20, 2026 05:58
@nquinquenel nquinquenel marked this pull request as ready for review April 20, 2026 07:45
@sonar-review-alpha
Copy link
Copy Markdown

sonar-review-alpha Bot commented Apr 20, 2026

Summary

What changed:

  • Added automatic download of the sonar-context-augmentation binary for integration tests (replaces manual setup)
  • Added binary availability checking before initializing proxied servers—missing binaries are now skipped with clear logging instead of causing hangs
  • Updated integration tests to verify both the happy path (binary found) and graceful degradation (binary missing)
  • Cleaned up gradle configuration and removed unused imports

Why it matters:
Proxied MCP servers are now resilient to missing binaries. The server will log warnings and continue starting, rather than hanging or failing silently. This makes deployment more forgiving and diagnostics clearer.

What reviewers should know

Where to focus:

  1. ProxiedToolsLoader.java (lines 73-87) — The core resilience improvement. It filters out unreachable binaries and logs clearly what's happening. The new isCommandAvailable() method handles both absolute paths and PATH lookups.
  2. Integration tests (ProxiedServerITest.java) — Two test scenarios now: happy path with the binary present, and a new test case verifying graceful skip when binary is missing. Note the assertions on exact tool counts (10) and total tools (34) from staging.
  3. Gradle build (its/build.gradle.kts) — The downloadCagBinary task handles architecture detection and automatic binary extraction. It runs as a dependency of processTestResources, so binaries are ready before tests run.

Non-obvious details:

  • The binary is downloaded to build/cag-binary and copied into test resources at binaries/sonar-context-augmentation
  • Workspace mount is now optional via withWorkspaceMount() to support testing with simulated volume mounts
  • The missing-binary test ensures no hangs—the server must start successfully even with zero reachable proxied servers

  • Generate Walkthrough
  • Generate Diagram

🗣️ Give feedback

sonar-review-alpha[bot]

This comment was marked as resolved.

sonar-review-alpha[bot]

This comment was marked as resolved.

sonar-review-alpha[bot]

This comment was marked as resolved.

sonar-review-alpha[bot]

This comment was marked as resolved.

sonar-review-alpha[bot]

This comment was marked as resolved.

sonar-review-alpha[bot]

This comment was marked as resolved.

sonar-review-alpha[bot]

This comment was marked as resolved.

sonar-review-alpha[bot]

This comment was marked as resolved.

Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha Bot left a comment

Choose a reason for hiding this comment

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

The core resilience fix in ProxiedToolsLoader is sound — checking binary availability before attempting to connect is the right approach. The IT test infrastructure improvements (automated binary download, re-enabling ProxiedServerITest) are also good moves. However, there is one bug that will cause the new missing-binary IT test to always fail: the log message asserted in the test does not match what the implementation actually emits. There are also minor reliability concerns in the build task.

🗣️ Give feedback

Comment thread its/src/test/java/org/sonarsource/sonarqube/mcp/its/ProxiedServerITest.java Outdated
Comment thread its/build.gradle.kts
Comment thread its/build.gradle.kts
…y, harden build validation, and restore integration test coverage
@nquinquenel nquinquenel force-pushed the bug/nq/MCP-417-check-proxied branch from 00ab0cc to 72cc1df Compare April 20, 2026 13:48
Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha Bot left a comment

Choose a reason for hiding this comment

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

The core isCommandAvailable fix in ProxiedToolsLoader is clean, correct, and well-tested. The fail-fast behaviour is exactly right: check before connecting, warn with the binary path and server name, bail out gracefully if nothing is reachable. No correctness issues in the production code.

The build and test infrastructure side has a few reliability gaps worth addressing before this ships.

🗣️ Give feedback

Comment thread its/build.gradle.kts
Comment thread its/build.gradle.kts
Comment thread its/build.gradle.kts
Comment thread Dockerfile
Comment thread gradle.properties
Comment thread Dockerfile
@sonarqube-agent
Copy link
Copy Markdown

sonarqube-agent Bot commented Apr 21, 2026

SonarQube Remediation Agent

SonarQube found 2 issues in this PR that the agent can fix for you. Est. time saved: ~2 min

2 issues found
  • 🟡 Make this line start after 4 spaces instead of 2 in order to indent the code consistently. (Indentation level is at 2.)ProxiedToolsLoader.java:139
  • 🟡 Make this line start after 6 spaces instead of 4 in order to indent the code consistently. (Indentation level is at 2.)ProxiedToolsLoader.java:141
  • Run Remediation Agent
    Select the checkbox above to enable this action.

View Project in SonarCloud

💡 Got issues in your backlog? Let the agent fix them for you.

@sonarqubecloud
Copy link
Copy Markdown

@nquinquenel nquinquenel merged commit 6519223 into master Apr 21, 2026
9 of 10 checks passed
@nquinquenel nquinquenel deleted the bug/nq/MCP-417-check-proxied branch April 21, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants