File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared Expand file tree Collapse file tree 3 files changed +28
-4
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) { " Deserialization failed for line: $line \n Skipping..." }
56+ }
57+ }
4858 }
4959
5060 return null
Original file line number Diff line number Diff line change @@ -3,6 +3,11 @@ plugins {
33}
44
55kotlin {
6+ jvm {
7+ testRuns[" test" ].executionTask.configure {
8+ useJUnitPlatform()
9+ }
10+ }
611 sourceSets {
712 commonTest {
813 dependencies {
You can’t perform that action at this time.
0 commit comments