Skip to content

Conversation

@subtleseeker
Copy link

@subtleseeker subtleseeker commented Jan 29, 2026

Summary

  • Add hasPendingBackgroundTasks callback to SessionNotificationConfig interface
  • Check for running background tasks before sending notification
  • Wire up the callback in index.ts to use backgroundManager.getRunningTasks()

Problem

Notifications fire when a background agent completes, even if other background agents are still running. This happens because:

  1. When a background agent completes, it calls notifyParentSession() which prompts the parent session
  2. After the prompt is processed, the parent session becomes idle
  3. The session.idle event fires for the parent (main) session
  4. Since the parent is the main session, the existing notification filters don't skip it
  5. Desktop notification is sent even though other background tasks may still be running

Solution

Add a new optional callback hasPendingBackgroundTasks to the SessionNotificationConfig that is checked before sending a notification. When backgroundManager.getRunningTasks().length > 0, the notification is skipped.

This ensures notifications only fire when the session is truly idle (no background tasks running and waiting for user input).

Testing

Built and tested locally. The fix correctly skips notifications when background tasks are still running.


Summary by cubic

Prevented session notifications from firing while any background tasks are still running. Notifications now trigger only when the session is truly idle.

  • Bug Fixes
    • Added hasPendingBackgroundTasks to SessionNotificationConfig and checked it before sending notifications.
    • Wired the callback to BackgroundManager.getRunningTasks() in index.ts to skip notifications when tasks remain.

Written for commit 7b3b9ab. Summary will update on new commits.

Add hasPendingBackgroundTasks callback to SessionNotificationConfig that allows
session-notification to check if there are running background tasks before
sending a notification.

This fixes the issue where notifications would fire when a background agent
completes, even if other background agents are still running. The notification
should only fire when the session is truly idle (no background tasks running
and waiting for user input).
@github-actions
Copy link
Contributor

Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA).

To sign the CLA, please comment on this PR with:

I have read the CLA Document and I hereby sign the CLA

This is a one-time requirement. Once signed, all your future contributions will be automatically accepted.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@subtleseeker
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants