Allow users to edit session titles in the web UI
Summary
Users should be able to rename a session's title directly from the web UI. Currently, session titles are set only at creation time (and web-created sessions always have title: null, falling back to owner/repo). There is no way to edit a title after the session is created.
Context
How titles work today
- Creation:
CreateSessionRequestaccepts an optionaltitlefield, but the web home page (packages/web/src/app/(app)/page.tsx) never sends one — so all web-created sessions havetitle: null. - Display fallback: Both the sidebar (
SessionListItem) and the session page header fall back toowner/repowhen title is null. - Storage: Titles are stored in two places that must be kept in sync:
- The Session Durable Object's SQLite
sessiontable (packages/control-plane/src/session/repository.ts) - The D1 session index
sessionstable (packages/control-plane/src/db/session-index.ts)
- The Session Durable Object's SQLite
- No update path exists: There is no API endpoint, repository method, or UI affordance for renaming a session after creation.
Requirements
1. Control Plane — Session DO repository
Add an updateSessionTitle method to SessionRepository (packages/control-plane/src/session/repository.ts). Follow the pattern of existing update methods like updateSessionStatus.
2. Control Plane — Session Durable Object handler
Add a handleUpdateTitle method to the Session DO (packages/control-plane/src/session/durable-object.ts). This should:
- Parse
{ title, userId }from the request body - Validate that
titleis a non-empty string (max ~200 chars is reasonable) - Verify the user is a session participant (same authorization pattern as
handleArchive) - Update the title in the DO's SQLite via the new repository method
- Broadcast the title change to connected WebSocket clients (e.g.
{ type: "session_title", title })
Register the handler in the DO's internal route table (e.g. { method: "POST", path: "/internal/update-title", handler: ... }).
3. Control Plane — Router
Add a new route in packages/control-plane/src/router.ts:
PATCH /sessions/:id/title— follows the existing pattern where the router proxies to the DO and then updates D1
The handler should:
- Forward the request to the DO's internal endpoint
- On success, update the D1 session index title (add an
updateTitlemethod toSessionIndexStoreinpackages/control-plane/src/db/session-index.ts, following the pattern ofupdateStatus)
Use the handleArchiveSession function as a reference for this router → DO → D1 pattern.
4. Web API route
Add a Next.js API route at packages/web/src/app/api/sessions/[id]/title/route.ts that:
- Verifies the user is authenticated (same pattern as the archive route)
- Proxies to the control plane's
PATCH /sessions/:id/title - Sends
{ title, userId }in the request body
Use packages/web/src/app/api/sessions/[id]/archive/route.ts as a template.
5. Web UI — Session page header (inline edit)
In packages/web/src/app/(app)/session/[id]/page.tsx, make the <h1> title (line 548) editable:
- Clicking the title should switch it to an inline text input (controlled component)
- Save on: Enter key or blur (click away)
- Cancel on: Escape key (revert to previous title)
- Call the new
PATCH /api/sessions/[id]/titleendpoint on save - Optimistically update the displayed title; revert on error
- After a successful save, call
mutate("/api/sessions")(SWR) so the sidebar reflects the new title
6. Sidebar — overflow menu with Rename option
Add a "..." (ellipsis/overflow) menu to each SessionListItem in session-sidebar.tsx, visible on hover. This follows the standard pattern used by ChatGPT, Claude.ai, and similar apps. The menu should:
- Appear as a
...(three-dot) icon button on hover over the sidebar item - Open a small popover/dropdown menu with actions, including "Rename"
- Rename should switch the sidebar item's title into an inline text input (same save/cancel behavior as the header: Enter or blur to save, Escape to cancel)
- The menu is also a natural place to add other session actions in the future (e.g., Archive, Delete), but Rename is the only required action for this PR
This is a secondary entry point — the session page header (requirement 5) is the primary place for renaming.
Implementation notes
- Dual-write: Title lives in both the DO (SQLite) and D1 (session index). The router handler must update both, same as archive does for status. The DO is the source of truth; D1 is updated afterward for the listing endpoint.
- WebSocket broadcast: After updating the title in the DO, broadcast the change so other connected clients see the new title in real time. Existing clients read
sessionState.titlefrom WebSocket state. - Auth pattern: Follow the same participant-authorization pattern used by
handleArchive— requireuserIdin the body, verify against the participant list in the DO. - Shared types: No changes to
@open-inspect/sharedtypes should be needed —Session.titleis alreadystring | nullandCreateSessionRequest.titleis already optional.
Files to modify
| File | Change |
|---|---|
packages/control-plane/src/session/repository.ts |
Add updateSessionTitle(title) method |
packages/control-plane/src/session/durable-object.ts |
Add handleUpdateTitle + register internal route |
packages/control-plane/src/db/session-index.ts |
Add updateTitle(id, title) method |
packages/control-plane/src/router.ts |
Add PATCH /sessions/:id/title route + handler |
packages/web/src/app/api/sessions/[id]/title/route.ts |
New file — Next.js API proxy route |
packages/web/src/app/(app)/session/[id]/page.tsx |
Make title <h1> editable inline |
packages/web/src/components/session-sidebar.tsx |
Add ... overflow menu to SessionListItem with "Rename" action |
i'd like to work on this, can i get assigned?