Skip to content

feat: add notifications workflow for polling GitHub notifications - #96

Merged
max-sixty merged 4 commits into
mainfrom
feat/notifications-workflow
Mar 29, 2026
Merged

max-sixty merged 4 commits into
mainfrom
feat/notifications-workflow

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Summary

Adds a notifications scheduled workflow that polls the bot's GitHub notifications every 15 minutes, responds to unhandled items, and marks handled ones as read. This addresses two gaps:

  • Being mentioned in other repos or contexts where event-driven workflows don't fire
  • Inline review comments on fork PRs (which show up as notifications but don't trigger pull_request_review_comment for secrets-bearing workflows)

What's included

  • Generator: generate_notifications() in workflows.py, registered in GENERATORS, added to KNOWN_WORKFLOWS
  • Skill: plugins/tend-ci-runner/skills/notifications/SKILL.md with a multi-step workflow: fetch notifications, classify security risk, check if already handled, respond, mark read
  • Tests: updated workflow count expectations

Security

The skill includes explicit prompt injection mitigations since notifications can originate from untrusted sources without maintainer oversight:

  • Only processes notifications from $GITHUB_REPOSITORY
  • Checks author_association before acting — untrusted users get limited responses
  • Treats all notification content as untrusted input (no command/code execution from content)
  • Distinguishes trusted (OWNER/MEMBER/COLLABORATOR) from untrusted sources with different response policies

Default schedule

Runs every 15 minutes (*/15 * * * *), overridable via:

[workflows.notifications]
cron = "*/30 * * * *"  # every 30 minutes instead

Test plan

  • All 109 existing tests pass
  • Manual: uvx tend init --dry-run shows tend-notifications.yaml in output
  • Manual: verify generated YAML is valid and matches expected structure

Closes #94

Adds a scheduled workflow (every 15 minutes) that checks the bot's
GitHub notifications, responds to unhandled mentions, and clears
dealt-with items. Includes security guardrails for prompt injection
via untrusted notification sources.

Closes #94

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@tend-agent tend-agent mentioned this pull request Mar 28, 2026
@max-sixty

Copy link
Copy Markdown
Owner

fix the lints?

@tend-agent

Copy link
Copy Markdown
Collaborator Author

Fixed — expanded KNOWN_WORKFLOWS to multi-line format to satisfy ruff format.

2. **Check scope.** Only process notifications from this repository
(`$GITHUB_REPOSITORY`). Mark cross-repo notifications as read without acting:
```bash
gh api notifications/threads/{id} -X PATCH

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

this is too strong, it's fine to read the notifications, we just want to be careful about acting on them

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good call — softened this. The fetch no longer pre-filters to this repo, and cross-repo notifications are read and understood rather than blindly marked as done. Acting on them (creating issues, PRs, comments outside the org) is still restricted.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good call — updated to fetch all notifications and softened the cross-repo policy. Now it reads and understands cross-repo notifications but applies extra caution before acting (only responds to direct mentions with straightforward requests, no code changes in other repos).

tend-agent and others added 2 commits March 29, 2026 19:40
Cross-repo notifications can be read and understood; only acting on
them (creating issues, PRs, comments) needs caution.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Read all notifications instead of filtering to current repo only.
Cross-repo notifications are now read and understood but acted on
with extra caution, rather than being blanket-ignored.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@max-sixty
max-sixty merged commit cae4bce into main Mar 29, 2026
6 checks passed
@max-sixty
max-sixty deleted the feat/notifications-workflow branch March 29, 2026 20:23
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.

check notifications

2 participants