Skip to content

Conversation

@DanielleMaywood
Copy link
Contributor

@DanielleMaywood DanielleMaywood commented Nov 10, 2025

Relates to coder/internal#1098

Currently AgentAPI waits for only 2 seconds worth of identical terminal screen snapshots before deciding a task has entered a "stable" state. We interpret this as becoming "idle", resulting in a notification being triggered. This behavior is not ideal and is ultimately the root cause of our spammy notifications.

Unfortunately, until we move AgentAPI to either use the Claude Code SDK (or ACP wrapper around it), we are unable to easily fix the root cause.

This PR instead waits until the agent is ready before it will send state change notifications. This will at least resolve some of the complaints about task state notifications being too spammy.


🤖 PR was written by Claude Sonnet 4.5 using Coder Mux and reviewed by a human 👩

Prevents spammy notifications during agent startup by checking that the
agent lifecycle state is 'ready' before sending notifications. This
ensures notifications are only sent when the agent is fully operational,
not during initialization when status may fluctuate.

Changes:
- Add agent lifecycle check to enqueueAITaskStateNotification
- Only send notifications when agent.LifecycleState == Ready
- Add debug logging when notifications are skipped
- Add test coverage for agent lifecycle states (starting, created, ready)
- Update existing tests to explicitly set ready state when expecting notifications

Fixes spammy notification reports where users receive alerts before
the agent has finished starting up.
@DanielleMaywood DanielleMaywood marked this pull request as ready for review November 10, 2025 14:38
Copy link
Contributor

@ssncferreira ssncferreira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✈️

@DanielleMaywood DanielleMaywood merged commit f2a1a7e into main Nov 10, 2025
33 checks passed
@DanielleMaywood DanielleMaywood deleted the danielle-spammy-notifications branch November 10, 2025 16:00
@github-actions github-actions bot locked and limited conversation to collaborators Nov 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants