Skip to content

[Bug]: Desktop sidebar renders a project EMPTY when its folder path contains a non-ASCII (Unicode) character — sessions exist in state.db #65014

Description

@bgexpert

Summary

A project whose primary folder path contains a non-ASCII / Unicode character renders as empty in the Desktop sidebar (no sessions listed), even though the sessions exist in state.db with a cwd that correctly matches the project folder.

The backend (projects.tree / project_tree.build_tree) returns the sessions correctly — the project is only emptied in the Desktop UI layer, not in the data.

Reproduction (Windows 10, Hermes 0.18.2)

  1. Create a project whose primary folder path contains a Unicode letter, e.g. a folder literally named bistånd (Swedish å) under D:\Projects\SV\.
  2. Open that project in the Desktop sidebar and start one or more chats there (so state.db rows get cwd = D:\Projects\SV�istånd).
  3. Send a message (a state.db row is created with that cwd).
  4. Open the Projects view.

Expected: the project lists its chats.
Actual: the project shows zero sessions, even though the same data renders fine for an ASCII-only sibling project.

Empirical evidence (from a real state.db + projects.db, no PII / no real paths shown)

Two projects, both with valid, matching cwd:

project folder (normalized, case-folded) session cwd (normalized) backend match Desktop UI
d:/projects/sv/bistånd d:/projects/sv/bistånd MATCH (True) EMPTY
d:/sud/alimonyluxembourg d:/sud/alimonyluxembourg MATCH (True) shows sessions
  • The backend project_tree._FolderIndex.match() uses Python casefold() over path segments, so the accented path matches correctly and build_tree returns the 2 sessions for the accented project.
  • A sibling project with an ASCII-only path and identical structure shows its sessions normally.
  • The only structural difference between the two projects is the Unicode letter å (å) in the folder name.

Root-cause hypothesis

The Desktop/Electron renderer resolves and compares the project's folder path against session cwds using a path comparison that is not Unicode-normalization-safe (likely comparing the raw on-disk path / a differently-encoded variant of the accented name against the projects.db / state.db string). Because the two byte-strings never compare equal at the UI layer, the session-to-project grouping produces an empty lane — while the Python backend (Unicode-aware casefold) groups them correctly.

This is adjacent to #64629 (Windows D:\ vs D:/ normalization duplicate), but distinct: there the project appears twice; here an accented-path project appears empty despite a correct backend match. It is also distinct from #50438 (where cwd is NULL and never recorded) — in this case cwd is present and matches.

Suggested fix direction

Make the Desktop path-key comparison Unicode-normalization-form-stable (e.g. NFC/NFD normalize both sides, or compare via the same casefold/segment logic the backend uses) before grouping sessions into a project lane.

Related: #64629 (Windows path normalization), #50438 (TUI sessions not recording cwd).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havearea/sessionsSession lifecycle, resume, persistence, historycomp/desktopElectron desktop app (apps/desktop/*)type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions