Skip to content

A bare /rename asks the server for a new session title (opencode#66396) - #1249

Merged
Hona merged 4 commits into
devfrom
upstream-f/rename-generates
Nov 25, 2026
Merged

Hona merged 4 commits into
devfrom
upstream-f/rename-generates

Conversation

@Hona

@Hona Hona commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Port of opencode#66396 (3ac14c053c, "regenerate session title with bare /rename"). Ledger row UP-240.

What changes

  • /rename is a slash command. With words after it, the open session takes them as its title once the server has taken them. Bare, it asks the server to generate a new title from the conversation so far. Picked from the / list it types /rename and waits for the words, as a command that takes words does.
  • A new command, Generate session title, does the same as a bare /rename, from the palette. It is not offered on a subagent's page, while the title is being edited, or while a title is on its way.
  • The title shimmers in the header while the server generates one. A second ask for the same session does nothing until the first is answered.
  • Rename session has a description: "Rename the session, or generate a new title when run without one".
  • A refused ask shows a toast titled Request failed.

Before this change there was no /rename, and nothing asked the server for a title.

How

Official: packages/app/src/session/timeline/message-timeline.tsx:300-319 (the commands), :702-704 (the shimmer), packages/app/src/session/timeline/controller.tsx:455-494 (title.set), packages/app/src/runtime/i18n/en.ts:129-131.

  • A command's /name can take words. crates/opencode-kernel/src/commands.rs: CommandEntry::words and .slash_words(..). Until now only a plugin's command could (apps/desktop/src/session/composer/slash.rs).
  • The ask: features/session-menu/src/generate_title.rs: one small machine (Generating: a session waits for a generated title or does not), set_title, replied. An empty title in the session's update is the ask, as in official; its answer comes back on the path a rename's does (features/session-menu/src/lib.rs session_write_replied), and the session is read again after it.
  • The commands in apps/desktop/src/session/menu.rs; their order in shell/commands/order.rs; the shimmer in shell/view/header.rs; three keys in crates/opencode-i18n/locales/official/en.json.

How it differs from official

  • A refused /rename words reads Failed to rename session, as ours' other renames do, where official's reads Request failed (controller.tsx:481). By reading.
  • A long title while it shimmers is not cut short in ours; official's sits in a truncating button (message-timeline.tsx:699). By reading; the run shows it if the generated-title case uses a long title.
  • Where /rename stands in the / list. Official lists later registrations first (shell/commands/command.tsx:133-134), so its place depends on when the timeline registers; not determined by reading. Ours lists it after the commands whose order is known.

Run

A PR build is of the PR's own head.

  • On 691698c9f (Windows x64 CI build, run 45674067934; headless, the app's own fixture file, no server; 14 launches, each exit code read whole and 0). Before: opencode-rune fix(deps): pin rune to d5c7a5ad, the effect warm for backdrop blur only (214 commits, rune#1962-#2246) #1192's own PR build, head cc991c6505, run 45629508899. Cases 1, 2, 4 and 5 hold: the / list has /rename with its description and Ctrl+R (before: no such row); picking it leaves /rename in the composer; the palette lists Generate session title on a session's page and nothing for it on a subagent's page (before: no result); a bare /rename with no server leaves the title as it was, with no shimmer and one toast that nothing was sent. The sample of the files shared with feat(app): group tabs by project or server in Consolidated (opencode#66350) #1215: a session's menu from its tab lists Rename, and it edits the title in place.
  • A fault of that head, seen in case 3 and fixed in c87457101: /rename New words with no server showed 'New words' in the header and the tab beside a toast that nothing was sent: a title the server never took. Before this change the words were sent as a prompt. The title now changes only when the server's event comes, as official's does.
  • On c87457101, the head that merges (Windows x64 CI build, run 45687337329; headless, the same fixture file, no server; 5 launches, each exit code read whole and 0; before: cc991c6505). Case 3 holds: the composer is empty, the header and the tab keep "Sidebar shows stale session titles", one toast reads "Not connected to an OpenCode server" / "Nothing was sent.", and the timeline has no new row. The sample holds: a session's menu from its tab lists Rename, and Rename puts a text field holding the title in the tab's place. Cases 1, 2, 4 and 5 were not repeated on this head: between the two heads the change is three lines in one function (features/session-menu/src/generate_title.rs) and dev taken in.
  • Older than this change, by a run: the title edited in place from the tab's menu, with no server, puts the old title back and shows two toasts for the one failure. The before build cc991c6505 shows the same two, word for word ("Not connected to an OpenCode server" / "Nothing was sent." and "Failed to rename session" / "Not connected to an OpenCode server"). Not changed here: a follow-up makes it one toast in official's words (packages/app/src/shell/titlebar/tab-rename-machine.ts:274-283, tab-nav.tsx:354-357), and with it a refused /rename words reads Request failed.
  • Merged on: CI run 45687337329 green on c87457101 (guardrails, macOS, Windows x64, Windows arm64, Linux x64; Linux arm64 skipped). dev took no file of this change since its base.
  • Cases 6 to 9 are not run: each needs a server.

The cases:

  1. The / list has /rename with its description and Ctrl+R. Before: no such row.
  2. Picking /rename from the list leaves /rename in the composer and runs nothing.
  3. /rename New words, Return, with no server: the composer clears; the header and the tab keep the title they had; one toast says nothing was sent.
  4. The palette lists Generate session title with its description on a session's page, and not on a subagent's page.
  5. A bare /rename, Return, with no server: one toast says nothing was sent; the title is as it was and does not shimmer.

With a server:

  1. A bare /rename: one update goes out with an empty title; the header's title shimmers until the answer; then the new title shows in the header, the tab and the list. A second bare /rename meanwhile sends nothing.
  2. Generate session title from the palette does the same, and is not offered while the title shimmers.
  3. /rename New words: one update with that title; the header and the tab read "New words" once the server has answered; it stays after a reload.
  4. A server that refuses the ask: the shimmer ends and a toast titled Request failed shows.

Official: Rename session is also the slash command /rename: with words after it the session takes them as its title, bare it asks the server to generate a new title; a new command, Generate session title, does the same; the header's title shimmers meanwhile and a second ask does nothing (packages/app/src/session/timeline/message-timeline.tsx:300-319, :702-704, controller.tsx:455-494).

Ours had Rename session as an edit in place only. A command's /name can now take words (CommandEntry::words in opencode-kernel; only a plugin's could). The ask is the session's update with an empty title, one per session at a time (features/session-menu/src/generate_title.rs); its answer comes back as a rename's does, and the session is read again after it.
Hona added a commit that referenced this pull request Nov 25, 2026
…aft (#1250)

No new official commit since 3ac14c053c. UP-236 (the Add extension dialog redesigned) is ported by #1216, with what ran, the two cases still to run and the one open difference. UP-240 names its draft, #1249, and its line on ours is put right: Rename session edits the title in place, it does not open a dialog.
Hona added 3 commits November 26, 2026 04:19
The first head showed the new title at once and did not put it back: with no server, or a server that refuses, the header and the tab kept a title the server never took (seen in the run: /rename New words on a fixture file kept New words with a toast that nothing was sent). Official sends the update and shows the title when the server's event comes (packages/app/src/session/timeline/controller.tsx:472-478). Ours now does the same: the write goes out and session.renamed brings the title.
@Hona
Hona marked this pull request as ready for review November 25, 2026 20:43
@Hona
Hona merged commit fce76a1 into dev Nov 25, 2026
7 checks passed
@Hona
Hona deleted the upstream-f/rename-generates branch November 25, 2026 20:43
Hona added a commit that referenced this pull request Nov 25, 2026
No new official commit since 57551d990d. UP-240 (a bare /rename asks the server for a new session title) is ported by #1249: the row has what ran on a fixture file, the four cases that wait for a server, and its three differences from official.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant