feat(bridge): GitHub webhook event dispatch and formatting#181
Merged
benvinegar merged 2 commits intomainfrom Feb 26, 2026
Merged
feat(bridge): GitHub webhook event dispatch and formatting#181benvinegar merged 2 commits intomainfrom
benvinegar merged 2 commits intomainfrom
Conversation
- New github-events.mjs module with pure formatting/filtering functions - Add 'github' case to processPulledMessage() generic envelope switch - Format pull_request, pull_request_review, issue_comment, check_suite, check_run, push events with security boundary wrapping - Filter noise: skip baudbot-agent events, configurable GITHUB_IGNORED_USERS, skip check_suite/check_run lifecycle events, skip PR synchronize - Handle ping (ack only) and unknown event types gracefully - 45 tests covering formatting, filtering, boundary wrapping, edge cases - Backwards compatible: no changes to Slack message flow
Greptile Summaryextended broker bridge to handle GitHub webhook events with the same security boundary pattern used for Slack messages. When GitHub events arrive through the broker inbox, they're formatted, filtered for noise (bot users, lifecycle events, synchronize), and delivered to the pi agent.
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Broker Inbox] -->|BrokerEvent envelope| B[processPulledMessage]
B -->|source: github| C[handleGitHubEvent]
C --> D{shouldSkipEvent?}
D -->|skip: bot user| Z[Log & Ack]
D -->|skip: lifecycle noise| Z
D -->|skip: synchronize| Z
D -->|process| E[formatGitHubEvent]
E -->|ping| Z
E -->|unknown type| F[minimal summary]
E -->|known type| G[formatPullRequest<br/>formatPullRequestReview<br/>formatIssueComment<br/>formatCheckSuite<br/>formatCheckRun<br/>formatPush]
F --> H[wrapGitHubContent]
G --> H
H -->|security boundaries| I[enqueue + sendToAgent]
I --> J[Pi Agent]
Last reviewed commit: 203ff94 |
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.
Summary
Add GitHub event dispatch and formatting to the broker bridge. When GitHub webhook events arrive through the broker inbox as
BrokerEventenvelopes withsource: "github", they are formatted with security boundaries and delivered to the pi agent — same pipeline as Slack messages.Changes
New:
slack-bridge/github-events.mjsPure-function module for GitHub event formatting and filtering:
formatGitHubEvent(type, payload)— formats 7 event types (pull_request,pull_request_review,issue_comment,check_suite,check_run,push,ping) plus unknown typeswrapGitHubContent()— security boundary wrapping with GitHub-specific metadata (Repo, Event, Ref, Actor) using the standard<<<EXTERNAL_UNTRUSTED_CONTENT>>>markersshouldSkipEvent()— noise filtering: skipsbaudbot-agentevents, configurableGITHUB_IGNORED_USERS(comma-separated), skipscheck_suite/check_runlifecycle events (only cares aboutcompleted), skipspull_requestsynchronizeparseIgnoredUsers()— parses env var withbaudbot-agentalways includedextractActor()— resolves actor login from various payload shapesModified:
slack-bridge/broker-bridge.mjsgithubcase toprocessPulledMessage()generic envelope switchhandleGitHubEvent()that filters, formats, and forwards to agent viaenqueue()+sendToAgent()GITHUB_IGNORED_USERSenv var at startupNew:
slack-bridge/github-events.test.mjs45 tests covering:
Modified:
vitest.config.mjs+ newtest/github-events.test.mjsVitest wrapper to run the node:test suite via the standard
npm testpipeline.Backwards Compatibility
Example formatted output
Testing