Skip to content

Safe outputs: create_pull_request_review_comment and submit_pull_request_review fail from workflow_dispatch #27884

@PureWeen

Description

@PureWeen

Problem

create_pull_request_review_comment and submit_pull_request_review safe outputs fail when the workflow is triggered via workflow_dispatch, even when the agent correctly identifies the PR number from inputs.pr_number.

Error messages

Target is "triggering" but not running in pull request context, skipping review comment creation
✗ Message 1 (create_pull_request_review_comment) failed: Not in pull request context

Setting review metadata: event=COMMENT, bodyLength=2612
✓ Message 4 (submit_pull_request_review) completed successfully
No review context set - cannot submit review
✗ Failed to submit PR review: No review context available

Why this matters

workflow_dispatch is a common way to test review workflows before merging them to main (using --ref <branch>). It's also useful for re-reviewing specific PRs on demand. The safe-outputs handler has the pr_number input available but doesn't resolve it into PR review context.

Current workaround

Use add_comment with target: "*" instead — this works from all trigger types but produces regular comments, not inline review annotations.

Additional context

  • pull_request and issue_comment triggers work correctly (they have github.event.pull_request context)
  • Safe outputs are fire-and-forget from the agent's perspective — the agent cannot detect failures and fall back to add_comment
  • This makes try-then-fallback patterns impossible

Expected

The safe-outputs handler should resolve inputs.pr_number (or a configurable target field) into PR context for review-related safe outputs, similar to how add_comment supports target: "*".

Discovered in

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions