Skip to content

Add browser alerts to the console - #1744

Merged
gjkim42 merged 1 commit into
mainfrom
feat/console-browser-alerts
Sep 11, 2026
Merged

Add browser alerts to the console#1744
gjkim42 merged 1 commit into
mainfrom
feat/console-browser-alerts

Conversation

@gjkim42

@gjkim42 gjkim42 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

What type of PR is this?

/kind feature

What this PR does / why we need it:

Users currently need to watch a Session's conversation to notice when it needs input or finishes. Add an opt-in Browser alerts control in the sidebar that sends notifications for input requests and completed or failed work while the user is away from the connected Session's conversation. Clicking a notification opens that Session if it is still available in the active namespace.

The console saves the preference, requests notification permission only when the user enables alerts, and suppresses duplicate events, history replay, and interrupted work. Notification bodies use generic status text without including questions or error contents. Session refreshes dismiss alerts for deleted or replaced Sessions while preserving alerts for existing Sessions. The toggle follows the console's 44px mobile touch-target convention.

Which issue(s) this PR is related to:

N/A

Special notes for your reviewer:

Alerts cover the connected Session while the console tab remains open. They require HTTPS or localhost and a browser that supports notifications from an open page; most mobile browsers do not support these notifications.

Validation:

  • make update
  • make verify
  • env -u CODEX_HOME -u CODEX_AUTH_JSON make test

Unit tests run with CODEX_HOME and CODEX_AUTH_JSON unset to isolate entrypoint fixtures from the agent environment. Tests exercise notification permissions, persistence, event filtering, click targets, failure handling, and cleanup of deleted or replaced Session alerts with a mocked browser API. Failed or stale Session refreshes preserve existing alerts.

Does this PR introduce a user-facing change?

Kelos Console now offers opt-in browser alerts for input requests and completed or failed work in the connected Session while the console tab remains open.

@github-actions github-actions Bot added kind/feature Categorizes issue or PR as related to a new feature needs-triage needs-priority needs-actor release-note labels Sep 11, 2026

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 8 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread internal/consoleserver/frontend/app.ts
@gjkim42

gjkim42 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

/kelos claude-review

@kelos-bot

kelos-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

🤖 Kelos Task Status

Task kelos-claude-reviewer-issue-comment-340f2a601e84 has succeeded. ✅

@kelos-bot

kelos-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

🤖 Kelos Claude Reviewer Agent @gjkim42

Review Summary

Verdict: APPROVE
Overall correctness: patch is correct
Scope: Adds an opt-in Browser alerts sidebar toggle that fires page Notifications for input.requested and turn.completed (completed/failed) on the connected Session while the user is away from its conversation, with click-to-open, localStorage persistence, permission handling, and a node-based test suite.

Findings Overview

Priority Count File:Line Summary
P0 0 none
P1 0 none
P2 0 none
P3 3 internal/consoleserver/frontend/app.ts:672 Events delivered during a socket reconnect are replayed inside history bounds and never alert
P3 docs/reference.md:615 "Clicking an alert opens that Session" overstates the click handler, which only opens Sessions still listed in the active namespace
P3 internal/consoleserver/frontend/app.ts:706 Namespace-mismatch click branch returns silently while the missing-Session branch toasts

Findings

No blocking findings. The event gating is placed before state.lastEventID is advanced, so the event.id <= state.lastEventID dedup, the replayingHistory guard, and the historyPageReading buffering all compose correctly; interrupted and merged completions are excluded; Notification.permission is never read when window.Notification is absent; and the new Notification failure path (Android Chrome's illegal-constructor TypeError) is caught and degrades the toggle to Unavailable without breaking conversation rendering. The generated web/app.js matches frontend/app.ts, and session_history_test.js gains the notifySessionEvent stub the shared handleEvent slice now needs.

Suggestions (optional)

  • [P3] internal/consoleserver/frontend/app.ts:672connectSocket() sets state.replayingHistory = true (line 3007) and subscribes with since: state.lastEventID, so an input.requested or turn.completed that lands while the socket is reconnecting (console-server restart, network blip) is rendered on replay but never alerted, even though it is new to this client. docs/reference.md documents this honestly, so it is a design limitation rather than a bug. A follow-up could record lastEventID before subscribing and alert for replayed events above it when history.start is neither a reset nor a journal replacement.
  • [P3] docs/reference.md:615 — "Clicking an alert opens that Session." is slightly stronger than the code: the click handler only calls selectSession when the Session is still in state.sessions for the active namespace, and otherwise shows a toast. Consider "Clicking an alert opens that Session if it is still available in the active namespace."
  • [P3] internal/consoleserver/frontend/app.ts:706 — the session.namespace !== state.namespace branch returns without any feedback, whereas the missing-Session branch shows a toast. Since switchNamespace already calls closeBrowserNotifications(), this branch is effectively unreachable; either drop it or reuse the same toast so the two stale-target paths behave alike.
  • [P3] internal/consoleserver/web/styles.css:124 — the mobile media query raises .sidebar-footer .quiet-button to a 44px touch target but not the new #browser-alerts button. Low impact because the toggle is disabled on most mobile browsers, but Firefox for Android does support page notifications.

Key takeaways

  • Alert gating (selected Session, history replay, lastEventID dedup, excluded statuses, visibility/focus/view check) is correct and self-contained; no P0/P1 issues found.
  • Tests cover the primary action with concrete title/body/tag assertions, plus permission flows, in-flight toggle, storage failures, constructor failures, and stale click targets.
  • PR follows the template, /kind feature is correct, the release note is meaningful, and docs/reference.md was updated alongside the user-facing change.

@gjkim42
gjkim42 force-pushed the feat/console-browser-alerts branch from f831b83 to 2910b25 Compare September 11, 2026 10:38
@gjkim42

gjkim42 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the current review feedback and squashed the branch to one commit, 2910b25.

  • Fixed stale alerts for deleted or replaced Sessions and added Session-refresh coverage.
  • Clarified that notification clicks open Sessions still available in the active namespace, and matched the existing 44px mobile touch targets.
  • Kept reconnect replay suppression as the documented scope of this feature; catch-up notifications remain a possible follow-up.
  • Retained the namespace guard for stale notification clicks after navigation. The suggestion to remove it or change its feedback is optional and does not require a behavior change.

Validation passed: make verify and env -u CODEX_HOME -u CODEX_AUTH_JSON make test. The PR description reflects the final implementation.

@gjkim42
gjkim42 enabled auto-merge September 11, 2026 11:01
@gjkim42
gjkim42 added this pull request to the merge queue Sep 11, 2026
Merged via the queue into main with commit 015888e Sep 11, 2026
23 checks passed
@gjkim42
gjkim42 deleted the feat/console-browser-alerts branch September 11, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature needs-actor needs-priority needs-triage release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant