Relax email self-loop guard to only block comment loops#65
Merged
Conversation
Flip the email self-loop guard from a safelist to a denylist. Previously, ALL emails from the bot were dropped except ci_activity and security_alert. Now only 'comment' and 'your_activity' reasons are blocked — these are the only reasons that can cause feedback loops (bot comments → email → agent responds → bot comments again). Assignments, PR creation, state changes, review requests, pushes, and all other notification types are now allowed through, even when the sender matches the bot. This is safe because responding to those events performs a different action than what triggered the notification. Also removes the redundant ignore_authors from the email-event trigger in webhooks.json — the email.ts handler's reason-based guard is more precise.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
opencode-email-worker | f0de6e0 | Commit Preview URL Branch Preview URL |
May 08 2026, 02:57 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Flip the email self-loop guard from a safelist (block everything except
ci_activity,security_alert) to a denylist (block onlycomment,your_activity).Problem
The previous guard dropped ALL email notifications from the bot's own GitHub account except CI and security alerts. This blocked legitimate notifications like issue assignments, PR creation, state changes, and review requests — preventing the agent from acting on its own work.
What changed
packages/opentower/src/handlers/email.tsSELF_LOOP_SAFE_REASONS(safelist) →SELF_LOOP_RISK_REASONS(denylist)commentandyour_activityreasons from the botwebhooks.jsonignore_authors: ["$BOT_LOGIN"]from theemail-eventtriggergithub-commenttrigger still hasignore_authors(needed for webhook-based comment loop prevention)Why this is safe
The only real feedback loop is: bot comments → email notification → agent responds → bot comments again. That requires
x_github_reasonto becommentoryour_activity.All other notification types produce a different action than what triggered them:
Testing
bun run --filter opentower typecheckpasses