fix(server): broadcast session metadata updates to all clients#1081
Conversation
🦋 Changeset detectedLatest commit: 3edf4be The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ddf2dbfaa
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| updatedAt: new Date().toISOString(), | ||
| }; | ||
| await this.session.writeMetadata(); | ||
| await this.session.rpc.emitEvent({ |
There was a problem hiding this comment.
Publish rename events for inactive sessions too
When /sessions/{id}/profile renames a persisted session that is not currently resumed, CoreAPIImpl.renameSession takes the sessionStore.rename(...) path instead of constructing SessionAPIImpl, so this new session.meta.updated emit never runs. In that server context, other connected clients still receive no metadata event even though the broadcast layer now fans such events out globally, leaving their session lists stale until a reload; publish the same event from the store-only rename path or route both paths through a shared helper.
Useful? React with 👍 / 👎.
- deliver session.meta.updated to every connection instead of only session subscribers, so title changes sync across all clients - emit session.meta.updated when a session is explicitly renamed
3ddf2db to
3edf4be
Compare
Related Issue
No related issue. The problem is described below.
Problem
In server mode, session metadata updates (such as title changes) were only delivered to WebSocket clients that had explicitly subscribed to that session. A client that had not subscribed to a session never received its metadata updates, so its session list would fall out of sync. For example, if frontend A is subscribed to only a subset of sessions and frontend B creates a new session and changes its title, frontend A never sees the new title.
There was a second gap: explicitly renaming a session through the profile API did not emit any metadata event, so even clients subscribed to that session were not notified of the rename.
What changed
session.meta.updatedto every connected client instead of only the session's subscribers, so metadata changes stay in sync across all clients regardless of their subscriptions.session.meta.updatedwhen a session is explicitly renamed, matching the existing auto-title behavior, so renames are propagated to peers.session.meta.updated.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.