# When permission alerts feel noisy: delay and deduplicate

> When permission alerts feel noisy: delay and deduplicate

Repository: syntaxskills/muxmap · Category: Engineering practice · Status: Active

Keywords: notification, permission, codex, noise reduction

## When to use this lesson

- Users receive frequent or redundant permission alerts from Codex.
- Permission alerts are triggered too quickly, leading to unnecessary interruptions.
- Repeated permission requests do not result in multiple alerts, but the system still logs every event.

## What happened

In MuxMap, Codex permission alerts were too frequent and disruptive. The system would immediately alert users to permission requests, even if they were automatically resolved before the user could act. This led to unnecessary interruptions and a poor user experience. The issue was particularly noticeable when multiple permission requests occurred in quick succession.

## Diagnosis and approach

The root cause was that Codex permission alerts were triggered immediately upon receiving a `PermissionRequest` event, without allowing time for automatic resolution. The system did not deduplicate alerts for the same request, leading to multiple notifications for the same issue. This resulted in a high volume of alerts, even though many were resolved automatically.

## What did not work

No unsuccessful experiments are documented in the supplied evidence.

## What changed

The solution involved introducing a delay before triggering Codex permission alerts. This delay allowed time for automatic resolution of permission requests before notifying the user. Additionally, alerts were deduplicated for the same request within a short window, ensuring that users only received one alert per unique request. The `notificationPending` flag was added to track pending alerts, and the `scanAgentNotifications` function was updated to skip alerts that were already pending. The `createSessionManager` function was modified to set `notificationPending` for Codex agents that had not yet resolved their permission requests after five seconds.

## How to verify the improvement

1. Trigger multiple `PermissionRequest` events for Codex in quick succession. 2. Verify that only one alert is shown within a short window, even if multiple requests are received. 3. Check that alerts are delayed by at least five seconds, allowing time for automatic resolution. 4. Confirm that all `PermissionRequest` events are logged, even if they do not result in an alert. 5. Ensure that the `notificationPending` flag is correctly set and cleared based on the timing of events.

## What to do next time

When handling permission requests in agent systems, implement a delay before alerting to allow automatic resolution. Deduplicate alerts for the same request within a short window to reduce noise. Ensure that event logs capture all requests while minimizing user interruptions.

## Limits and exceptions

This solution is specific to systems where permission requests can be automatically resolved before user intervention. It may not apply to systems where immediate user action is required. The delay and deduplication logic should be adjusted based on the typical resolution time for permission requests in the specific context.

## Commit evidence

- [syntaxskills/muxmap@42405d6](https://github.com/syntaxskills/muxmap/commit/42405d6537b24a0992f65eb4579452477945a79d): Reduce noisy Codex permission notifications
