Skip to content

Fix centralized slash_command reaction and status-comment gating#31775

Merged
pelikhan merged 14 commits into
mainfrom
copilot/fix-reaction-support-slash-commands
May 12, 2026
Merged

Fix centralized slash_command reaction and status-comment gating#31775
pelikhan merged 14 commits into
mainfrom
copilot/fix-reaction-support-slash-commands

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

Bug Fix

What was the bug?

For slash_command.strategy: centralized, command workflows run via workflow_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

    • Extended reaction/status-comment condition builders to include a workflow_dispatch branch.
    • For centralized runs, gates now key off fromJSON(github.event.inputs.aw_context || '{}').event_type to recover the original source event.
  • Dispatched invocation context

    • Enhanced invocation_context_helpers to derive eventName, eventPayload, and eventRepo from inputs.aw_context when explicit override inputs are not present.
    • Added payload reconstruction for issue/PR/discussion(+comment) targets so downstream handlers operate on canonical shapes.
  • Reaction handling path

    • Updated add_reaction.cjs to use resolved invocation context (not raw workflow event context), ensuring reactions are posted to the original item in the source repo.
  • Coverage updates

    • Added/updated compiler and JS tests for centralized workflow_dispatch gating and aw_context-derived routing behavior (including status-comment/reaction paths).
# Representative generated gate (centralized mode)
if: github.event_name == 'workflow_dispatch' &&
    (fromJSON(github.event.inputs.aw_context || '{}').event_type == 'issue_comment' || ...)

Testing

  • Added targeted test coverage for:
    • centralized condition rendering in workflow compiler output
    • aw_context-based invocation context derivation
    • reaction endpoint resolution under workflow_dispatch

Copilot AI changed the title Fix centralized slash-command reactions and status comments Fix centralized slash_command reaction and status-comment gating May 12, 2026
Copilot AI requested a review from pelikhan May 12, 2026 19:38
@pelikhan pelikhan marked this pull request as ready for review May 12, 2026 19:55
Copilot AI review requested due to automatic review settings May 12, 2026 19:55
@pelikhan
Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 a workflow_dispatch branch keyed off fromJSON(github.event.inputs.aw_context).event_type.
  • Enhance JS invocation context resolution to derive eventName, eventPayload, and eventRepo from aw_context, and update add_reaction.cjs to 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 handleGraphQLOrUnknownEvent is missing the payload parameter (the signature is (eventName, owner, repo, payload, reaction)). Please document payload in the @param list to keep @ts-check annotations 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

Comment on lines +127 to 132
nativeCondition := BuildDisjunction(false, terms...)

if !includeWorkflowDispatch {
return nativeCondition
}

Comment on lines +228 to +232
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
Copilot AI and others added 2 commits May 12, 2026 20:07
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@copilot fix https://github.com/github/gh-aw/actions/runs/25758824569/job/75654349152?pr=31775

Fixed in 897b0fe. I updated route_slash_command.cjs to build awContext with command_name in one object literal (instead of mutating the typed return object), and verified with npm run typecheck plus vitest run route_slash_command.test.cjs in actions/setup/js.

@pelikhan
Copy link
Copy Markdown
Collaborator

@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

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@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

Fixed in 4fae5c1. I reviewed and updated condition generation so centralized reaction/status-comment gating now matches decentralized behavior when targets are disabled (returns false instead of emitting empty/invalid disjunctions), and verified with targeted workflow compiler tests plus JS lint/test checks.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile

Copilot AI and others added 2 commits May 12, 2026 20:36
…support-slash-commands

# Conflicts:
#	.github/workflows/grumpy-reviewer.lock.yml

Co-authored-by: pelikhan <[email protected]>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@copilot merge main and recompile

Done in 78c6a5c (after merging main in 6e59a1a). I merged origin/main, recompiled, and verified the generated if conditions in .github/workflows/grumpy-reviewer.lock.yml now include the centralized workflow_dispatch branch while preserving the decentralized event checks.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile

Copilot AI and others added 2 commits May 12, 2026 20:50
…support-slash-commands

# Conflicts:
#	.github/workflows/agentic_commands.yml
#	.github/workflows/grumpy-reviewer.lock.yml

Co-authored-by: pelikhan <[email protected]>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@copilot merge main and recompile

Done in 9dec0c5 (after merging main in e16eb7a). I synced with latest origin/main, recompiled, and verified the generated if conditions in .github/workflows/grumpy-reviewer.lock.yml include centralized workflow_dispatch gating while preserving decentralized event checks.

@pelikhan pelikhan merged commit a62c50c into main May 12, 2026
@pelikhan pelikhan deleted the copilot/fix-reaction-support-slash-commands branch May 12, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants