Skip to content

hooks-notify referenced without source on default installs (notification config defaults disagree) #264

@Joi

Description

@Joi

Summary

On a fresh install where the user has never run amplifier notify, every session emits a Failed to load module 'hooks-notify' warning + traceback during session init. Two notification-config code paths use different defaults for config.notifications.desktop.enabled, so one path appends a hooks-notify hook override while the other path does not compose the notify bundle — leaving the hook referenced but unresolvable.

Not fatal (sessions continue), but noisy and alarming-looking for every new user.

Environment

  • amplifier-core 1.3.3
  • amplifier-app-cli installed via uv tool install amplifier
  • ~/.amplifier/settings.yaml has no config.notifications block (default state for anyone who has never run amplifier notify desktop --enable|--disable)

Root cause

Two defaults disagree:

amplifier_app_cli/lib/settings.py:568 (SettingsManager.get_notification_hook_overrides):

desktop_config = notifications.get("desktop", {})
if desktop_config.get("enabled", True):   # <-- defaults True
    ...
    overrides.append({"module": "hooks-notify", "config": hook_config})

amplifier_app_cli/runtime/config.py:833 (_build_notification_behaviors):

desktop_config = notifications_config.get("desktop", {})
desktop_enabled = desktop_config.get("enabled", False)   # <-- defaults False

When config.notifications.desktop.enabled is unset:

  1. _build_notification_behaviors returns [] → the notify bundle (git+https://github.com/microsoft/amplifier-bundle-notify@main) is not composed → hooks-notify has no source in the prepared bundle.
  2. get_notification_hook_overrides appends {"module": "hooks-notify", "config": {"enabled": True}} to config.hooks anyway.
  3. At session init, the loader iterates config.hooks, tries to resolve hooks-notify against the prepared bundle, fails with ModuleNotFoundError, logs the warning+traceback.

Reproduction

# Fresh install, no prior `amplifier notify` config
rm -rf ~/.amplifier/settings.yaml  # or just ensure config.notifications is absent
amplifier run  # or any recipe execute / agent delegation

Observe on stderr:

Failed to load module 'hooks-notify': Module 'hooks-notify' not found in prepared bundle. Available modules: [...]
Failed to load hook 'hooks-notify': Module 'hooks-notify' not found in prepared bundle. ...
Traceback (most recent call last):
  File ".../amplifier_core/_session_init.py", line 214, in initialize_session
    hook_mount = await loader.load(...)
  ...
amplifier_core.module_sources.ModuleNotFoundError: Module 'hooks-notify' not found in prepared bundle.

Suggested fix

Make the two defaults agree. Since amplifier notify status reports "nothing configured" in this state (and the behaviors-composition path is the authoritative one for deciding whether the hook can be loaded), the safest fix is to change settings.py:568 from True to False:

if desktop_config.get("enabled", False):

Alternative: in runtime/config.py, default to True and always compose the notify bundle — but that changes user-facing behavior (enables desktop notifications by default), so the first fix is probably preferable.

Local workaround

Either one fixes it by writing config.notifications.desktop.enabled explicitly into settings:

amplifier notify desktop --enable   # turns feature on
amplifier notify desktop --disable  # silences the warning, feature stays off

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions