Skip to content

Fix inline review comments on centralized reviewer reruns - #52960

Merged
pelikhan merged 3 commits into
mainfrom
copilot/investigate-matt-review-comments
Aug 15, 2026
Merged

Fix inline review comments on centralized reviewer reruns#52960
pelikhan merged 3 commits into
mainfrom
copilot/investigate-matt-review-comments

Conversation

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Matt reviewer reruns submitted the overall review but dropped inline comments. Centralized slash commands execute through workflow_dispatch, while the inline-comment handler inspected the raw event instead of the reconstructed pull request context.

  • Context handling

    • Resolve the original event and payload before validating PR context.
    • Use the effective payload for PR targeting and footer metadata.
  • Regression coverage

    • Cover inline comments triggered through centralized slash-command dispatches.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 7.24 AIC · ⌖ 6.74 AIC · ⊞ 8.7K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Great work on the fix! 🎉

This PR addresses a regression where centralized slash-command dispatches were losing inline comment context—the inline-comment handler was inspecting the raw event instead of the reconstructed pull request payload.

What looks good:

  • Focused fix — Introduces resolveInvocationContext() to normalize event handling across both direct PR events and workflow_dispatch reruns
  • Regression test — New test case should use the original PR context for centralized slash-command dispatches validates the fix
  • Clear description — The PR body explains the context handling change and regression coverage strategy
  • Minimal diff — Changes are surgical, replacing direct context.payload and context.eventName references with resolved values

This is ready for maintainer review. Once the draft status is lifted and any final checks pass, it's in good shape for merge.

Generated by ✅ Contribution Check · auto · 57.4 AIC · ⌖ 3.95 AIC · ⊞ 9.1K ·

@pelikhan
pelikhan marked this pull request as ready for review August 15, 2026 21:15
Copilot AI balanced review requested due to automatic review settings August 15, 2026 21:15
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Lean already. Ship. Diff is a straightforward fix (adds effectivePayload/effectiveEventName resolution via existing resolveInvocationContext helper, updates references, adds one focused regression test). No speculative abstractions, dead flexibility, or reinvented stdlib found.

Generated by Ponytail Reviewer for #52960

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for PR Code Quality Reviewer. Review the logs for details.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #52960 does not have the 'implementation' label and has 0 new lines of code in business logic directories (threshold: 100).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fix correctly applies resolveInvocationContext to derive effectiveEventName and effectivePayload, enabling inline review comments to work during centralized reviewer reruns (workflow_dispatch). Fallbacks to the raw context values preserve existing behavior. The new test covers the dispatch scenario end-to-end. No issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 17.7 AIC · ⌖ 7.86 AIC · ⊞ 5.6K

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes inline review comments during centralized reviewer reruns by reconstructing the original pull request context.

Changes:

  • Resolves effective event and payload data for dispatched workflows.
  • Uses reconstructed context for PR targeting and footer metadata.
  • Adds regression coverage for centralized slash-command dispatches.
Show a summary per file
File Description
actions/setup/js/create_pr_review_comment.cjs Applies reconstructed invocation context to review comments.
actions/setup/js/create_pr_review_comment.test.cjs Tests dispatched PR-context handling.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions github-actions Bot mentioned this pull request Aug 15, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd — two observations worth addressing before merge, otherwise LGTM.

📋 Key Themes & Highlights

Key Themes

  • Missing fallback-path test: the new test proves workflow_dispatch works but doesn't cover the case where resolveInvocationContext returns {}, leaving the || guard untested.
  • No error boundary on resolveInvocationContext: a malformed event_payload JSON in workflow_dispatch inputs would throw synchronously and abort main() before processing any message.

Positive Highlights

  • ✅ Root cause properly addressed — all six context.eventName/context.payload call-sites replaced consistently.
  • ✅ Regression test added in the same PR with a realistic workflow_dispatch payload shape.
  • ✅ Minimal diff; no unrelated churn.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 31.8 AIC · ⌖ 8.58 AIC · ⊞ 7.7K
Comment /matt to run again

});
expect(buffer.getBufferedCount()).toBe(1);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/tdd] The new test covers the workflow_dispatch happy path but not the fallback: if resolveInvocationContext returns {}, the code should fall back to raw context.eventName/context.payload. A test for that case would pin the || guard behaviour and prevent a silent regression if invocation_context_helpers changes its return shape.

💡 Suggested additional test skeleton
it("falls back to raw context when invocationContext is empty", async () => {
  // resolveInvocationContext returns no overrides
  jest.mock("./invocation_context_helpers.cjs", () => ({
    resolveInvocationContext: () => ({}),
  }));
  global.context = mockContext; // standard PR trigger
  const handler = await createHandler({ target: "triggering" });
  const result = await handler(prReviewMessage, {});
  expect(result.success).toBe(true);
});

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in ec00158 by adding regression coverage for fallback behavior when invocation context resolution yields empty/partial context (raw context fallback path is now explicitly tested).

@@ -38,6 +39,9 @@ async function main(config = {}) {
const legacyBuffer = registry ? null : config._prReviewBuffer || null;
const { defaultTargetRepo, allowedRepos } = resolveTargetRepoConfig(config);
const githubClient = await createAuthenticatedGitHubClient(config);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/diagnosing-bugs] effectivePayload is derived once at startup (line 41) before the per-message loop, but the invocation context is static anyway so this is fine. However, if resolveInvocationContext ever throws (e.g. malformed event_payload JSON), the entire main() will reject before processing any message. Consider wrapping the call in a try/catch and falling back to raw context, so a bad dispatch input degrades gracefully rather than taking down the whole handler.

💡 Defensive pattern
let invocationContext = {};
try {
  invocationContext = resolveInvocationContext(context);
} catch (e) {
  core.warning(`resolveInvocationContext failed, using raw context: ${e.message}`);
}
const effectiveEventName = invocationContext.eventName || context.eventName;
const effectivePayload   = invocationContext.eventPayload || context.payload;

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in ec00158 by adding defensive handling around invocation-context resolution: non-validation failures now fall back to raw context, while ERR_VALIDATION failures are still re-thrown.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, address the remaining maintainer-facing follow-up, and run the pr-finisher skill before handing this PR back to maintainers.

Outstanding review items (newest first):

Failed checks from the compact candidate set:

  • None listed.

Branch update was requested automatically for this run when GitHub allows it.
Run context: https://github.com/github/gh-aw/actions/runs/31912394882

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 7.24 AIC · ⌖ 6.74 AIC · ⊞ 8.7K ·
Comment /souschef to run again

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Implemented via ec00158: I ran the PR finisher pass, addressed the open inline feedback with minimal code/test updates, validated with targeted JS tests, and pushed the fixes.

@pelikhan
pelikhan merged commit fc89a0a into main Aug 15, 2026
1 check failed
@pelikhan
pelikhan deleted the copilot/investigate-matt-review-comments branch August 15, 2026 22:52
Copilot stopped work on behalf of gh-aw-bot due to an error August 15, 2026 22:52
Copilot AI requested a review from gh-aw-bot August 15, 2026 22:52
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.87.0

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.

4 participants