Skip to content

Allow close_issue agents to choose from permitted state reasons at runtime #46825

Description

@alondahari

Summary

Allow close_issue workflows to expose state-reason selection to the agent at runtime.

Workflow authors should be able to omit state-reason entirely. When omitted, the generated tool schema should let the agent choose any supported reason: completed, not_planned, or duplicate.

Existing scalar state-reason configuration must remain backward compatible, and authors may optionally provide a list to restrict the agent's choices.

Proposed behavior

safe-outputs:
  close-issue:
    target: triggering
    # state-reason omitted: agent may choose completed, not_planned, or duplicate

Authors can restrict runtime choices with a list:

safe-outputs:
  close-issue:
    target: triggering
    state-reason: [not_planned, duplicate]

The configuration contract should be clear:

  • Omitted configuration: expose state_reason to the agent with all three supported values.
  • Scalar configuration: preserve today's fixed reason behavior.
  • List configuration: expose state_reason restricted to the configured values.
  • Omitted tool argument: remain valid and use the existing configured/default behavior rather than reject the call.

For a list, the generated close_issue schema may expose an optional state_reason enum containing only the permitted values. With no workflow-level state-reason, the enum should contain all three supported values.

Observed failure

In a triage workflow configured with fixed state-reason: not_planned, the agent emitted:

{
  "type": "close_issue",
  "duplicate_of": 657,
  "suggest": true,
  "confidence": "HIGH",
  "rationale": "The reports describe the same CSV export defect."
}

Because the agent could not select duplicate, native duplicate marking was skipped and the issue closed directly as not_planned, despite the duplicate evidence and intent metadata.

Acceptance criteria

  • Omitting workflow-level state-reason lets the agent choose completed, not_planned, or duplicate.
  • A scalar keeps the existing fixed-reason behavior.
  • A list restricts runtime selection to the configured reasons.
  • The agent-facing state_reason argument is optional; omission does not reject the call.
  • Selecting duplicate with duplicate_of creates the native duplicate relationship and preserves suggest, rationale, and confidence through the issue-intent path.
  • Tests cover omitted, scalar, and list configuration; tool-argument omission; invalid choices; and duplicate intent persistence.

Rationale

A general triage workflow may legitimately complete an issue, close it as not planned, or mark it as a duplicate. Omitting configuration should enable those supported choices, while scalar and list forms let authors narrow behavior when needed without breaking existing workflows.

Confidence

High. This is a focused schema/configuration capability with explicit backward-compatible behavior.

Related but distinct: #27265 fixed acceptance of a single state-reason value; this request adds runtime selection and defined behavior when configuration is omitted.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions