Skip to content

A failed in-place rename says so once, in official's words - #1269

Merged
Hona merged 10 commits into
devfrom
upstream-f/rename-one-toast
Nov 26, 2026
Merged

Hona merged 10 commits into
devfrom
upstream-f/rename-one-toast

Conversation

@Hona

@Hona Hona commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

A session's title edited in place (a tab's menu, the header) showed two toasts for one failed save. It now shows one, in official's words. A fault of ours only: no official commit, so no ledger row.

What changes

The save Official Ours before Ours now
Could not be sent (no server) one toast: "Request failed", description = error.message (packages/app/src/shell/titlebar/tab-nav.tsx:354-357; with no server context it rejects with new Error("Request failed"), :321-327) two: "Not connected to an OpenCode server" / "Nothing was sent." and "Failed to rename session" / "Not connected to an OpenCode server" one: "Request failed" / "Not connected to an OpenCode server"
No answer in 15 s one toast: "Request failed", nothing under it (tab-rename-machine.ts:274-283, :282) one: "Failed to rename session" and a sentence that the accepted title is back one: "Request failed", nothing under it
Refused by the server one toast: "Request failed", the error's words under it (tab-nav.tsx:354-357; the dialog project-session-row.tsx:276-279; /rename words session/timeline/controller.tsx:480-482) one: "Failed to rename session", the server's words under it one: "Request failed", the server's words under it

In every case the title the server last accepted is put back, as before.

The last row also closes a difference #1249 named: a refused /rename words now reads Request failed.

How

  • The save's write says nothing itself when it cannot go. apps/desktop/src/session/inbox/send.rs: App::write is split into offer (hands the write to the server's writer, or says why there is none: Unsent::ReadOnly, Unsent::NoWriter), write (offer + the toast, as before for every other write) and write_quiet (offer alone). The session menu's host has write_server_quiet for it, which hands back what became of the write (Offered::Sent, NoWriter, ReadOnly; features/session-menu/src/host.rs, apps/desktop/src/session/menu.rs).
  • The edit's machine says the one toast (features/session-menu/src/rename.rs dispatch). What a failed save has to say was a string compared with a translated sentence; it is an enum now, Why::{Unsaid, NotSent, ReadOnly, Refused}.
  • A refused rename's toast is titled common.requestFailed (features/session-menu/src/lib.rs session_write_replied), as an archive's and a restore's already are.

How it differs from official, and what is left

  • A build that may not send (ours only: official has no such build) keeps its own words for this save: one toast, "Nothing was sent" / "This window is read-only. Relaunch without --read-only to act.", as any write shows there. Before, that toast and the edit's own both showed. By reading; case 5.
  • The same double toast stands in two more places, not changed here: the Rename dialog (features/session-menu/src/rename_dialog.rs:172-179) and a queued prompt's change (features/inbox/src/queue/mod.rs:339-343, its write path not traced yet). One later change closes both.
  • The words of the toast for any other write that cannot be sent ("Not connected to an OpenCode server" / "Nothing was sent.") are as they were. Official has no such state but the one above.
  • The locale key rune.toast.renameNoAnswer is no longer used. It stays in the locale files.

Run

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

  • A before pass has run on the older Rune pin (headless, the app's own fixture file, no server; on dev's build from before A bare /rename asks the server for a new session title (opencode#66396) #1249, head cc991c6505, and on A bare /rename asks the server for a new session title (opencode#66396) #1249's head c87457101): the tab's menu, Rename, "By the menu" typed, Return: the title back as it was and two toasts, "Not connected to an OpenCode server" / "Nothing was sent." and "Failed to rename session" / "Not connected to an OpenCode server".
  • On 13ec78b41, the head that merges (headless, Windows x64 CI build, run 45721451658, the app's own fixture file, no server; 2 launches exit 0; before = opencode-rune chore(pgo): the profiles re-keyed to Rune 5342f14d's symbol names #1271's own PR build, head 278f9aaf38, run 45709668204):
    • Case 1 holds: tab menu > Rename, "By the menu", Return: header and tab keep "Sidebar shows stale session titles", and one toast shows: "Request failed" / "Not connected to an OpenCode server". Before (278f9aaf38): two toasts ("Not connected to an OpenCode server" / "Nothing was sent." and "Failed to rename session" / "Not connected to an OpenCode server").
    • Case 2 holds: header title (title-button pressed), "By the header", Return: header and tab keep "Sidebar shows stale session titles", and one toast shows: "Request failed" / "Not connected to an OpenCode server".
  • On dfa0ae5c4 (headless, Windows x64 CI build, run 45712898391, same fixture and before build; only the two-line Why::NotSent description string changed between dfa0ae5c4 and 13ec78b41): cases 3 and 4 hold (/rename New words clears composer, keeps title, shows one toast "Not connected to an OpenCode server" / "Nothing was sent."; Archive from a session's menu on Home shows the same one toast).
  • Merged on: CI run 45721451658 green on 13ec78b41 (guardrails, macOS, Windows x64, Windows arm64, Linux x64; Linux arm64 skipped). dev took no file of this change since its base.

The cases (headless, this PR's Windows x64 build, the app's own fixture file, no server):

  1. The tab's menu, Rename, a new title, Return: the tab and the header show the title they had; one toast, "Request failed" / "Not connected to an OpenCode server". Before: the two toasts above.
  2. The header's title, edited in place (single press on title-button), a new title, Return: the same one toast.
  3. /rename New words, Return (the shared-file sample: features/session-menu/src/lib.rs, host.rs, apps/desktop/src/session/menu.rs are A bare /rename asks the server for a new session title (opencode#66396) #1249's too): the composer clears, the title stays, one toast "Not connected to an OpenCode server" / "Nothing was sent." (this write is not the edit's, and says so itself as before).
  4. Another write still says so itself: Archive from a session's menu on Home with no server shows the one toast "Not connected to an OpenCode server" / "Nothing was sent." (sending a prompt on --fixture simulates a reply instead of calling App::write).

With a server (a read-only window has one: --read-only on a live server):

  1. A read-only window, the tab's menu, Rename, a new title, Return: the title back as it was; one toast, "Nothing was sent" / "This window is read-only. Relaunch without --read-only to act.". Before: that toast and "Failed to rename session" beside it.

Not run, each needs a server: case 5; a refusal (case: a server that answers the rename with an error: one toast "Request failed" with the server's words); no answer in 15 s (a server that stalls: one toast "Request failed" with nothing under it, and a late failure says nothing more).

Hona added 10 commits November 26, 2026 03:30
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.
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.
The title edited in place (a tab's menu, the header) showed two toasts when its save could not be sent: the write's own 'Not connected to an OpenCode server' and the edit's 'Failed to rename session'. Official shows one, titled Request failed, with the error's words under it, or none after a time-out; with no server its error reads Request failed (packages/app/src/shell/titlebar/tab-rename-machine.ts:274-283, tab-nav.tsx:321-327, :354-357).

The save's write now says nothing itself when it cannot go (App::write_quiet); the edit's machine says the one toast: Request failed / Request failed when not sent, Request failed alone after 15 s. A server's refusal of a rename is titled Request failed too, as an archive's already is.
What a failed save has to say (nothing, not sent, the server's refusal) decided who shows the toast by comparing strings; it is an enum now.
The quiet write hands back why it could not go. With no writer the edit shows official's Request failed; in a build that may not send, which official does not have, it shows what any write shows there: Nothing sent, read-only.
Official takes the failure toast description from error.message (packages/app/src/shell/titlebar/tab-nav.tsx:354-357), repeating Request failed only because its no-server-context branch rejects with new Error('Request failed') (:321-327). Ours has a real cause on the no-writer path (Not connected to an OpenCode server), so the one toast now reads Request failed / Not connected to an OpenCode server instead of repeating its title.
@Hona
Hona marked this pull request as ready for review November 25, 2026 23:59
@Hona
Hona merged commit ed57446 into dev Nov 26, 2026
7 checks passed
@Hona
Hona deleted the upstream-f/rename-one-toast branch November 26, 2026 00:00
Hona added a commit that referenced this pull request Nov 26, 2026
* Unsent writes from rename dialog, question/permission replies, and queue changes show one toast

Follow-up to #1269 for the four remaining write paths whose own state machines emit a failure toast when a write cannot be sent: rename dialog (features/session-menu/src/rename_dialog.rs), permission and question form replies (features/timeline-extras/src/permission/mod.rs), and queued prompt changes (features/inbox/src/queue/{mod,run}.rs).

Each now offers its write quietly via App::write_quiet so the machine emits a single toast: official's Request failed (or queue changeFailed) with the cause Not connected to an OpenCode server when no writer is attached, and our single read-only toast in a read-only window.

* Scope PR to rename dialog: drop non-existent permission double-toast and split queue

Reading permission/mod.rs:150-154 and :168-172 shows reply_permission and send_form already return early through host.write when !writes_open(), and App::write emits no toast on Ok(false) (dead channel), so permission and question form replies never showed a double toast. Queued prompt changes require a live --read-only server to exercise (fixture mutates locally) and move to their own draft PR.
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