Fix centralized slash_command reaction and status-comment gating#31775
Conversation
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
There was a problem hiding this comment.
Pull request overview
Fixes centralized (slash_command.strategy: centralized) activation feedback gating so reaction/status-comment steps run correctly when the workflow is invoked via workflow_dispatch, using aw_context to recover the original source event and repo.
Changes:
- Extend reaction/status-comment
if:condition builders to include aworkflow_dispatchbranch keyed offfromJSON(github.event.inputs.aw_context).event_type. - Enhance JS invocation context resolution to derive
eventName,eventPayload, andeventRepofromaw_context, and updateadd_reaction.cjsto use the resolved context. - Add/adjust Go + JS tests covering centralized gating, aw_context-derived routing, and workflow_dispatch reaction resolution.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/slash_command_centralized_compile_test.go | Updates compilation assertions to expect workflow_dispatch + aw_context-based gating. |
| pkg/workflow/expressions_test.go | Updates condition-builder tests and adds centralized workflow_dispatch coverage. |
| pkg/workflow/expression_builder.go | Adds workflow_dispatch branch generation for reaction/status-comment conditions. |
| pkg/workflow/compiler_activation_job_builder.go | Passes centralized-mode flag into condition builders for activation steps. |
| actions/setup/js/invocation_context_helpers.test.cjs | Adds tests for aw_context-derived workflow_dispatch invocation context. |
| actions/setup/js/invocation_context_helpers.cjs | Implements aw_context-based event name/payload/repo derivation for workflow_dispatch. |
| actions/setup/js/add_reaction.test.cjs | Adds workflow_dispatch + aw_context reaction test and updates helper signatures in tests. |
| actions/setup/js/add_reaction.cjs | Uses resolved invocation context (eventRepo/eventPayload) for correct reaction placement. |
| .github/workflows/grumpy-reviewer.lock.yml | Regenerates lock workflow content (heredoc markers / trailing newline). |
| .github/workflows/agentic_commands.yml | Updates embedded compiler version metadata. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
actions/setup/js/add_reaction.cjs:131
- JSDoc for
handleGraphQLOrUnknownEventis missing thepayloadparameter (the signature is(eventName, owner, repo, payload, reaction)). Please documentpayloadin the@paramlist to keep@ts-checkannotations accurate.
* @param {string} owner
* @param {string} repo
* @param {string} reaction
*/
async function handleGraphQLOrUnknownEvent(eventName, owner, repo, payload, reaction) {
- Files reviewed: 10/10 changed files
- Comments generated: 3
| nativeCondition := BuildDisjunction(false, terms...) | ||
|
|
||
| if !includeWorkflowDispatch { | ||
| return nativeCondition | ||
| } | ||
|
|
| eventRepo || | ||
| parseRepoSlug(inputs.event_repo) || | ||
| parseRepoSlug(inputs.eventRepo) || | ||
| parseRepoSlug(typeof awContext?.repo === "string" ? awContext.repo : undefined) || | ||
| targetRepo; |
| @@ -66,10 +69,10 @@ async function main() { | |||
| * @param {string} repo | |||
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Fixed in |
|
@copilot fix https://github.com/github/gh-aw/actions/runs/25759290777/job/75656156706?pr=31775 Review the generated if condition to make sure it matches the decentralized behavior |
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Fixed in |
|
@copilot merge main and recompile |
Co-authored-by: pelikhan <[email protected]>
…support-slash-commands # Conflicts: # .github/workflows/grumpy-reviewer.lock.yml Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Done in |
|
@copilot merge main and recompile |
…support-slash-commands # Conflicts: # .github/workflows/agentic_commands.yml # .github/workflows/grumpy-reviewer.lock.yml Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Done in |
Bug Fix
What was the bug?
For
slash_command.strategy: centralized, command workflows run viaworkflow_dispatch, but activation feedback gates only matched native webhook events. As a result, reaction and status-comment steps were skipped even when the original trigger was an issue/PR/discussion comment.How did you fix it?
Activation condition generation
workflow_dispatchbranch.fromJSON(github.event.inputs.aw_context || '{}').event_typeto recover the original source event.Dispatched invocation context
invocation_context_helpersto deriveeventName,eventPayload, andeventRepofrominputs.aw_contextwhen explicit override inputs are not present.Reaction handling path
add_reaction.cjsto use resolved invocation context (not raw workflow event context), ensuring reactions are posted to the original item in the source repo.Coverage updates
workflow_dispatchgating and aw_context-derived routing behavior (including status-comment/reaction paths).Testing