fix: merge imported workflow bots field in compiler#29151
Conversation
Add mergeBots helper and use it in extractAdditionalConfigurations to correctly merge imported workflow bots with top-level bots, mirroring the existing mergeSkipBots pattern. Also add TestMergeBots unit test. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/ae48adcc-b6c9-45f3-82d6-3098e7961a02 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/ae48adcc-b6c9-45f3-82d6-3098e7961a02 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes a compilation bug where on.bots values coming from imported workflows were collected into ImportsResult.MergedBots but not applied to the final compiled workflow, causing imported bots to be dropped.
Changes:
- Apply imported bots during compilation by merging
extractBots(frontmatter)withimportsResult.MergedBots. - Add
mergeBotshelper (deduping union) alongside existing merge helpers. - Add unit tests for
mergeBotsbehavior (top-only, imported-only, union, dedup, nil).
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/compiler_orchestrator_workflow.go | Merges extracted bots with imported bots during additional configuration extraction. |
| pkg/workflow/role_checks.go | Adds mergeBots helper delegating to shared dedup/merge utility. |
| pkg/workflow/bots_test.go | Adds TestMergeBots to validate merge/dedup behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
|
|
||
| workflowData.Roles = c.extractRoles(frontmatter) | ||
| workflowData.Bots = c.extractBots(frontmatter) | ||
| workflowData.Bots = c.mergeBots(c.extractBots(frontmatter), importsResult.MergedBots) |
There was a problem hiding this comment.
This change fixes imported bots propagation, but the added test only validates mergeBots in isolation. Consider adding an end-to-end test that compiles a workflow importing another workflow that defines on.bots, and assert the compiled lock output includes the expected GH_AW_ALLOWED_BOTS (and that top-level + imported bots are unioned/deduped). This will guard against regressions where the orchestrator stops applying importsResult.MergedBots.
🧪 Test Quality Sentinel ReportTest Quality Score: 80/100✅ Excellent test quality
Test Classification Details
Analysis
|
|
@copilot review all comments |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/91ca21ad-5aaf-4886-b37b-46ea9827f137 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added
All three assert the expected |
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment. |
When a workflow is imported, its
botsfield was extracted intoMergedBotsbyimport_field_extractor.gobut never applied to the compiled output — imported bots were silently dropped.Changes
compiler_orchestrator_workflow.go: Replace bareextractBotscall withmergeBots, mirroring the existingmergeSkipBotspattern:role_checks.go: AddmergeBotshelper delegating to the sharedmergeStringSlicesDeduputility (union with dedup, consistent withmergeSkipBots/mergeSkipRoles).bots_test.go: AddTestMergeBotscovering top-only, imported-only, union, dedup, and nil cases. AddTestBotsImportMergewith three end-to-end sub-tests that compile a workflow importing another workflow withbots:defined, asserting the expectedGH_AW_ALLOWED_BOTSvalue in the compiled lock file:imported_bots_merged_with_top_level_bots— union of top-levelon.botsand importedbotsimported_bots_only_no_top_level_bots— imported bots propagate when the main workflow defines noneduplicate_bots_across_top_level_and_import_deduped— overlapping bots are deduplicated