fix(ui): handle SDK version mismatch in session list API#555
Closed
JDis03 wants to merge 1 commit into
Closed
Conversation
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/27551153760 Artifacts expire in 7 days.
|
Collaborator
|
@JDis03 - Please use latest OpenCode v1.17.0+ |
client.v2.session.list() doesn't exist when @opencode-ai/sdk resolves
to version <1.16.0. Use client.session.list() which is available across
all SDK versions.
Also make getV2SessionItems handle multiple response formats:
- Direct array (when requestData unwraps the response body)
- { items: [...] } (OpenCode >=1.15.13 format)
- { data: [...] } (legacy format)
And broaden getV2NextCursor to check both cursor.next and next fields.
Fixes NeuralNomadsAI#554
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
client.v2.session.list()is called insession-api.ts:142, but when@opencode-ai/sdkresolves to version <1.16.0 (e.g. v1.2.6 due to monorepo dependency constraints), thev2property doesn't exist onOpencodeClient. The session list silently fails → UI shows "Start a conversation" despite having sessions in the database.Additionally, OpenCode >=1.15.13 returns
{ items: [...], cursor: {...} }but the code expectsresponse.data.Changes
fetchV2Sessions: Useclient.session.list()instead ofclient.v2.session.list()with SDK version-agnostic options mappinggetV2SessionItems: Handle all response formats — direct array,{ items: [...] }, or{ data: [...] }getV2NextCursor: Check bothcursor.nextandnextSessionListResponse({ 200: Session[] }) instead ofV2SessionsResponsefor SDK compatibilityVerification
Fixes #554