Skip to content

feat(kimi-web): add status-aware browser notifications#1479

Merged
liruifengv merged 10 commits into
mainfrom
fix-web-notify
Jul 9, 2026
Merged

feat(kimi-web): add status-aware browser notifications#1479
liruifengv merged 10 commits into
mainfrom
fix-web-notify

Conversation

@liruifengv

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue. This addresses a UX gap in the web UI notifications.

Problem

The web UI only fired a single browser notification titled "Kimi Code · Turn finished" when a session went idle, with no notification for tool approval requests. When the agent was blocked waiting for the user to approve a tool call or answer a question, users who switched tabs would either get no alert or a misleading "Turn finished" notification. The CLI already distinguishes three attention states (turn complete, approval required, question needed); the web UI should match.

What changed

  • Added a new browser notification for tool approval requests, with its own title/body (Kimi Code · Approval required / 等待审批, body = tool name → session title → generic fallback).
  • Added a default-off preference toggle for approval notifications in Settings → Notifications, alongside the existing completion and question toggles.
  • Guarded the generic "Turn finished" notification so it no longer fires for aborted turns or when the session has pending approvals/questions.
  • Extracted a pure shouldNotifyCompletion helper to make the guard decision unit-testable.
  • Added English and Chinese i18n strings and tests covering the approval copy, default-off preference, persistence, and the completion guard.

This follows the existing notification module pattern in apps/kimi-web/src/composables/client/useNotification.ts, so the change stays consistent with completion/question notifications.

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 Jul 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7bb4fa8

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

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code 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 Jul 7, 2026

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

commit: 7bb4fa8

- Key completion notification tags by turn (sid + promptId) and question
  tags by request id, so a stale notification left in the notification
  center no longer swallows every follow-up alert in the same session
- Suppress notifications only while the window is actually focused, not
  merely visible (document.hasFocus() on top of visibilityState)
- Play the attention sound when a tool needs approval, matching the
  completion and question sounds
@liruifengv liruifengv merged commit 735922c into main Jul 9, 2026
10 checks passed
@liruifengv liruifengv deleted the fix-web-notify branch July 9, 2026 04:30
@github-actions github-actions Bot mentioned this pull request Jul 9, 2026
sailist pushed a commit that referenced this pull request Jul 9, 2026
* feat(kimi-web): add approval notification storage key and i18n copy

* feat(kimi-web): add approval notification helpers and tests

* feat(kimi-web): wire approval notifications and guard completion alerts

* fix(kimi-web): extract shouldNotifyCompletion helper and add tests

* feat(kimi-web): add approval notification settings toggle

* chore(kimi-web): add changeset and tidy notification module comment

- Align approval notification tag with spec (kimi-approval-${approvalId})

- Update module header to describe all three notification kinds

* fix(kimi-web): make notifications fire reliably

- Key completion notification tags by turn (sid + promptId) and question
  tags by request id, so a stale notification left in the notification
  center no longer swallows every follow-up alert in the same session
- Suppress notifications only while the window is actually focused, not
  merely visible (document.hasFocus() on top of visibilityState)
- Play the attention sound when a tool needs approval, matching the
  completion and question sounds

* chore(kimi-web): simplify changeset
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