#3474: fix(macos): menu bar activity badge not showing during agent work
app: macos
Cluster:
macOS Notification and Menu Fixes
## Summary
Fixes two macOS issues:
1. **Menu bar activity badge** - Wasn't showing during agent work due to missing state update
2. **Chat window crash** - Prevented crash when opening chat window
## Rebased from #1994
Previous PR was closed due to merge conflicts. This is a clean rebase on current main.
## Changes
- Fix activity badge state propagation in menu bar
- Add nil check for chat window initialization
## Testing
- Verified badge appears during agent activity
- Confirmed chat window opens without crash
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates macOS agent activity/UI state wiring so the menu bar activity badge reflects active agent work, and it adds a defensive path in chat markdown rendering to avoid a crash when `Textual`’s SwiftPM resource bundle isn’t found in packaged app layouts.
Key changes are:
- `ControlChannel.routeWorkActivity` now listens to `stream == "lifecycle"` events and converts gateway lifecycle signals into `WorkActivityStore.handleJob` state updates, so the badge can transition into and out of “working”.
- `AgentEventsWindow` display logic aligns the stream label/tint mapping with the new lifecycle stream name.
- `ChatMarkdownRenderer` conditionally uses `StructuredText` only when Textual resources appear available; otherwise it falls back to plain `Text`.
<h3>Confidence Score: 3/5</h3>
- Reasonably safe to merge, but the new Textual-bundle gating logic may regress markdown rendering in some packaging/configurations.
- ControlChannel’s stream/state mapping is small and localized, and aligns with WorkActivityStore’s started-vs-done semantics. The higher risk is in ChatMarkdownRenderer: bundle detection is eager (static), path-based, and relies on DEBUG heuristics, which could cause unnecessary plain-text fallback or fail to prevent the original crash in some build modes.
- apps/shared/MoltbotKit/Sources/MoltbotChatUI/ChatMarkdownRenderer.swift
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#22458: Codex/macos chat corner clip
by apethree · 2026-02-21
77.9%
#15909: Guard notifications on macOS; fix focus issue and build fixes
by jasonkneen · 2026-02-14
76.9%
#14309: fix(ui): resolve chat event session key mismatch
by justonlyforyou · 2026-02-11
76.4%
#21679: fix: Mission Control dashboard issues for agent status, stale sessi...
by thejawdoc · 2026-02-20
76.2%
#12974: fix: intermittent (no output) reported by users
by vincentkoc · 2026-02-10
75.9%
#3721: fix(ui): webchat not displaying chat responses
by maxmaxrouge-rgb · 2026-01-29
75.7%
#2716: Fix #2678: markdown horizontal rules not rendering in web chat
by Ambar-13 · 2026-01-27
75.2%
#5693: fix(chat): display error messages when LLM requests fail
by niemesrw · 2026-01-31
75.0%
#3337: fix(macos-app): patch SwiftPM Bundle.module accessor for app bundle
by skymoore · 2026-01-28
74.3%
#10898: fix(mac): adopt canonical session key and add reset triggers
by Nachx639 · 2026-02-07
73.9%