A notification can be correct and still be noise.
When a coding agent finishes while its terminal is frontmost, a full alert covers the answer the user is already reading. But suppressing every alert whenever Terminal or VS Code is active loses the identity of the session that actually finished.
The condition needs to be exact:
Is the host application for this waiting session frontmost now?
Match the session, not the app category
The implementation starts with the waiting thread's working directory. It finds the matching Claude Code or Codex process, walks the parent chain, and checks whether the foreground application's PID appears in that chain.
That works with terminal windows and editor-hosted CLIs without hardcoding one app list. It also keeps separate sessions separate.
Hold is a real state
If the exact session is frontmost, the alert goes into a held map. It is not marked as delivered.
On the next focus change, the system checks the turn again:
- Is the reminder setting still enabled?
- Is the turn still waiting for the user?
- Has this delivery key already been acknowledged or delivered?
- Is the exact host still frontmost?
If the user already replied, a fresh session scan removes the held alert. If the user switched away without replying, the alert fires once.
waiting -> confirm for 1 second
-> exact host is frontmost -> hold
-> user replies -> discard
-> focus leaves -> deliver once
Fail open
tmux, containers, daemonized processes, and process-inspection permissions can break ancestry resolution. In that case the check returns false and the alert appears normally. A missed suppression is preferable to a missed handoff.
The macOS and Windows implementations use different process APIs, but the contract is the same: working-directory match, bounded parent walk, focus-change event, and a fresh state check before delivery.
I help run Agent Island, where this behavior is released in v1.7.1. The longer article includes the failure cases and test checklist:
Top comments (0)