Skip to content

Fix SSE endpoint discovery hanging - #1057

Open
mikemikimike wants to merge 5 commits into
modelcontextprotocol:mainfrom
mikemikimike:fix/sse-endpoint-timeout-1033
Open

mikemikimike wants to merge 5 commits into
modelcontextprotocol:mainfrom
mikemikimike:fix/sse-endpoint-timeout-1033

Conversation

@mikemikimike

@mikemikimike mikemikimike commented Sep 30, 2026 •

Copy link
Copy Markdown

Summary

  • Add a bounded endpoint discovery timeout to SseClientTransport with a 30-second default.
  • Expose a configurable timeout through the transport and SSE client helpers.
  • Report timeout failures through the transport error callback and add regression coverage for a server that never sends an endpoint event.

Fixes #1033
Fixes #1033

Issue: #1033

Tests

./gradlew :kotlin-sdk-client:jvmTest --tests io.modelcontextprotocol.kotlin.sdk.client.sse.SseClientTransportTest
./gradlew :integration-test:jvmTest --tests io.modelcontextprotocol.kotlin.sdk.client.SseTransportTest :integration-test:linuxX64Test --tests io.modelcontextprotocol.kotlin.sdk.client.SseTransportTest
./gradlew :kotlin-sdk-client:ktlintCommonMainSourceSetCheck :kotlin-sdk-client:ktlintCommonTestSourceSetCheck :kotlin-sdk-client:detektJvmMain checkKotlinAbi
./gradlew kotlinWasmNpmInstall kotlinWasmToolingSetup --no-daemon --rerun-tasks

@jetbrains-air jetbrains-air Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for taking this on — I left a couple of things that need a fix before merge, and one smaller note.

Produced by Air Automations. Name: Code review / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/409567ec-d3a7-40ac-ba95-8518ec577ac2?run=d102c483-a84d-4345-ace2-7612a915245e

jetbrains-air[bot]
jetbrains-air Bot previously approved these changes Oct 19, 2026

@jetbrains-air jetbrains-air Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Everything from the last round is addressed and verified — nice work, this is good to go!


Produced by Air Automations. Name: Code review / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/409567ec-d3a7-40ac-ba95-8518ec577ac2?run=2e253ba9-7c52-4e5b-9511-fd949a743f31

jetbrains-air[bot]
jetbrains-air Bot previously approved these changes Oct 21, 2026

@jetbrains-air jetbrains-air Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Everything from the previous rounds checks out on this revision — approving!


Produced by Air Automations. Name: Code review / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/409567ec-d3a7-40ac-ba95-8518ec577ac2?run=86dbe2c5-aa8c-4d3b-a84b-f456b4854a05

@mikemikimike

Copy link
Copy Markdown
Author

Rebased the branch onto the latest main and resolved the SSE transport test conflicts. The timeout implementation now remains compatible with the current URL/origin handling and convenience APIs.

Validation on 82ab6fd:

  • :kotlin-sdk-client:jvmTest --tests "io.modelcontextprotocol.kotlin.sdk.client.sse.SseClientTransportTest"
  • ktlintCheck
  • checkKotlinAbi
  • git diff --check

All passed.

jetbrains-air[bot]
jetbrains-air Bot previously approved these changes Oct 22, 2026

@jetbrains-air jetbrains-air Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice work — the discovery timeout now covers the handshake end to end on a real clock, so this looks good to merge.

Produced by Air Automations. Name: Code review / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/409567ec-d3a7-40ac-ba95-8518ec577ac2?run=fbaa955a-937b-4e5a-828c-a3466d03bfcc

@jetbrains-air jetbrains-air Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Lovely work — the discovery timeout holds up across JVM and Native and I found nothing that needs changing, so this is good to merge!

Produced by Air Automations. Name: Code review / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/409567ec-d3a7-40ac-ba95-8518ec577ac2?run=8943f085-4afd-4a2e-8e67-78e6bf492f7c

This branch has not been deployed

No deployments
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.

SseClientTransport: connect() hangs forever if the server never sends the endpoint event

1 participant