brainiac-github 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/brainiac/plugins/github/handler.rb +40 -6
- data/lib/brainiac/plugins/github/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4646b834b308b619a34c5b94da48aeb88b80caa3fb5efd107ac40a5dc56da2a0
|
|
4
|
+
data.tar.gz: af0c3f9c0b47e366928760c64168a74eb3651f87c193156cbced75336626bac0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 945f7fad37cd33a37d755b6517faa8638c4a351d74f11edb60bf8299d04933837f38b34e1fa39afaea34af2b2d57c89f5b88d641fb6e6001436622928143d445
|
|
7
|
+
data.tar.gz: 5c2e27ab69d9af292ddbd3c7ac299629f1b97c005b85275bdaaa31d24b010903a75b4973d6d91cf99ab5ea580c53c67c77e341724f46c633a2628d2a78ad6c67
|
|
@@ -126,6 +126,16 @@ module Brainiac
|
|
|
126
126
|
repo_name = payload.dig("repository", "full_name")
|
|
127
127
|
review_state = review["state"]
|
|
128
128
|
reviewer = review.dig("user", "login")
|
|
129
|
+
reviewer_type = review.dig("user", "type")
|
|
130
|
+
|
|
131
|
+
# If the review was submitted by a remote agent bot, ignore — the other machine handles it.
|
|
132
|
+
if reviewer_type == "Bot"
|
|
133
|
+
reviewing_agent = agent_name_from_bot_login(reviewer)
|
|
134
|
+
if reviewing_agent && !local_agent_names.include?(reviewing_agent)
|
|
135
|
+
LOG.info "[GitHub] Ignoring review from remote agent bot #{reviewer} (agent: #{reviewing_agent}) on PR ##{pr_number}"
|
|
136
|
+
return [200, { status: "ignored", reason: "remote agent bot review" }.to_json]
|
|
137
|
+
end
|
|
138
|
+
end
|
|
129
139
|
|
|
130
140
|
# If the PR was opened by a remote agent bot (not local to this machine),
|
|
131
141
|
# skip dispatch — the other machine that owns the agent will handle it.
|
|
@@ -236,12 +246,12 @@ module Brainiac
|
|
|
236
246
|
agent_name = mentioned
|
|
237
247
|
end
|
|
238
248
|
|
|
239
|
-
# Ignore comments from
|
|
240
|
-
#
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
249
|
+
# Ignore comments from agent bots that shouldn't trigger dispatch on this machine:
|
|
250
|
+
# 1. Self-triggered: bot matches the dispatching agent (prevents loops)
|
|
251
|
+
# 2. Remote agent: bot matches a known agent that isn't local (other machine handles it)
|
|
252
|
+
# Cross-agent LOCAL bot comments (e.g. GLaDOS commenting on Galen's PR) are still processed.
|
|
253
|
+
bot_ignore_reason = bot_comment_ignore_reason(comment_user, comment_user_type, agent_name, pr_number)
|
|
254
|
+
return bot_ignore_reason if bot_ignore_reason
|
|
245
255
|
|
|
246
256
|
branch = fetch_pr_branch(repo_name, pr_number, agent_name, project_config)
|
|
247
257
|
result = find_work_item_by_branch(branch)
|
|
@@ -494,6 +504,30 @@ module Brainiac
|
|
|
494
504
|
nil
|
|
495
505
|
end
|
|
496
506
|
|
|
507
|
+
# Determine if a bot comment should be ignored by this machine.
|
|
508
|
+
# Returns a Rack response array if the comment should be ignored, or nil if it should be processed.
|
|
509
|
+
#
|
|
510
|
+
# Ignores:
|
|
511
|
+
# 1. Self-triggered: bot matches the dispatching agent (prevents loops)
|
|
512
|
+
# 2. Remote agent: bot matches a known agent that isn't local (other machine handles it)
|
|
513
|
+
# Allows: cross-agent LOCAL bot comments (e.g. GLaDOS commenting on Galen's PR)
|
|
514
|
+
def bot_comment_ignore_reason(comment_user, comment_user_type, agent_name, pr_number)
|
|
515
|
+
return nil unless comment_user_type == "Bot"
|
|
516
|
+
|
|
517
|
+
if own_bot_comment?(comment_user, agent_name)
|
|
518
|
+
LOG.info "Ignoring self-triggered bot comment from #{comment_user} (agent: #{agent_name})"
|
|
519
|
+
return [200, { status: "ignored", reason: "self-triggered bot comment" }.to_json]
|
|
520
|
+
end
|
|
521
|
+
|
|
522
|
+
commenting_agent = agent_name_from_bot_login(comment_user)
|
|
523
|
+
if commenting_agent && !local_agent_names.include?(commenting_agent)
|
|
524
|
+
LOG.info "[GitHub] Ignoring comment from remote agent bot #{comment_user} (agent: #{commenting_agent}) on PR ##{pr_number}"
|
|
525
|
+
return [200, { status: "ignored", reason: "remote agent bot comment" }.to_json]
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
nil
|
|
529
|
+
end
|
|
530
|
+
|
|
497
531
|
# Check if a bot comment is from the same agent that would handle this PR.
|
|
498
532
|
# e.g. "galen-brainiac[bot]" is a self-trigger for agent "Galen",
|
|
499
533
|
# but "glados-brainiac[bot]" is a cross-agent request and should be processed.
|