Renaming chat sessions not working #3527

Closed
opened 2026-02-16 17:40:31 -05:00 by yindo · 5 comments
Owner

Originally created by @ranjanjayapal on GitHub (Dec 13, 2025).

Originally assigned to: @rekram1-node on GitHub.

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

Originally created by @ranjanjayapal on GitHub (Dec 13, 2025). Originally assigned to: @rekram1-node on GitHub. ### 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
yindo added the opentuibug labels 2026-02-16 17:40:31 -05:00
yindo closed this issue 2026-02-16 17:40:31 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 13, 2025):

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

  • #3779: Session rename (via /rename or /session + ctrl-r) not working

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

@github-actions[bot] commented on GitHub (Dec 13, 2025): This issue might be a duplicate of existing issues. Please check: - #3779: Session rename (via /rename or /session + ctrl-r) not working Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Dec 13, 2025):

Are you sure this is still an issue?

https://github.com/user-attachments/assets/e7fcb7d4-c073-4f05-a9e6-3b6ea291e857

can't replicate

@rekram1-node commented on GitHub (Dec 13, 2025): Are you sure this is still an issue? https://github.com/user-attachments/assets/e7fcb7d4-c073-4f05-a9e6-3b6ea291e857 can't replicate
Author
Owner

@cedefrespo commented on GitHub (Dec 14, 2025):

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.

@cedefrespo commented on GitHub (Dec 14, 2025): ## 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: ```json { "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`: ```typescript 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.
Author
Owner

@ranjanjayapal commented on GitHub (Dec 14, 2025):

@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!

@ranjanjayapal commented on GitHub (Dec 14, 2025): @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!
Author
Owner

@rekram1-node commented on GitHub (Dec 14, 2025):

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

@rekram1-node commented on GitHub (Dec 14, 2025): Yeah we don't sync across instances rn we should fix that
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3527