Skip to content

fix(server): broadcast session metadata updates to all clients#1081

Merged
sailist merged 1 commit into
MoonshotAI:mainfrom
sailist:fix/broadcast-session-meta
Jun 25, 2026
Merged

fix(server): broadcast session metadata updates to all clients#1081
sailist merged 1 commit into
MoonshotAI:mainfrom
sailist:fix/broadcast-session-meta

Conversation

@sailist

@sailist sailist commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

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

  • Broadcast session.meta.updated to every connected client instead of only the session's subscribers, so metadata changes stay in sync across all clients regardless of their subscriptions.
  • Emit session.meta.updated when a session is explicitly renamed, matching the existing auto-title behavior, so renames are propagated to peers.
  • Add an end-to-end test covering cross-client delivery of session.meta.updated.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3edf4be

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/kimi-code Patch
@moonshot-ai/server Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@3edf4be
npx https://pkg.pr.new/@moonshot-ai/kimi-code@3edf4be

commit: 3edf4be

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread packages/agent-core/src/session/rpc.ts Outdated
updatedAt: new Date().toISOString(),
};
await this.session.writeMetadata();
await this.session.rpc.emitEvent({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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
@sailist sailist force-pushed the fix/broadcast-session-meta branch from 3ddf2db to 3edf4be Compare June 24, 2026 14:55
@sailist sailist merged commit 8fc6aa5 into MoonshotAI:main Jun 25, 2026
8 checks passed
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