Skip to content

[V2 compat] All legacy v1 session avatars render as "/" (sessions bound to project_id "global") #57067

Open

Description

@wsjwalle

Summary

After migrating from v1 (1.18.23) to V2 (Desktop 2.0.29 / CLI 2.0.27), every session
in the Desktop home/sidebar shows the same "/" avatar, regardless of project.

Environment

Root cause (verified against my database)

  • All 48 v1-created sessions have project_id = 'global'; the global project row
    has worktree = '/' and name = NULL.
  • Verified via backup comparison that v1 data already looked like this before
    migration — so this is not migration data loss, but a V2 rendering regression
    for legacy data.
  • ProjectAvatar fallback chain displayName = name || basename(worktree) || worktree
    followed by first(...) yields '/' for this project, so every session avatar
    becomes /.
  • session.directory is correct for all 48 sessions (e.g. /home/user/myproject),
    so grouping/display could still be derived correctly.

Expected

Session avatars fall back to the session's directory basename (or the project matched
by worktree) instead of /.

Actual

All session avatars show /.

Notes

  • Project.resolve still assigns ID.global for directories without a git/hg root,
    so new sessions in non-git directories appear to hit the same path.
  • User-side workaround I applied offline: remap session.project_id /
    session_v2.project_id by exact directory → project.worktree match
    (fixed 43/48; 5 sessions whose directory has no project row remain on global).

Happy to provide more diagnostics if needed.

Activity

  1. opencode-agent commented on Oct 19, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report and for working out the cause.

    I couldn't reproduce this here. The / avatar only shows up in the Desktop/web app, and this sandbox has neither the app nor a browser, so a maintainer with the Desktop app will need to confirm it.

    The code on the latest dev still matches what you describe. displayName() in packages/ui/src/data-display/project-avatar/project-avatar.tsx uses the project name, then the last part of the worktree path, then the worktree itself. For the global project (worktree /, no name) that gives /. The session tab and title bar only use the session's own directory when there is no project at all, so sessions in global never get that fallback.

    Other issues about the same global root cause, most closely related first:

    Your remap by directory is a reasonable workaround for now. As you noted, sessions whose directory has no project row stay on global even after such fixes.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions