Skip to content

feat(app): add Regenerate title action across session menus - #67748

Merged
gsimone merged 2 commits into
anomalyco:devfrom
gsimone:regenerate-title-menus
Dec 2, 2026
Merged

gsimone merged 2 commits into
anomalyco:devfrom
gsimone:regenerate-title-menus

Conversation

@gsimone

@gsimone gsimone commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

N/A

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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).

  • Shared regenerator & state machine: Adds regenerate-title-machine.ts and SessionTitleRegeneratorProvider mounted under GlobalProvider in packages/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 shared patchSessionTitleCache, and shows an informational toast when the title is unchanged.
  • Unified with /rename and session.title.generate: Moves #66396's bare /rename and session.title.generate command in packages/app/src/session/timeline/controller.tsx onto the shared regenerator and adds aria-busy to the header title button while shimmering.
  • Session menus: Adds Regenerate title directly below Rename in the session header menu, tabs, pinned titlebar tabs, sidebar pins, project session rows, recent sessions, inbox, and Home (disabled on subagent sessions and while regenerating), and updates the exact-menu E2E assertions in session-header.spec.ts, home.spec.ts, and tabs.spec.ts.
  • Feature flag: No flag — bare /rename and session.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 lint and bun run lint:changed (0 problems)
  • bun run typecheck:tsc in packages/app
  • packages/app: regenerate-title-machine.test.ts, full bun run test:unit, and bun run test:browser
  • Verified locally in the live app UI via Playwright (triggering Regenerate title from the header menu, observing live TextShimmer, and confirming header + sidebar update in sync).

Screenshots / recordings

Verified locally across the session header menu, live TextShimmer, and sidebar title sync.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Before

After

Screenshot

],
}

if (event.type === "regenerate.timed-out")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gsimone
gsimone merged commit 71cb050 into anomalyco:dev Dec 2, 2026
10 checks passed
@amrkmn amrkmn mentioned this pull request Dec 3, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant