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 +4 -4
- data/lib/brainiac/plugins/github/handler.rb +27 -1
- 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: 15281b0cda1699aa7d7b959380a43bd992b9d7a1a8930eba464047b2ff959d05
|
|
4
|
+
data.tar.gz: a19b302521ae9d8711629e5b1785e3730a21fba35b01933fe7d1cbf78f77dd2c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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 =
|
|
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)
|