Skip to content

Session title search is case-sensitive for non-ASCII letters #64245

Closed

Description

@moynzzz

Description

The session list search (GET /api/session?search=, the Sessions dialog) matches titles with SQLite LIKE, which folds case only for ASCII letters.

Plugins

Not involved: plain bun:sqlite gives the same (select 'Тестова сесия' like '%тестова%' is 0)

OpenCode version

2.2.7, the same line is on dev

Steps to reproduce

  1. Rename a session to Тестова сесия.
  2. Open the session list and type тестова: "No sessions found".
  3. Type Тестова: the session is listed. opencode does find OpenCode.

Expected: both find it.

The line is like(SessionTable.title, ...) in packages/core/src/session/store.ts. Bun's SQLite has no ICU, so lower() does not fold these letters either.

Operating System

Windows 11 (WSL2)

Terminal

Windows Terminal

Activity

  1. added
    area/sessions-storage
    platform/wsl
    type/bug
    version/v2
    on Nov 16, 2026
  2. opencodejr commented on Nov 16, 2026

    @opencodejr
    Contributor

    Thanks for the precise report. I reproduced this on the released 2.2.7 CLI through the server API, without needing a model:

    1. Start opencode serve.
    2. Create sessions titled Тестова сесия and OpenCode notes.
    3. Call GET /api/session?search=… with different cases.

    Results:

    • opencode and OpenCode both find OpenCode notes.
    • Тестова finds Тестова сесия.
    • тестова returns no sessions.

    The result is the same on the latest dev (e460646), run from source, where the search still uses the like(SessionTable.title, ...) line you pointed to. The script below reproduces it.

    Reproduction script (repro.sh)
    #!/usr/bin/env bash
    # Reproduces #64245: session title search ignores case for ASCII but not for Cyrillic.
    # Usage: ./repro.sh            (uses `opencode` from PATH)
    #        OC_DEV=/path/to/checkout ./repro.sh   (runs the CLI from source)
    set -u
    WORK=$(mktemp -d /tmp/opencode/repro-XXXX)
    export HOME="$WORK/home" XDG_DATA_HOME="$WORK/data" XDG_CONFIG_HOME="$WORK/config" XDG_STATE_HOME="$WORK/state" XDG_CACHE_HOME="$WORK/cache"
    mkdir -p "$HOME" "$WORK/project"
    cd "$WORK/project"
    PORT=${PORT:-4517}
    if [ -n "${OC_DEV:-}" ]; then
      OC=(bun --conditions=browser --preload="$OC_DEV/packages/tui/node_modules/@opentui/solid/scripts/preload.js" "$OC_DEV/packages/cli/src/index.ts")
    else
      OC=(opencode)
    fi
    "${OC[@]}" --version
    "${OC[@]}" serve --hostname 127.0.0.1 --port "$PORT" >"$WORK/serve.log" 2>&1 &
    PID=$!
    trap 'kill $PID 2>/dev/null' EXIT
    B="http://127.0.0.1:$PORT"
    for i in $(seq 1 60); do grep -q "server password" "$WORK/serve.log" 2>/dev/null && break; sleep 1; done
    PW=$(sed -n 's/.*server password //p' "$WORK/serve.log" | head -1)
    curl() { command curl -u "opencode:$PW" "$@"; }
    for i in $(seq 1 30); do curl -sf "$B/api/session" >/dev/null 2>&1 && break; sleep 1; done
    
    for t in "Тестова сесия" "OpenCode notes"; do
      curl -s -X POST "$B/api/session" -H 'content-type: application/json' \
        -d "{\"title\":\"$t\",\"location\":{\"directory\":\"$PWD\"}}" >/dev/null
    done
    
    search() {
      printf 'search=%-10s -> ' "$1"
      curl -s -G "$B/api/session" --data-urlencode "search=$1" |
        bun -e 'const j=JSON.parse(await Bun.stdin.text());const d=j.data??j;const a=Array.isArray(d)?d:(d.items??d.sessions??[]);console.log(JSON.stringify(a.map(s=>s.title)))'
    }
    search "opencode"
    search "OpenCode"
    search "тестова"
    search "Тестова"

    Run it: bash repro.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/sessions-storageplatform/wslreproducedtype/bugversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions