Repository navigation
[safeoutputs] Clarify submit_pull_request_review allowed-events in tool description #76610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -387,9 +387,33 @@ func submitPullRequestReviewConstraints(config *SubmitPullRequestReviewConfig) [ | |
| appendMaxConstraint(constraints, config.Max, "Maximum %d review(s) can be submitted.") | ||
| appendTargetConstraint(constraints, config.Target) | ||
| appendStringConstraint(constraints, config.TargetRepoSlug, "Reviews will be submitted in repository %q.") | ||
| appendAllowedReviewEventsConstraint(constraints, config.AllowedEvents) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/codebase-design] This changes the compiled tool description, so committed lock files go stale. Recompiling 💡 Suggested fixRun @copilot please address this. |
||
| }) | ||
| } | ||
|
|
||
| // reviewEventValues lists every review event the submit_pull_request_review tool schema supports. | ||
| var reviewEventValues = []string{"APPROVE", "COMMENT", "REQUEST_CHANGES"} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
💡 Share the canonical event setDefine one canonical supported-events list and reuse it for parsing/validation, schema generation, and this description constraint. That keeps the agent-facing policy synchronized with runtime enforcement as the enum evolves.
Comment on lines
+394
to
+395
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/codebase-design] The review event list is now hardcoded in several places. 💡 Suggested refactorDefine one package-level slice of review events and use it in the parser in @copilot please address this. |
||
|
|
||
| // appendAllowedReviewEventsConstraint tells the agent which review events are permitted when | ||
| // allowed-events narrows the set, and explicitly names the excluded ones so the base | ||
| // description's references to APPROVE do not mislead the agent into a rejected call. | ||
| func appendAllowedReviewEventsConstraint(constraints *[]string, allowedEvents []string) { | ||
| if len(allowedEvents) == 0 { | ||
| return | ||
| } | ||
| text := "Allowed review events: " + strings.Join(allowedEvents, ", ") + "." | ||
| var excluded []string | ||
| for _, event := range reviewEventValues { | ||
| if !slices.Contains(allowedEvents, event) { | ||
| excluded = append(excluded, event) | ||
| } | ||
| } | ||
| if len(excluded) > 0 { | ||
| text += " Events not listed (" + strings.Join(excluded, ", ") + ") are rejected; do not use them." | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/diagnosing-bugs] The new sentence is appended after the long WRITE-ONCE preamble, so it falls outside the visible part of the description. 💡 Suggested fixPut the allowed-events sentence before the preamble so its first 90 characters carry the rule. Add a regression test that asserts the rule appears within the first 90 characters. Then confirm the output of @copilot please address this. |
||
| } | ||
| *constraints = append(*constraints, text) | ||
| } | ||
|
|
||
| func replyToPullRequestReviewCommentConstraints(config *ReplyToPullRequestReviewCommentConfig) []string { | ||
| return buildConstraints(config, func(config *ReplyToPullRequestReviewCommentConfig, constraints *[]string) { | ||
| appendMaxConstraint(constraints, config.Max, "Maximum %d reply/replies can be created.") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the compiled tool description without updating the checked-in generated lock workflows, so the repository can fail its recompile/drift check and affected workflows will continue shipping the old description.
💡 Regenerate the compiled artifacts
Run
make recompileand commit the resulting.lock.ymlchanges alongside this source change; verify the generated diff is intentional.