File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared
kotlin-sdk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -3,29 +3,38 @@ name: Validate PR
33on :
44 workflow_dispatch :
55 pull_request :
6- branches : [main]
6+ branches : [ main ]
77
88concurrency :
9- group : ${{ github.workflow }}-${{ github.ref }}
10- cancel-in-progress : true
9+ group : ${{ github.workflow }}-${{ github.ref }}
10+ cancel-in-progress : true
1111
1212jobs :
1313 validate-pr :
1414 runs-on : macos-latest
1515 name : Validate PR
1616 steps :
1717 - uses : actions/checkout@v4
18+
1819 - name : Set up JDK 21
1920 uses : actions/setup-java@v4
2021 with :
2122 java-version : ' 21'
2223 distribution : ' temurin'
24+
2325 - name : Setup Gradle
2426 uses : gradle/actions/setup-gradle@v4
2527
2628 - name : Clean Build with Gradle
2729 run : ./gradlew clean build
2830
31+ - name : Upload JUnit test results
32+ if : always()
33+ uses : actions/upload-artifact@v4
34+ with :
35+ name : junit-results
36+ path : ' **/build/test-results/test/*.xml'
37+
2938 - name : Disable Auto-Merge on Fail
3039 if : failure()
3140 run : gh pr merge --disable-auto "$PR_URL"
Original file line number Diff line number Diff line change @@ -44,7 +44,17 @@ public class ReadBuffer {
4444 try {
4545 return deserializeMessage(line)
4646 } catch (e: Exception ) {
47- logger.error(e) { " Failed to deserialize message from line: $line \n Skipping..." }
47+ logger.error(e) { " Failed to deserialize message from line: $line \n Attempting to recover..." }
48+ // if there is a non-JSON object prefix, try to parse from the first '{' onward.
49+ val braceIndex = line.indexOf(' {' )
50+ if (braceIndex != - 1 ) {
51+ val trimmed = line.substring(braceIndex)
52+ try {
53+ return deserializeMessage(trimmed)
54+ } catch (ignored: Exception ) {
55+ logger.error(ignored) { " Recovery failed for line: $line \n Skipping..." }
56+ }
57+ }
4858 }
4959
5060 return null
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import org.junit.jupiter.api.Test
1010class StdioClientTransportTest : BaseTransportTest () {
1111 @Test
1212 fun `should start then close cleanly` () = runTest {
13- // Run process "/usr/bin/tee"
1413 val processBuilder = ProcessBuilder (" /usr/bin/tee" )
1514 val process = processBuilder.start()
1615
@@ -24,6 +23,7 @@ class StdioClientTransportTest : BaseTransportTest() {
2423
2524 testClientOpenClose(client)
2625
26+ process.waitFor()
2727 process.destroy()
2828 }
2929
You can’t perform that action at this time.
0 commit comments