Repository navigation
Description
Title
required-labels is silently ignored for reply-to-pull-request-review-comment and resolve-pull-request-review-thread
Body
Analysis
required-labels: compiles with zero warnings for both
reply-to-pull-request-review-comment and
resolve-pull-request-review-thread, and the docs
(safe-outputs-pull-requests reference) list it as a valid option for both,
with the same semantics as every other safe-output that supports it
(push-to-pull-request-branch, create-pull-request, etc: only act if the
target PR carries all these labels). In practice it enforces nothing for
these two types.
Confirmed by reading the source directly (not just observing compiled
output): both config structs embed SafeOutputFilterConfig (which holds
RequiredLabels), and the handler-registry codegen that builds the
runtime tool config for both types already reads c.RequiredLabels via
AddStringSlice("required_labels", c.RequiredLabels)
(safe_outputs_handler_registry_pull_requests.go) -- so the plumbing
downstream of parsing is correct and ready to receive the value.
The gap is upstream of that: neither type's own parser function actually
reads required-labels out of the YAML config map at all.
parseReplyToPullRequestReviewCommentConfig
(reply_to_pr_review_comment.go) parsestarget,target-repo,
allowed-repos, andfooter-- neverrequired-labels.parseResolvePullRequestReviewThreadConfig(resolve_pr_review_thread.go)
only callsparseBaseSafeOutputConfigandParseTargetConfig-- also
never touchesrequired-labels.
Compare to push_to_pull_request_branch.cjs's own parser, which calls
ParseStringArrayOrExprFromConfig(configMap, "required-labels", ...)
explicitly (falling back to labels for back-compat) -- the pattern these
two are missing.
Why this matters
For safe-outputs whose target is "*" (agent supplies the PR/thread
identifier per call, no automatic "triggering PR" scoping), required- labels is often the only thing constraining which PR a confused or
steered agent can act against. comment_id (REST) and thread_id
(GraphQL node ID) are both repo-global identifiers with no inherent tie to
"the PR this workflow is supposed to be scoped to" -- without a working
required-labels guard, nothing stops a call from referencing an ID that
belongs to an entirely different PR in the same repo.
Reproduction
safe-outputs:
reply-to-pull-request-review-comment:
target: "*"
required-labels: [automation, my-workflow]
resolve-pull-request-review-thread:
target: "*"
required-labels: [automation, my-workflow]Compiles with 0 warnings. Inspecting the compiled
GH_AW_SAFE_OUTPUTS_CONFIG / GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG env vars
in the generated lock file shows required_labels present for other
safe-output types configured the same way in the same workflow, but absent
entirely from these two types' own config blocks -- confirming the value
never made it past parsing.
Implementation Plan
- In
parseReplyToPullRequestReviewCommentConfig
(reply_to_pr_review_comment.go), parserequired-labelsinto
config.RequiredLabelsthe same waypush_to_pull_request_branch's
parser does (ParseStringArrayOrExprFromConfigor the shared filter-
config helper, if one exists for this purpose --
pkg/workflow/safe_outputs_parser.go'sSafeOutputFilterConfig{}
usage looked like a candidate but wasn't being invoked by either of
these two parsers). - Same fix in
parseResolvePullRequestReviewThreadConfig
(resolve_pr_review_thread.go). - Add a test per type asserting
required-labelsin the source YAML
actually appears in the compiled config'srequired_labelsfield, not
just that compilation succeeds without error.
Acceptance Criteria
required-labelsconfigured onreply-to-pull-request-review-comment
orresolve-pull-request-review-threadshows up in the compiled
required_labelsfield, matching the behavior of
push-to-pull-request-branchconfigured the same way.- A workflow run attempting to reply/resolve against a PR missing one of
the required labels is actually blocked at runtime, not just
documented as blocked.
Activity