Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-web-unread-aborted.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---

Stop showing unread dots on cancelled or failed sessions in the web sidebar.
12 changes: 7 additions & 5 deletions apps/kimi-web/src/composables/useKimiWebClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ function connectEventsIfNeeded(): void {
appEvent.type === 'sessionStatusChanged' &&
(appEvent.status === 'idle' || appEvent.status === 'aborted')
) {
onSessionIdle(appEvent.sessionId);
onSessionIdle(appEvent.sessionId, appEvent.status);
}

// Permission auto-approve: CLIENT-SIDE POLICY until the daemon exposes a
Expand Down Expand Up @@ -2607,7 +2607,7 @@ const availableOpenInApps = computed<string[]>(() => rawState.availableOpenInApp
// prompt to it was silently enqueued and never flushed.
// ---------------------------------------------------------------------------

function onSessionIdle(sid: string): void {
function onSessionIdle(sid: string, status: 'idle' | 'aborted'): void {
// The turn finished — this session no longer has a prompt in flight.
inFlightPromptSessions.delete(sid);
rawState.sendingBySession = { ...rawState.sendingBySession, [sid]: false };
Expand All @@ -2625,9 +2625,11 @@ function onSessionIdle(sid: string): void {
resetFastMoon();
void loadGitStatus(sid);
void refreshSessionStatus(sid);
} else {
// A background session just finished a turn the user hasn't seen — light up
// its unread dot until they open it.
} else if (status === 'idle') {

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 Clear persisted unread flags for aborted sessions

When a user already has rawState.unreadBySession[sid] === true for a session that is now cancelled/failed (for example the stale localStorage entries called out in this PR’s refresh scenario), this new status === 'idle' guard only avoids setting another flag; it never removes the existing one. Since unreadBySession is exposed from the stored map without checking the session status, aborted sessions can still render with an unread dot after refresh or after receiving an aborted status. The aborted branch should clear and persist the flag for that session.

Useful? React with 👍 / 👎.

// A background session finished a turn the user hasn't seen — light up its
// unread dot until they open it. Aborted (cancelled/failed) turns are
// excluded on purpose: there is no fresh result to read, and counting them
// is what made the sidebar fill with stale unreads after a refresh.
rawState.unreadBySession = { ...rawState.unreadBySession, [sid]: true };
saveUnreadToStorage(rawState.unreadBySession);
}
Expand Down
Loading