Skip to content

fix(assign-to-agent): remove invalid requiresOneOf constraint, add GraphQL query logging - #40488

Closed
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-assign-to-agent-safe-output-again
Closed

fix(assign-to-agent): remove invalid requiresOneOf constraint, add GraphQL query logging#40488
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-assign-to-agent-safe-output-again

Conversation

Copilot AI commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

The assign_to_agent validator rejected messages without issue_number or pull_number, breaking triggering-context auto-resolution — agents calling assign_to_agent(agent="copilot") with no explicit target had their output silently blocked before reaching the handler.

Validator fix

  • safe_outputs_validation_config.go: Removed requiresOneOf:issue_number,pull_number from assign_to_agent. The handler already auto-resolves from workflow context when target: "triggering" (the default).
  • schemas/agent-output.json: Replaced the oneOf required constraint with required: ["type"]issue_number and pull_number are now optional.
  • safe_output_type_validator.test.cjs: Updated config and test — assign_to_agent(agent="copilot") with no target fields must now pass.

GraphQL logging

  • assign_agent_helpers.cjs: Added core.info() logging of the final built mutation string (both replaceActorsForAssignable and the addAssigneesToAssignable fallback) to make GraphQL failures diagnosable from run logs without ACTIONS_STEP_DEBUG.

Docs & samples

  • Clarified in safe-outputs.md, safe-outputs-automation.md, and the sample workflow that issue_number/pull_number are optional when target: "triggering" — agents may omit them and the handler resolves the target from context.
  • Corrected the default target example in safe-outputs-automation.md from "*" to "triggering".
  • Updated safe_outputs_tools.json (both copies) field descriptions accordingly.

…ber for triggering target, add GraphQL query logging

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Fix assign-to-agent safe output: allow triggering-context resolution, add GraphQL logging fix(assign-to-agent): remove invalid requiresOneOf constraint, add GraphQL query logging Jun 20, 2026
Copilot AI requested a review from pelikhan June 20, 2026 17:26
@pelikhan
pelikhan marked this pull request as ready for review June 20, 2026 17:31
Copilot AI review requested due to automatic review settings June 20, 2026 17:31

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

This pull request updates the assign_to_agent safe-output contract to allow omitting issue_number/pull_number when the handler can resolve the target from workflow context (target: "triggering"), and improves diagnosability of agent assignment failures by logging the final GraphQL mutation text.

Changes:

  • Loosens assign_to_agent validation so calls without explicit target fields can pass when targeting the triggering context.
  • Adds core.info() logging for the final and fallback GraphQL mutations used during agent assignment.
  • Updates docs and tool schemas/samples to reflect the optionality of issue_number/pull_number in triggering mode.
Show a summary per file
File Description
schemas/agent-output.json Adjusts the JSON schema for assign_to_agent to make issue_number/pull_number optional.
pkg/workflow/safe_outputs_validation_config.go Removes the requiresOneOf validation rule from assign_to_agent in the Go validation config.
pkg/workflow/js/safe_outputs_tools.json Updates tool descriptions to document triggering-context auto-resolution and refines wording/formatting.
actions/setup/js/safe_outputs_tools.json Mirrors the tool description updates for the action-side copy.
actions/setup/js/safe_output_type_validator.test.cjs Updates validator test config and expectations so assign_to_agent without target fields now passes.
actions/setup/js/assign_agent_helpers.cjs Logs the final constructed GraphQL mutation strings for easier debugging from run logs.
docs/src/content/docs/reference/safe-outputs.md Documents that issue_number/pull_number may be omitted in triggering mode.
.github/aw/safe-outputs-automation.md Fixes the default assign-to-agent.target example and clarifies omission behavior in triggering mode.
pkg/cli/workflows/test-assign-to-agent.md Updates the sample workflow task text/examples to show omitting issue_number for triggering issues.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 9/9 changed files
  • Comments generated: 2

Comment thread schemas/agent-output.json
Comment on lines 929 to 935
"agent": {
"type": "string",
"description": "Agent name or slug (defaults to 'copilot' if not provided)"
}
},
"required": ["type"],
"additionalProperties": false
github-token: ${{ secrets.SOME_CUSTOM_TOKEN }} # optional custom token for permissions
```

When using `target: "triggering"` (the default), the agent tool can omit `issue_number` and `pull_number` — the handler auto-resolves the target from the workflow context (the issue or PR that triggered the workflow). Explicitly providing `issue_number` or `pull_number` is required only when using `target: "*"` or a specific number.
@pelikhan pelikhan closed this Jun 20, 2026
@github-actions
github-actions Bot deleted the copilot/fix-assign-to-agent-safe-output-again branch June 28, 2026 03:01
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