Skip to content

Renaming chat sessions not working #5494

Closed

Description

@ranjanjayapal

Description

Not able to rename chat sessions in 1.0.152. Dialog for renaming shows up and allows for renaming, but reverts back the the default name after submitting.

OpenCode version

1.0.152

Steps to reproduce

  1. Open chat sessions: ctrl+x l
  2. Rename: ctrl+r
  3. Submit: Enter
  4. Open chat session and it shows the old name

Screenshot and/or share link

No response

Operating System

Ubuntu 22.04

Terminal

Ghostty

Activity

  1. added
    bug
    on Dec 13, 2025
  2. added
    opentui
    on Dec 13, 2025
  3. github-actions commented on Dec 13, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  4. self-assigned this
    on Dec 13, 2025
  5. rekram1-node commented on Dec 14, 2025

    @rekram1-node
    Member

    Are you sure this is still an issue?

    Screen.Recording.2025-12-13.at.10.48.06.PM.mov

    can't replicate

  6. cedefrespo commented on Dec 14, 2025

    @cedefrespo

    Additional Diagnosis

    I've investigated this issue and found the root cause:

    The rename DOES work at the backend level

    The JSON files in storage are correctly updated. For example:

    {
      "id": "ses_4e3a579daffeoAdHvBK3FdvzlE",
      "title": "Debugging rename function in opencode",  // ✅ Updated correctly
      ...
    }

    The problem is in the UI sync mechanism

    The issue is in packages/opencode/src/cli/cmd/tui/context/sync.tsx:

    case "session.updated": {
      const result = Binary.search(store.session, event.properties.info.id, (s) => s.id)
      if (result.found) {
        setStore("session", result.index, reconcile(event.properties.info))
        break
      }
      // If not found, it tries to insert at the wrong index
      setStore(
        "session",
        produce((draft) => {
          draft.splice(result.index, 0, event.properties.info)
        }),
      )
      break
    }

    The Binary.search may fail to find the session if the session array in the store is not sorted in the same order that Binary.search expects (by ID string comparison).

    Workaround

    Close the session list (Escape) and reopen it (Ctrl+X L) - the renamed title will appear since it's already persisted.

    Environment

    • OpenCode version: 1.0.152
    • OS: macOS
    • Storage: Using symlink from ~/.local/share/opencode/storage to ~/context/opencode/storage

    I'm working on a PR to fix this.

  7. added a commit that references this issue on Dec 14, 2025
    fc36599
  8. ranjanjayapal commented on Dec 14, 2025

    @ranjanjayapal
    Author

    @rekram1-node This seems to be working now. It probably was pulling the name from a cached index for me instead of the new name given. Once all opencode instances were restarted, it seems to have been fixed. Thank you!

  9. rekram1-node commented on Dec 14, 2025

    @rekram1-node
    Member

    Yeah we don't sync across instances rn we should fix that

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

Metadata

Metadata

Assignees

Labels

bugopentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions