Skip to content

Commit 2a4b401

Browse files
katipallyCopilot
andcommitted
Fix Cursor notifications, sub-agent toggle, Codex events, rename Channels
- AgentTrackingManager: Skip isQuitInitiatedEnd check for IDE agents (cursor, vscode, windsurf). Cursor launches dc-hook via a transient shell subprocess whose PPID exits immediately, causing false isQuitInitiatedEnd=true and suppressing all notifications. - ChannelStore: Unify sub-agent toggle — 'subagentEnd' now reads the same subagentStart flag so one UI toggle covers both start and end. - AgentInstallerV2: Add PreCompact and PostCompact to Codex CLI event list (now 8 events, matching openai/codex source). - AgentEventNormalizer: Map PreCompact/PostCompact → .other for Codex. - ConfigureAgentsWindowV2: Rename sidebar label 'Channels' → 'Notification Channels' for clearer UX. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bcfec64 commit 2a4b401

5 files changed

Lines changed: 19 additions & 4 deletions

File tree

DoomCoder/AgentTracking/AgentEventNormalizer.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ struct CodexCLIEventNormalizer: AgentEventNormalizer {
467467
"PostToolUse": .toolEnd,
468468
"PermissionRequest": .permissionNeeded,
469469
"Stop": .sessionEnd,
470+
"PreCompact": .other,
471+
"PostCompact": .other,
470472
]
471473

472474
func normalize(envelope: HookEnvelope) -> NormalizedHookEvent? {

DoomCoder/AgentTracking/AgentInstallerV2.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,13 @@ struct AgentInstallerV2 {
568568

569569
// OpenAI Codex CLI hook events (May 2026). Requires `codex_hooks = true`
570570
// feature flag in ~/.codex/config.toml.
571+
// OpenAI Codex CLI hook events (May 2026). Requires `codex_hooks = true`
572+
// feature flag in ~/.codex/config.toml.
573+
// Source: openai/codex codex-rs/app-server-protocol/src/protocol/v2/hook.rs
571574
static let codexEvents = [
572575
"SessionStart", "PreToolUse", "PermissionRequest",
573-
"PostToolUse", "UserPromptSubmit", "Stop"
576+
"PostToolUse", "UserPromptSubmit", "Stop",
577+
"PreCompact", "PostCompact"
574578
]
575579

576580
private static func cmdFor(_ agent: String, _ event: String) -> String {

DoomCoder/AgentTracking/AgentTrackingManager.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,16 @@ final class AgentTrackingManager {
244244
// Suppress sessionEnd notifications when the agent PID is dead — this
245245
// means the user already quit (Cmd+Q) before the final Stop/sessionEnd
246246
// hook arrived. Timeline entry is still recorded above.
247+
//
248+
// IDE agents (Cursor, VS Code Copilot, Windsurf) are exempt from this
249+
// check because they invoke dc-hook via a short-lived shell subprocess.
250+
// dc-hook reports getppid() (the shell), which exits immediately after
251+
// dc-hook starts — so PIDLiveness always returns false for IDE-spawned
252+
// hooks, which would incorrectly suppress every session-end notification.
253+
// CLI agents (Claude, Copilot CLI, Codex) spawn dc-hook directly, so
254+
// getppid() is the CLI process itself, which is alive until Cmd+Q.
247255
let isQuitInitiatedEnd = normalized.phase == .sessionEnd
256+
&& !normalized.agent.isIDEAgent
248257
&& !PIDLiveness.isAlive(pid_t(env.pid))
249258
let shouldNotify = NotificationPolicy.isNotifiable(phase: normalized.phase)
250259
&& !isQuitInitiatedEnd

DoomCoder/AgentTracking/ChannelStore.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ struct ChannelStore {
2929
case "error", "toolError": return error
3030
case "permissionNeeded": return permissionNeeded
3131
case "agentResponse": return agentResponse
32-
case "subagentStart": return subagentStart
33-
case "subagentEnd": return subagentEnd
32+
// "Sub-agent activity" toggle controls both start and end phases.
33+
case "subagentStart", "subagentEnd": return subagentStart
3434
case "toolStart", "toolEnd": return toolUse
3535
default: return false
3636
}

DoomCoder/AgentTracking/ConfigureAgentsWindowV2.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ struct ConfigureAgentsViewV2: View {
122122
selected = nil
123123
}
124124
} label: {
125-
Label("Channels", systemImage: "bell.badge")
125+
Label("Notification Channels", systemImage: "bell.badge")
126126
}
127127
.buttonStyle(.plain)
128128
.listRowBackground(tab == .channels ? Color.accentColor.opacity(0.15) : Color.clear)

0 commit comments

Comments
 (0)