Skip to content

fix(desktop): preserve unread thread badges and allow custom badge colors - #30877

Closed
sitenzo wants to merge 1 commit into
pingdotgg:mainfrom
sitenzo:fix/persistent-notification-badge
Closed

sitenzo wants to merge 1 commit into
pingdotgg:mainfrom
sitenzo:fix/persistent-notification-badge

Conversation

@sitenzo

@sitenzo sitenzo commented Nov 4, 2026

Copy link
Copy Markdown

Problem

On Windows, I expected T3 Code's taskbar icon to behave like the counters in WhatsApp or ChatGPT: keep showing conversations I have not read and conversations that still need my input.

The initial report came from T3 Code Desktop 0.1.7 on Windows 11. Device notifications were disabled, which explained why no counter appeared initially. Source inspection then identified a separate limitation in the implemented counter, also present in nightly 0.1.8-nightly.20261104.4165: bringing any T3 window into focus resets the entire badge and clears its pending notification collection, regardless of which conversation was opened. Other unread completions and unanswered requests lose their reminder too.

The mounted conversation also advances its visit watermark while the application is in the background. That can acknowledge a completion the user has not actually viewed.

To illustrate the requested behavior:

  1. Enable Settings → General → Thread notifications.
  2. Let two conversations complete and another request input.
  3. Return to T3 and read only one completed conversation.
  4. The proposed count decreases from 3 to 2. The other unread completion and the unanswered request stay counted.
  5. Viewing the request does not remove it until it is answered or otherwise resolved.

The existing badge is also always drawn red (#e5484d). T3 supplies that image to Windows; the red color is not selected by Windows.

Change

  • Derive the badge from current conversation state across connected environments, rather than from the lifetime of OS notifications.
  • Count unread completions, unseen failures, and unresolved requests for input or approval, guest requests, and usage-limit attention states.
  • Remove the blanket native and frontend badge reset on window focus.
  • Advance a conversation's visit watermark only while its view is mounted in a visible, focused window.
  • Preserve outstanding requests after viewing them; reduce the count when the underlying request is resolved.
  • Rebuild the count from available conversation snapshots after reopening the client, without replaying old notification banners.
  • Continue excluding archived conversations and conversations hidden by the existing tag filter.
  • Avoid redrawing the badge when its count and color have not changed, and avoid recalculating the full badge on ordinary streaming updates that do not change badge eligibility.
  • Add a persisted, device-local Notification badge color setting under Settings → General, including settings search and a preview. It controls the Windows taskbar overlay and browser-tab counter. Choose black, blue, red, or any custom color; the number automatically uses black or white for contrast. The existing red remains the default.
  • Keep macOS and Linux badge colors under their native system control.
  • Update the thread user guide.

The shared settings contract adds a validated six-digit hex color with a decoding default for existing installations. No server orchestration or provider protocol changes are required. Mobile notification behavior is unchanged.

Scope and approval

This PR contains the behavior and appearance changes requested together for a persistent, configurable conversation badge.

Related: #21911. That issue was closed as not planned, and the maintainer response explicitly says clearing on focus is intentional. This PR therefore proposes a product-behavior change; it does not claim that the current focus-clearing behavior is an accidental regression.

No prior maintainer approval of this direction or combined scope has been obtained. The color option configures the existing badge-rendering capability, while the persistent-count behavior changes when that badge is acknowledged.

Verification

  • Added regression assertions and confirmed failure against the original behavior: native focus reset the badge to zero, and the coordinator did not restore the expected count of three from existing unread/request state.
  • vp run check:changed passed formatting, lint, both knip passes, typechecks of the affected packages and dependents, 80 tests, and the applicable React compiler check.
  • Native badge tests exercise Windows, macOS, and Linux with mocked Electron APIs, covering preservation on focus, IPC validation, explicit clearing, quit, and disposal.
  • Coordinator browser coverage checks restored counts, reading one completion without acknowledging another, retaining viewed but unresolved input, request resolution, archiving, and existing notification-mode behavior.
  • The conversation visit browser test covers thread switching, background updates not being marked read, and updating the visit watermark on return.
  • In the running isolated development app at 1440 × 1000, changing the color persisted across reloads. Black and white selections were checked, and no page JavaScript errors were observed.

Limitations: the native Windows taskbar overlay and OS notification delivery have not been verified end to end in a packaged desktop build. No Windows installer was built, and the user's installed application was not modified. The conversation-count behavior is covered by automated tests; no end-to-end agent-turn recording is attached.

Screenshots

The screenshots show the new setting before and after changing its color; the first is the default red configuration, not the original settings page before this PR.

Default red configuration Custom black configuration after reload
New badge color setting using the existing red default Badge color setting using black after reload

Written by GPT-6.1 Sol, with reasoning effort High, through the Codex harness in T3 Code.

Derive badge counts from unread completions and unresolved requests across connected environments. Only record visits while the conversation is visible in a focused window, preserve native badges on focus, and persist a device-local badge color with readable text contrast.

Validated with check:changed, 80 focused tests, platform-specific native badge checks, and the running settings UI.

Implemented with GPT-6.1-Sol through the Codex harness.
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Nov 4, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at e7f670b

Macroscope's review found this PR approvable — Unread-thread badges now survive app focus and can use a custom color on Windows and web. Notifications remain opt-in, the existing default color is preserved, and the changes are limited to notification presentation and visit tracking.

You can add or adjust custom eligibility rules. Learn more.

@sitenzo

sitenzo commented Nov 4, 2026

Copy link
Copy Markdown
Author

Closing this PR for now. I had missed the earlier discussion in #21911 and the maintainer response explaining that clearing the badge on app focus is intentional when I started this work.

I will take that feedback into account and further refine the proposal and implementation, including platform-appropriate behavior and validation for macOS and other devices rather than focusing only on Windows. Once that work and the direction are clearer, I plan to open a new, better-scoped PR.

Thank you for the feedback and review time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant