Summary
The close-issue safe output documentation shows state-reason as a valid configuration field:
safe-outputs:
close-issue:
target: "triggering"
state-reason: "duplicate" # completed (default), not_planned, duplicate
However, the compiler rejects it:
error: Unknown property: state-reason. Valid fields are: allowed-repos, max, required-labels, required-title-prefix, staged, target, target-repo
Root Cause
The JSON schema at pkg/parser/schemas/main_workflow_schema.json is missing state-reason from the close-issue properties, but the field is fully wired up in the Go code:
- Go struct:
CloseEntityConfig.StateReason has a proper yaml:"state-reason" tag (pkg/workflow/close_entity_helpers.go line 72)
- Handler emission:
compiler_safe_outputs_handlers.go line 81 emits state_reason into the handler config JSON via AddIfNotEmpty("state_reason", c.StateReason)
- JSON schema: Missing
state-reason → schema validation with additionalProperties: false rejects it before parsing
Suggested Fix
Add state-reason to the close-issue properties in pkg/parser/schemas/main_workflow_schema.json:
"state-reason": {
"type": "string",
"enum": ["completed", "not_planned", "duplicate"],
"description": "Reason for closing the issue (default: completed)"
}
Reproduction
---
on:
issues:
types: [opened]
permissions: read-all
engine:
id: copilot
safe-outputs:
close-issue:
target: "triggering"
state-reason: "completed"
---
Close this issue.
Run gh aw compile → error on state-reason.
Note
close-discussion does NOT have the same issue — its resolution reasons (RESOLVED, DUPLICATE, etc.) are correctly documented as runtime agent output fields, not frontmatter config.
Summary
The
close-issuesafe output documentation showsstate-reasonas a valid configuration field:However, the compiler rejects it:
Root Cause
The JSON schema at
pkg/parser/schemas/main_workflow_schema.jsonis missingstate-reasonfrom theclose-issueproperties, but the field is fully wired up in the Go code:CloseEntityConfig.StateReasonhas a properyaml:"state-reason"tag (pkg/workflow/close_entity_helpers.goline 72)compiler_safe_outputs_handlers.goline 81 emitsstate_reasoninto the handler config JSON viaAddIfNotEmpty("state_reason", c.StateReason)state-reason→ schema validation withadditionalProperties: falserejects it before parsingSuggested Fix
Add
state-reasonto theclose-issueproperties inpkg/parser/schemas/main_workflow_schema.json:Reproduction
Run
gh aw compile→ error onstate-reason.Note
close-discussiondoes NOT have the same issue — its resolution reasons (RESOLVED, DUPLICATE, etc.) are correctly documented as runtime agent output fields, not frontmatter config.