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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4646b834b308b619a34c5b94da48aeb88b80caa3fb5efd107ac40a5dc56da2a0
4
- data.tar.gz: af0c3f9c0b47e366928760c64168a74eb3651f87c193156cbced75336626bac0
3
+ metadata.gz: 6a7a75791c3df9f85c5e2d545bbaa83bc496a7d6f88c34f38a84d73a5bcced59
4
+ data.tar.gz: 896ba92478b7d36dbc9e99f71586c4c0fdb4e777a007e087412ccaf71b2cabdd
5
5
  SHA512:
6
- metadata.gz: 945f7fad37cd33a37d755b6517faa8638c4a351d74f11edb60bf8299d04933837f38b34e1fa39afaea34af2b2d57c89f5b88d641fb6e6001436622928143d445
7
- data.tar.gz: 5c2e27ab69d9af292ddbd3c7ac299629f1b97c005b85275bdaaa31d24b010903a75b4973d6d91cf99ab5ea580c53c67c77e341724f46c633a2628d2a78ad6c67
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 && work_item_agent.downcase != agent_name.downcase && local_agent_names.include?(work_item_agent)
268
- LOG.info "[GitHub] Work item agent override: #{work_item_agent} (project default: #{agent_name})"
269
- agent_name = work_item_agent
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
 
@@ -3,7 +3,7 @@
3
3
  module Brainiac
4
4
  module Plugins
5
5
  module Github
6
- VERSION = "0.2.5"
6
+ VERSION = "0.2.6"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brainiac-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis