fix(macos): menu bar activity badge not showing during agent work

The gateway emits agent events with stream='lifecycle' and data.phase
('start'/'end'/'error'), but ControlChannel.swift was looking for
stream='job' and data.state ('started'/'streaming'/etc).

This mismatch caused the menu bar to always show 'Idle' even when the
agent was actively working.

Changes:
- ControlChannel.swift: Handle 'lifecycle' stream instead of 'job',
  map phase values to the states WorkActivityStore expects
- AgentEventsWindow.swift: Update stream color mapping for consistency

Fixes #1932
This commit is contained in:
Clawdbot 2026-01-26 00:15:21 +01:00 committed by Martin (via Clawdbot)
parent 109ac1c549
commit 9d991bb5f5
2 changed files with 6 additions and 3 deletions

View File

@ -67,7 +67,7 @@ private struct EventRow: View {
private var tint: Color {
switch self.event.stream {
case "job": .blue
case "lifecycle": .blue
case "tool": .orange
case "assistant": .green
default: .gray

View File

@ -379,8 +379,11 @@ final class ControlChannel {
let sessionKey = (event.data["sessionKey"]?.value as? String) ?? "main"
switch event.stream.lowercased() {
case "job":
if let state = event.data["state"]?.value as? String {
case "lifecycle":
// Gateway emits phase: "start" | "end" | "error"
// WorkActivityStore expects state: "started" | "streaming" | (anything else = done)
if let phase = event.data["phase"]?.value as? String {
let state = phase.lowercased() == "start" ? "started" : "done"
WorkActivityStore.shared.handleJob(sessionKey: sessionKey, state: state)
}
case "tool":