brainiac-github 0.2.5 → 0.2.6
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 +25 -3
- 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: 6a7a75791c3df9f85c5e2d545bbaa83bc496a7d6f88c34f38a84d73a5bcced59
|
|
4
|
+
data.tar.gz: 896ba92478b7d36dbc9e99f71586c4c0fdb4e777a007e087412ccaf71b2cabdd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eca03777383a673758eb035ea69ed5b604d6fe289486cd4cb5e943c93fb8e6c14a1057268ed68c5ee04adc5fc6744219734dd6756f70b60b00e4720269a28fd6
|
|
7
|
+
data.tar.gz: 17fafeac99cfe179febe43424dd4bf791e199d226f6dc92022f5ce9f7643b151cdbe65698ef956d9794c2651eaff012d0f66395cfb296cf3b13b9dbf1664e0f0
|
|
@@ -182,6 +182,18 @@ module Brainiac
|
|
|
182
182
|
return [200, { status: "processed", card: card_number, pr: pr_number, reviewer: reviewer, action: "hook_only" }.to_json]
|
|
183
183
|
end
|
|
184
184
|
|
|
185
|
+
# If the work item's assigned agent is NOT local to this machine,
|
|
186
|
+
# skip dispatch — the other machine owns this PR's agent.
|
|
187
|
+
# This check is intentionally AFTER the hook emit so gate tracking
|
|
188
|
+
# works on both machines, but only one machine dispatches the agent.
|
|
189
|
+
if result
|
|
190
|
+
work_item_agent = card_info["agent"]
|
|
191
|
+
if work_item_agent && !local_agent_names.include?(work_item_agent)
|
|
192
|
+
LOG.info "[GitHub] PR ##{pr_number} assigned to remote agent #{work_item_agent} — skipping review dispatch"
|
|
193
|
+
return [200, { status: "ignored", reason: "work item owned by remote agent" }.to_json]
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
185
197
|
card_key = "pr-review-#{repo_name.tr("/", "-")}-#{pr_number}"
|
|
186
198
|
|
|
187
199
|
return [200, { status: "ignored", reason: "session already active" }.to_json] if session_active?(card_key)
|
|
@@ -261,12 +273,22 @@ module Brainiac
|
|
|
261
273
|
# route to whoever is actually working it (e.g. GLaDOS opened the PR,
|
|
262
274
|
# so GLaDOS should handle follow-up comments — not the project's default agent).
|
|
263
275
|
# Explicit mentions still take priority (already resolved above).
|
|
276
|
+
#
|
|
277
|
+
# If the work item's assigned agent is NOT local to this machine,
|
|
278
|
+
# skip dispatch entirely — the other machine owns this PR's agent.
|
|
264
279
|
if result && !mentioned
|
|
265
280
|
_, card_info = result
|
|
266
281
|
work_item_agent = card_info["agent"]
|
|
267
|
-
if work_item_agent
|
|
268
|
-
|
|
269
|
-
|
|
282
|
+
if work_item_agent
|
|
283
|
+
if local_agent_names.include?(work_item_agent)
|
|
284
|
+
if work_item_agent.downcase != agent_name.downcase
|
|
285
|
+
LOG.info "[GitHub] Work item agent override: #{work_item_agent} (project default: #{agent_name})"
|
|
286
|
+
agent_name = work_item_agent
|
|
287
|
+
end
|
|
288
|
+
else
|
|
289
|
+
LOG.info "[GitHub] PR ##{pr_number} assigned to remote agent #{work_item_agent} — skipping dispatch"
|
|
290
|
+
return [200, { status: "ignored", reason: "work item owned by remote agent" }.to_json]
|
|
291
|
+
end
|
|
270
292
|
end
|
|
271
293
|
end
|
|
272
294
|
|