Skip to content

fix(ui): handle SDK version mismatch in session list API#555

Closed
JDis03 wants to merge 1 commit into
NeuralNomadsAI:devfrom
JDis03:fix/session-list-api
Closed

fix(ui): handle SDK version mismatch in session list API#555
JDis03 wants to merge 1 commit into
NeuralNomadsAI:devfrom
JDis03:fix/session-list-api

Conversation

@JDis03

@JDis03 JDis03 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Problem

client.v2.session.list() is called in session-api.ts:142, but when @opencode-ai/sdk resolves to version <1.16.0 (e.g. v1.2.6 due to monorepo dependency constraints), the v2 property doesn't exist on OpencodeClient. 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 expects response.data.

Changes

  • fetchV2Sessions: Use client.session.list() instead of client.v2.session.list() with SDK version-agnostic options mapping
  • getV2SessionItems: Handle all response formats — direct array, { items: [...] }, or { data: [...] }
  • getV2NextCursor: Check both cursor.next and next
  • Types: Use SessionListResponse ({ 200: Session[] }) instead of V2SessionsResponse for SDK compatibility

Verification

  • ✅ Tested with SDK v1.2.6 (installed) and OpenCode 1.15.3
  • ✅ Tested with SDK v1.2.6 and OpenCode 1.17.7
  • ✅ Sessions load correctly in both cases
  • ✅ No regressions in session creation, deletion, or message loading

Fixes #554

@github-actions

Copy link
Copy Markdown

PR builds are available as GitHub Actions artifacts:

https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/27551153760

Artifacts expire in 7 days.
Artifacts:

  • pr-555-a377a44fa2ef1c420de03c52ff21338dc2653082-tauri-linux
  • pr-555-a377a44fa2ef1c420de03c52ff21338dc2653082-tauri-macos
  • pr-555-a377a44fa2ef1c420de03c52ff21338dc2653082-electron-macos
  • pr-555-a377a44fa2ef1c420de03c52ff21338dc2653082-tauri-windows
  • pr-555-a377a44fa2ef1c420de03c52ff21338dc2653082-tauri-macos-arm64
  • pr-555-a377a44fa2ef1c420de03c52ff21338dc2653082-electron-windows
  • pr-555-a377a44fa2ef1c420de03c52ff21338dc2653082-electron-linux

@shantur

shantur commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

@JDis03 - Please use latest OpenCode v1.17.0+
We don't intend to support older versions.

@shantur shantur closed this Jun 15, 2026
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
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.

[Bug]: session list fails when SDK resolves to version <1.16.0 — client.v2 not found

2 participants