brainiac-github 0.2.0 → 0.2.1

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: 48b4b58174666e2efbd528ac3cf650cad735f25d84eedabffe4d201cdbe2acac
4
- data.tar.gz: fd097926d92d623f56c7b5c26e7aa88726e952eb6ba21f1392bbecadaaf8f55e
3
+ metadata.gz: 15281b0cda1699aa7d7b959380a43bd992b9d7a1a8930eba464047b2ff959d05
4
+ data.tar.gz: a19b302521ae9d8711629e5b1785e3730a21fba35b01933fe7d1cbf78f77dd2c
5
5
  SHA512:
6
- metadata.gz: 828c3c2dfe74d72c92a717b68b1d79e4d9fddf1a73539f912b874895020b5254b8c64d630d391494099630d943cf3f6d47ca8b1726b6d783c8de509180096889
7
- data.tar.gz: f0d3527e61e1b1b3bcf0f8f1e3da2a9ff63d39711238bb5c134f3826875949035256ed945a953335369c5db612255cee7703a8b302f51487dd1b97da8589de75
6
+ metadata.gz: 0dce21620964ed25764860b9f697578579b9340f6e8dadbb8dc1751b8e41c70a99d3c0d3f1e4c7f9876ce2d4e415d06f369a38553cdeff368ac722f83acc8e5b
7
+ data.tar.gz: 4e38c8f2504dcd4f5bf0022a64debc513614d4073b846cfc6dab4ea3df249d9049a58a5c9518c1e40938877dd07ee54c7f0526097a97edd1482f6023114d9e30
@@ -177,6 +177,20 @@ module Brainiac
177
177
  branch = fetch_pr_branch(repo_name, pr_number, agent_name, project_config)
178
178
  result = find_work_item_by_branch(branch)
179
179
 
180
+ # If a work item exists and has an assigned agent, use that agent
181
+ # instead of the project default. This ensures comments on a PR
182
+ # route to whoever is actually working it (e.g. GLaDOS opened the PR,
183
+ # so GLaDOS should handle follow-up comments — not the project's default agent).
184
+ # Explicit mentions still take priority (already resolved above).
185
+ if result && !mentioned
186
+ _, card_info = result
187
+ work_item_agent = card_info["agent"]
188
+ if work_item_agent && work_item_agent.downcase != agent_name.downcase && local_agent_names.include?(work_item_agent)
189
+ LOG.info "[GitHub] Work item agent override: #{work_item_agent} (project default: #{agent_name})"
190
+ agent_name = work_item_agent
191
+ end
192
+ end
193
+
180
194
  card_number, worktree = resolve_comment_worktree(result, mentioned, agent_name, pr_number, project_config)
181
195
  return worktree if worktree.is_a?(Array)
182
196
 
@@ -283,6 +297,18 @@ module Brainiac
283
297
  card_info["number"] || card_info.dig("sources", "fizzy", "card_number")
284
298
  end
285
299
 
300
+ # Resolve the agent name from a work item, falling back to the project default.
301
+ # Work items track which agent is assigned (e.g. GLaDOS opened the PR), so
302
+ # comments/reviews should route to that agent rather than the project default.
303
+ def resolve_work_item_agent(card_info, project_config)
304
+ work_item_agent = card_info["agent"] if card_info
305
+ if work_item_agent && local_agent_names.include?(work_item_agent)
306
+ work_item_agent
307
+ else
308
+ agent_name_for(project_config)
309
+ end
310
+ end
311
+
286
312
  # Fetch the head branch name of a PR using the GitHub App or `gh` CLI.
287
313
  def fetch_pr_branch(repo_name, pr_number, agent_name, project_config)
288
314
  if AppClient.configured?(agent_name)
@@ -460,7 +486,7 @@ module Brainiac
460
486
  def dispatch_pr_review(card_number, card_key, card_info, pr_number, review, reviewer,
461
487
  repo_name, project_key, project_config, repo_path)
462
488
  review_id = review["id"]
463
- agent_name = agent_name_for(project_config)
489
+ agent_name = resolve_work_item_agent(card_info, project_config)
464
490
 
465
491
  Thread.new do
466
492
  if AppClient.configured?(agent_name)
@@ -3,7 +3,7 @@
3
3
  module Brainiac
4
4
  module Plugins
5
5
  module Github
6
- VERSION = "0.2.0"
6
+ VERSION = "0.2.1"
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.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis