Skip to content

[Bug]: OpenCode returns { items } but CodeNomad expects { data } — session list empty #542

@raz123

Description

@raz123

Bug

When OpenCode v1.15.13 serves the V2 session list API, it returns:

{ "items": [...], "cursor": {...} }

But CodeNomad's session accessor function (getV2SessionItems / compiled name Qc) expects:

function Qc(e) { return e.data }

Since the response has no .data key, the session list is never populated. UI shows "Start a conversation" (empty state) despite having 75+ sessions in the database.

Root Cause

The response.data access in packages/ui/src/stores/session-api.ts:145-147:

function getV2SessionItems(response: V2SessionsResponse): SessionV2Info[] {
  return response.data
}

The actual server response is { items: [...], cursor: {...} } — the key is .items, not .data.

Fix

Change to check both formats:

function getV2SessionItems(response: V2SessionsResponse): SessionV2Info[] {
  return (response as any).items ?? response.data
}

Impact

Session listing across ALL workspaces returns empty. No error displayed — UI just shows the blank "Start a conversation" state. User has no indication the fetch failed.

Confirmed on OpenCode binary v1.15.13. Possibly related to #525 (format change in 1.16.0+).

Environment

  • CodeNomad v0.17.0 (Tauri) and v0.17.1 (web)
  • OpenCode binary v1.15.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions