Skip to content
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a39089f
test: cover Claude needs input acknowledgement
austinywang May 26, 2026
63be611
fix: demote Claude needs input after acknowledgement
austinywang May 26, 2026
21d1d73
Merge remote-tracking branch 'origin/main' into issue-2576-native-cla…
austinywang May 26, 2026
5e8cc39
fix: scope agent input acknowledgement to matching notifications
austinywang May 26, 2026
eee40ab
fix: share structured agent notification registry
austinywang May 26, 2026
b3f1b94
Merge origin/main into issue-2576-native-claude-detection-should
austinywang Jun 6, 2026
2491b42
fix: acknowledge removed agent notifications
austinywang Jun 6, 2026
5481f40
test: cover sibling agent notification acknowledgement
austinywang Jun 6, 2026
0c22400
fix: keep agent status while unread alerts remain
austinywang Jun 6, 2026
ea845d0
test: cover agent notification panel id precedence
austinywang Jun 6, 2026
9f1671d
fix: prefer panel id for agent notification acknowledgement
austinywang Jun 6, 2026
8e71084
test: cover localized agent notification acknowledgement
austinywang Jun 6, 2026
bf2d2a9
fix: tag structured agent notifications by status key
austinywang Jun 6, 2026
f39ceec
fix: address agent status premerge feedback
austinywang Jun 6, 2026
673d58f
test: cover queued agent notification acknowledgement
austinywang Jun 6, 2026
d2a714a
fix: include queued agent notifications in acknowledgement guard
austinywang Jun 6, 2026
00a29f9
test: cover pending policy hook agent notifications
austinywang Jun 6, 2026
46a65d9
fix: track pending policy hook agent notifications
austinywang Jun 6, 2026
7d5d01b
Merge remote-tracking branch 'origin/main' into issue-2576-native-cla…
austinywang Jun 10, 2026
bfda23d
test: cover focus clearing feed-routed Claude needs-input
austinywang Jun 10, 2026
afca982
fix: clear feed-routed Claude needs-input on workspace focus
austinywang Jun 10, 2026
3bc1dfe
chore: refresh Swift file-length budget for needs-input fix
austinywang Jun 10, 2026
835f949
fix: keep ghostty submodule at main's pointer after merge
austinywang Jun 10, 2026
11c64b8
test: assert needs-input acknowledgement clears agent lifecycle
austinywang Jun 10, 2026
d8aa8b5
fix: demote agent lifecycle when needs-input is acknowledged
austinywang Jun 10, 2026
b523007
chore: refresh Swift file-length budget for lifecycle demotion fix
austinywang Jun 10, 2026
3f16c38
test: panel-scoped needs-input acknowledgement keeps sibling badge
austinywang Jun 11, 2026
29f0030
fix: scope needs-input acknowledgement by panel, not just status key
austinywang Jun 11, 2026
7f783d2
chore: refresh Swift file-length budget for panel-scoped acknowledgement
austinywang Jun 11, 2026
3c97954
Merge remote-tracking branch 'origin/main' into issue-2576-native-cla…
austinywang Jun 11, 2026
912d604
test: feed prompt on a panel blocks its lifecycle demotion
austinywang Jun 11, 2026
04bf222
fix: count pending feed/queue/policy inputs in panel lifecycle gate
austinywang Jun 11, 2026
d90e083
chore: refresh Swift file-length budget for panel lifecycle gate
austinywang Jun 11, 2026
e2d5726
fix: initialize feedTarget before defer in regression test
austinywang Jun 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions CLI/cmux.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21456,7 +21456,12 @@ struct CMUXCLI {
localized: "cli.claude-hook.notification.title",
defaultValue: "Claude Code"
)
let payload = notificationPayload(title: title, subtitle: completion.subtitle, body: completion.body)
let payload = notificationPayload(
title: title,
subtitle: completion.subtitle,
body: completion.body,
structuredAgentStatusKey: Self.claudeCodeStatusKey
)
_ = try? sendV1Command("notify_target_async \(workspaceId) \(surfaceId) \(payload)", client: client)
}
print("OK")
Expand Down Expand Up @@ -21601,7 +21606,12 @@ struct CMUXCLI {
localized: "cli.claude-hook.notification.title",
defaultValue: "Claude Code"
)
let payload = notificationPayload(title: title, subtitle: summary.subtitle, body: summary.body)
let payload = notificationPayload(
title: title,
subtitle: summary.subtitle,
body: summary.body,
structuredAgentStatusKey: Self.claudeCodeStatusKey
)

if let sessionId = parsedInput.sessionId {
try? sessionStore.upsert(
Expand Down Expand Up @@ -24475,8 +24485,17 @@ struct CMUXCLI {
.replacingOccurrences(of: "|", with: "¦")
}

private func notificationPayload(title: String, subtitle: String, body: String) -> String {
"\(sanitizeNotificationField(title))|\(sanitizeNotificationField(subtitle))|\(sanitizeNotificationField(body))"
private func notificationPayload(
title: String,
subtitle: String,
body: String,
structuredAgentStatusKey: String? = nil
) -> String {
let payload = "\(sanitizeNotificationField(title))|\(sanitizeNotificationField(subtitle))|\(sanitizeNotificationField(body))"
guard let structuredAgentStatusKey else { return payload }
let trimmedKey = structuredAgentStatusKey.trimmingCharacters(in: .whitespacesAndNewlines)
guard !trimmedKey.isEmpty else { return payload }
return "--agent-status-key=\(trimmedKey) \(payload)"
}

private func redactClaudeSensitiveSpans(_ value: String) -> String {
Expand Down
67 changes: 50 additions & 17 deletions Sources/AgentHibernation/AgentHibernationLifecycleState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,59 @@ enum AgentHibernationLifecycleState: String, Codable, Sendable, Equatable, CaseI
}

enum AgentHibernationLifecycleStatusKeys {
static let allowedStatusKeys: Set<String> = [
"amp",
"antigravity",
"claude_code",
"codebuddy",
"codex",
"copilot",
"cursor",
"factory",
"gemini",
"grok",
"hermes-agent",
"kiro",
"opencode",
"pi",
"qoder",
"rovodev",
static let notificationTitleByStatusKey: [String: String] = [
"amp": "Amp",
"antigravity": "Antigravity",
"claude_code": "Claude Code",
"codebuddy": "CodeBuddy",
"codex": "Codex",
"copilot": "Copilot",
"cursor": "Cursor",
"factory": "Factory",
"gemini": "Gemini",
"grok": "Grok",
"hermes-agent": "Hermes Agent",
"kiro": "Kiro",
"opencode": "OpenCode",
"pi": "Pi",
"qoder": "Qoder",
"rovodev": "Rovo Dev",
]

static let allowedStatusKeys: Set<String> = Set(notificationTitleByStatusKey.keys)

static func isAllowed(_ key: String) -> Bool {
allowedStatusKeys.contains(key)
}

static func normalizedAllowedStatusKey(_ key: String?) -> String? {
guard let key else { return nil }
let normalized = key.trimmingCharacters(in: .whitespacesAndNewlines)
guard !normalized.isEmpty, isAllowed(normalized) else { return nil }
return normalized
}

static func statusKey(forNotificationTitle title: String) -> String? {
statusKeyByNormalizedNotificationTitle[normalizedNotificationTitle(title)]
}

private static let statusKeyByNormalizedNotificationTitle: [String: String] = {
var result: [String: String] = [:]
var ambiguousTitles = Set<String>()
for (statusKey, title) in notificationTitleByStatusKey {
let normalized = normalizedNotificationTitle(title)
guard !ambiguousTitles.contains(normalized) else { continue }
if result[normalized] != nil {
ambiguousTitles.insert(normalized)
result.removeValue(forKey: normalized)
} else {
result[normalized] = statusKey
}
}
return result
}()

private static func normalizedNotificationTitle(_ title: String) -> String {
title.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
}
}
6 changes: 6 additions & 0 deletions Sources/SessionPersistence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,7 @@ struct SessionNotificationSnapshot: Codable, Sendable {
var title: String
var subtitle: String
var body: String
var structuredAgentStatusKey: String?
var createdAt: TimeInterval
var isRead: Bool
var paneFlash: Bool?
Expand All @@ -1646,6 +1647,7 @@ struct SessionNotificationSnapshot: Codable, Sendable {
title: String,
subtitle: String,
body: String,
structuredAgentStatusKey: String? = nil,
createdAt: TimeInterval,
isRead: Bool,
paneFlash: Bool? = nil,
Expand All @@ -1655,6 +1657,8 @@ struct SessionNotificationSnapshot: Codable, Sendable {
self.title = title
self.subtitle = subtitle
self.body = body
self.structuredAgentStatusKey = AgentHibernationLifecycleStatusKeys
.normalizedAllowedStatusKey(structuredAgentStatusKey)
self.createdAt = createdAt
self.isRead = isRead
self.paneFlash = paneFlash
Expand All @@ -1667,6 +1671,7 @@ struct SessionNotificationSnapshot: Codable, Sendable {
title: notification.title,
subtitle: notification.subtitle,
body: notification.body,
structuredAgentStatusKey: notification.structuredAgentStatusKey,
createdAt: notification.createdAt.timeIntervalSince1970,
isRead: notification.isRead,
paneFlash: notification.paneFlash,
Expand All @@ -1680,6 +1685,7 @@ struct SessionNotificationSnapshot: Codable, Sendable {
tabId: tabId,
surfaceId: surfaceId,
panelId: panelId,
structuredAgentStatusKey: structuredAgentStatusKey,
title: title,
subtitle: subtitle,
body: body,
Expand Down
Loading
Loading