Repository navigation
feat(app): add Regenerate title action across session menus - #67748
Conversation
There was a problem hiding this comment.
Regenerate title works as described in Desktop. I drove the session header menu on the base and on this branch with the simulated model. On this branch the menu shows Rename, Regenerate title, Export…, Delete…, and clicking the new item sends the regeneration request; the simulated model returns the same title, so the "Title unchanged" toast appears. The new machine test passes and tsc -b in packages/app passes.
Public API: unchanged. This is client-side only and reuses the existing session.update with an empty title.
One behaviour worth a look: what a timed-out regeneration does on the server and in the UI (inline).
| ], | ||
| } | ||
|
|
||
| if (event.type === "regenerate.timed-out") |
There was a problem hiding this comment.
When the 45s client timeout fires, the fetch is aborted, but the server keeps generating the title. The app shows "Failed to regenerate title" and enables the menu item again, so a retry can start a second model call while the first is still running. The first call's title can also arrive after the "Failed" toast. Could the timeout be raised to cover the server's own generation limit, or could timing out keep the session marked as regenerating until the next renamed event or refresh? Then the timeout would not end in an error the server later contradicts.
There was a problem hiding this comment.
Raised the client timeout to 90s (covering a title-model call plus primary fallback) and updated the timeout path so checks whether the server already landed a new title before showing a failure toast, avoiding a contradictory error.
There was a problem hiding this comment.
Thanks, I checked 3677719. Raising the timeout to 90s and refreshing before the error toast means a title the server saved before the timeout no longer gets a contradictory "Failed" toast. The machine test still passes.
One gap remains, though it's narrower now. The refresh runs at the moment of the timeout. If the server is still generating then, the refresh sees the old title, so the "Failed" toast still appears and the new title can arrive after it. The session also stops being marked as regenerating, so a retry can start a second model call alongside the first. A 90s limit makes that rare. If you'd rather close it fully, keep the session marked as regenerating after the timeout until the session's next title update arrives. I don't see this as blocking.
There was a problem hiding this comment.
Keeping the bounded 90s timeout here intentionally: per , async UI states need a bounded fallback so a dropped connection or empty/unchanged generation (which emits no event) can't leave the header shimmering and Rename/Regenerate permanently disabled. Aborting the request on timeout also interrupts the server-side fiber via Effect's HTTP handler, so the 90s ceiling + refresh-before-toast covers the practical cases cleanly.
There was a problem hiding this comment.
Keeping the bounded 90s timeout here intentionally: per packages/app/AGENTS.md, async UI states need a bounded fallback so a dropped connection or empty/unchanged generation (which emits no session.renamed event) can't leave the header shimmering and Rename/Regenerate permanently disabled. Aborting the request on timeout also interrupts the server-side SessionTitle fiber via Effect's HTTP handler, so the 90s ceiling + refresh-before-toast covers the practical cases cleanly.



Issue for this PR
N/A
Type of change
What does this PR do?
Adds a shared app-level AI title regenerator and exposes Regenerate title right below Rename across every session menu in the Desktop/Web app (companion to #67747, which adds the Title generation model setting in Settings → Models).
regenerate-title-machine.tsandSessionTitleRegeneratorProvidermounted underGlobalProviderinpackages/app/src/app.tsx. Regeneration state is shared across all surfaces, survives row/tab/route unmounts, handles bounded timeouts with a session refresh, coordinates mutual exclusion with Rename, refreshes cached session lists via sharedpatchSessionTitleCache, and shows an informational toast when the title is unchanged./renameandsession.title.generate: Moves#66396's bare/renameandsession.title.generatecommand inpackages/app/src/session/timeline/controller.tsxonto the shared regenerator and addsaria-busyto the header title button while shimmering.session-header.spec.ts,home.spec.ts, andtabs.spec.ts./renameandsession.title.generate(#66396) are already shipped; this makes the same action reachable from session context menus.How did you verify your code works?
bun run lintandbun run lint:changed(0 problems)bun run typecheck:tscinpackages/apppackages/app:regenerate-title-machine.test.ts, fullbun run test:unit, andbun run test:browserTextShimmer, and confirming header + sidebar update in sync).Screenshots / recordings
Verified locally across the session header menu, live
TextShimmer, and sidebar title sync.Checklist