JetBrains / JetBrains/koog

Serialization error on `configOptions` usage

Open
#2,192 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
4.6k
Forks
474
Avg merge
58m
Merged PRs (30d)
1

Description

I am getting error below which comes from `acp-jvm-0.13.1` The issue is `SessionConfigSelectOptionsSerializer`. I found the PR that was fixed below. But as I see koog use very old version of library. I see the usage of property is marked as **UNSTABLE** but it's a good feature to enrich your agent.

https://github.com/agentclientprotocol/kotlin-sdk/pull/64

```kotlin
java.lang.IllegalArgumentException: Element class kotlinx.serialization.json.JsonObject is not a JsonArray
java.lang.IllegalArgumentException: Element class kotlinx.serialization.json.JsonObject is not a JsonArray
at kotlinx.serialization.json.JsonElementKt.error(JsonElement.kt:326)
at kotlinx.serialization.json.JsonElementKt.getJsonArray(JsonElement.kt:244)
at com.agentclientprotocol.model.SessionConfigSelectOptionsSerializer.deserialize(SessionConfig.kt:125)
at com.agentclientprotocol.model.SessionConfigSelectOptionsSerializer.deserialize(SessionConfig.kt:98)
at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:351)
at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableValue(Tagged.kt:207)
at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableElement$lambda$1(Tagged.kt:279)
at kotlinx.serialization.internal.TaggedDecoder.tagBlock(Tagged.kt:294)
at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableElement(Tagged.kt:279)
at com.agentclientprotocol.model.SessionConfigOption$Select$$serializer.deserialize(SessionConfig.kt:154)
at com.agentclientprotocol.model.SessionConfigOption$Select$$serializer.deserialize(SessionConfig.kt:154)
at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:351)
at kotlinx.serialization.json.internal.TreeJsonDecoderKt.readPolymorphicJson(TreeJsonDecoder.kt:33)
at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:372)
at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableValue(Tagged.kt:207)
at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableElement$lambda$1(Tagged.kt:279)
at kotlinx.serialization.internal.TaggedDecoder.tagBlock(Tagged.kt:294)
at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableElement(Tagged.kt:279)
at kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement$default(Decoding.kt:539)
at kotlinx.serialization.internal.CollectionLikeSerializer.readElement(CollectionSerializers.kt:80)
at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:351)
at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableValue(Tagged.kt:207)
at kotlinx.serialization.internal.TaggedDecoder.decodeNullableSerializableElement$lambda$3(Tagged.kt:288)
at kotlinx.serialization.internal.TaggedDecoder.tagBlock(Tagged.kt:294)
at kotlinx.serialization.internal.TaggedDecoder.decodeNullableSerializableElement(Tagged.kt:286)
at com.agentclientprotocol.model.NewSessionResponse$$serializer.deserialize(Requests.kt:678)
at com.agentclientprotocol.model.NewSessionResponse$$serializer.deserialize(Requests.kt:678)
at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:351)
at kotlinx.serialization.json.internal.TreeJsonDecoderKt.readJson(TreeJsonDecoder.kt:25)
at kotlinx.serialization.json.Json.decodeFromJsonElement(Json.kt:170)
at com.agentclientprotocol.protocol.Protocol_extensionsKt.sendRequest(Protocol.extensions.kt:34)
at com.agentclientprotocol.protocol.Protocol_extensionsKt$sendRequest$1.invokeSuspend(Protocol.extensions.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:610)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runDefaultDispatcherTask(CoroutineScheduler.kt:1194)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:906)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:775)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:762)
```

Contributor guide

Open the contributing guide

Research direction

Start by locating Koog's acp-jvm dependency and checking why it uses version 0.13.1. Reproduce decoding of a NewSessionResponse containing configOptions, then compare SessionConfigSelectOptionsSerializer with upstream kotlin-sdk PR 64; done means the response decodes without the JsonObject/JsonArray exception and coverage verifies the supported shape.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.