Skip to content

fix(#508): pg-notify-listener alerts use PGUSER sender + self-safe recipients - #535

Merged
NOVA-Openclaw merged 2 commits into
mainfrom
fix/508-pg-notify-alert-sender
Jul 27, 2026
Merged

fix(#508): pg-notify-listener alerts use PGUSER sender + self-safe recipients#535
NOVA-Openclaw merged 2 commits into
mainfrom
fix/508-pg-notify-alert-sender

Conversation

@NOVA-Openclaw

Copy link
Copy Markdown
Owner

Summary of Root Cause

The previous implementation hardcoded schema-sync as the message sender for PG-notify-listener alerts. However, the send_agent_message function enforces session user guards, causing the database to reject messages when the actual connecting PGUSER (such as nova) does not match the hardcoded sender.

What Changed

  • Dynamic PGUSER Sender: Dynamically resolves the message sender using the connecting PGUSER environment variable or defaults to schema-sync.
  • Prefix Addition: Added a [schema-sync] prefix to messages to clearly indicate the subsystem source.
  • Self-Safe Recipients Strategy: Implemented the _alert_recipients strategy to ensure recipients are filtered appropriately (e.g. self-safe).
  • Non-Raising Helpers: Used robust non-raising database helpers to protect background listener health against unhandled exceptions.
  • No DDL Changes: Avoided any DDL or database schema alterations.

Test Plan / Results

Evidence Links & Reference files

  • Design Plan: se-runs/se511-step3-test-design.md
  • Desk Review: se-runs/se511-step6-qa-desk-review.md
  • Staging Results: se-runs/se511-step7-staging-results.md
  • QA Validation: se-runs/se511-step8-qa-validation.md
  • Docs Audit: se-runs/se511-step9-doc-audit.md

Closes #508

Files Modified

  • cognition/scripts/pg-notify-listener.py
  • 3 test files
  • 2 CHANGELOG files

Coder added 2 commits July 27, 2026 18:38
… self-safe recipients

- Bind send_agent_message sender to _agent_chat_env['PGUSER'] instead of
  hardcoded 'schema-sync'.
- Prefix all alert messages with '[schema-sync]' for attribution.
- Add shared _alert_recipients() helper that excludes the sending user from
  primary recipients and falls back to graybeard, then broadcast. This
  satisfies send_agent_message's session_user + self-address guards.
- Keep alert helpers non-raising on any alert-path failure.
- Update #399/#506 tests to assert PGUSER sender and prefix.
- Add issue #508 test module covering sender binding, recipient strategy,
  bound-parameter shape, failure swallow, and end-to-end regression paths.
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.

pg-notify-listener alerts silently broken in production: hardcoded 'schema-sync' sender rejected by send_agent_message() sender enforcement

1 participant