Skip to content

Add body-allowed: false to close-discussion and close-issue safe-outputs#33639

Merged
pelikhan merged 8 commits into
mainfrom
copilot/add-body-allowed-false-to-safe-outputs
May 21, 2026
Merged

Add body-allowed: false to close-discussion and close-issue safe-outputs#33639
pelikhan merged 8 commits into
mainfrom
copilot/add-body-allowed-false-to-safe-outputs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 20, 2026

Without a declarative knob to suppress the closing comment, workflows that post a summary via add-comment and then close cleanly can't prevent the agent from duplicating that comment in the body field of the close operation — prompts alone can't guarantee this.

Changes

  • New config fieldBodyAllowed *bool added to CloseEntityConfig (shared by close-issue and close-discussion). When false:
    • Any non-empty body the agent emits is dropped with a warning and the resource is closed without posting a comment
    • body is removed from the MCP tool's required array at compile time (via new RequiredFieldRemovals field in ToolsMeta)
    • A constraint is appended to the MCP tool description: "Closing comments are disabled: do not include a body field."
  • Gocompiler_safe_outputs_handlers.go passes body_allowed into the handler config; tool_description_enhancer.go emits the constraint text; safe_outputs_tools_generation.go adds computeRequiredFieldRemovals() and populates ToolsMeta.RequiredFieldRemovals; validation config makes body optional for both close types
  • JSclose_entity_helpers.cjs and close_discussion.cjs read config.body_allowed; when false, skip comment posting entirely; generate_safe_outputs_tools.cjs applies required_field_removals from tools_meta
  • Types"body-allowed"?: boolean added to CloseDiscussionConfig and CloseIssueConfig in safe-outputs-config.d.ts
  • Docssafe-outputs.md and safe-outputs-specification.md updated with the new field

Example

safe-outputs:
  add-comment:
    max: 1
  close-discussion:
    max: 1
    body-allowed: false   # close cleanly; drop any body the agent emits
  close-issue:
    max: 1
    body-allowed: false

pr-sous-chef: requesting branch update — run: https://github.com/github/gh-aw/actions/runs/26197534576

Generated by 👨‍🍳 PR Sous Chef · ● 130.9K ·

Copilot AI and others added 2 commits May 20, 2026 21:44
…fe-outputs

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add body-allowed option to close-discussion and close-issue Add body-allowed: false to close-discussion and close-issue safe-outputs May 20, 2026
Copilot AI requested a review from pelikhan May 20, 2026 21:59
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot terminology is allowed-body to match other fields

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 20, 2026

@copilot terminology is allowed-body to match other fields

Renamed throughout in commit Rename body-allowed to allowed-body to match field naming convention — covers the YAML field (allowed-body), Go struct (AllowedBody), and all snake/camel variants in Go/JS.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot rename allowed-body to allow-body

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 20, 2026

@copilot rename allowed-body to allow-body

Done in the latest commit — allow-body across YAML, Go (AllowBody), and JS (allow_body / allowBody).

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot update safe outputs specification using w3c-spec-writer

…ussion

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 20, 2026

@copilot update safe outputs specification using w3c-spec-writer

Done in commit 824dd86. For both close_issue and close_discussion sections the spec now has:

  • A blockquote note on the MCP Tool Schema explaining the compile-time required array and description changes
  • A new Body Suppression item in Operational Semantics with MUST/SHALL normative language
  • The allow-body Configuration Parameters entry rewritten in full normative form (MUST/SHALL, with explicit default)

@pelikhan pelikhan marked this pull request as ready for review May 20, 2026 23:54
Copilot AI review requested due to automatic review settings May 20, 2026 23:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an allow-body configuration knob for close-issue / close-discussion safe-outputs so workflows can close items without posting (or duplicating) a closing comment, while also adjusting generated tool schemas/metadata and documentation.

Changes:

  • Introduces allow-body (AllowBody / allow_body) config and propagates it through compiler handler configs and tool description constraints.
  • Adds tools_meta.required_field_removals and updates JS tool generation to remove body from inputSchema.required when configured.
  • Updates JS close handlers/tests plus docs/types; regenerates many workflow lockfiles accordingly.
Show a summary per file
File Description
pkg/workflow/tool_description_enhancer.go Appends a “no body” constraint to close tool descriptions when configured.
pkg/workflow/tool_description_enhancer_test.go Adds coverage for the new close description constraint behavior.
pkg/workflow/safe_outputs_validation_config.go Makes body optional in validation config for close issue/discussion.
pkg/workflow/safe_outputs_tools_generation.go Adds ToolsMeta.required_field_removals and computes removals for close tools.
pkg/workflow/safe_outputs_tools_generation_test.go Tests required-field removal computation.
pkg/workflow/compiler_safe_outputs_handlers.go Passes allow_body into handler configs for close issue/discussion.
pkg/workflow/close_entity_helpers.go Adds AllowBody to shared close config struct (YAML: allow-body).
docs/src/content/docs/reference/safe-outputs.md Documents allow-body: false for close issue/discussion.
docs/src/content/docs/reference/safe-outputs-specification.md Updates spec semantics and compile-time schema expectations for allow-body.
actions/setup/js/types/safe-outputs-config.d.ts Adds allow-body to TS config types for close issue/discussion.
actions/setup/js/generate_safe_outputs_tools.cjs Applies required_field_removals to generated tool schemas.
actions/setup/js/close_issue.test.cjs Adds tests for allow_body: false behavior for close_issue.
actions/setup/js/close_entity_helpers.cjs Implements comment suppression/dropping behavior when allow_body is false.
actions/setup/js/close_discussion.test.cjs Adds tests for allow_body: false behavior for close_discussion.
actions/setup/js/close_discussion.cjs Implements comment suppression when allow_body is false (discussion close path).
.github/workflows/workflow-skill-extractor.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/weekly-issue-summary.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/uk-ai-operational-resilience.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/typist.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/terminal-stylist.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/stale-repo-identifier.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/smoke-copilot.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/smoke-copilot-arm.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/sergo.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/semantic-function-refactor.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/schema-consistency-checker.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/safe-output-health.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/research.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/repository-quality-improver.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/repo-tree-map.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/repo-audit-analyzer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/python-data-charts.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/prompt-clustering-analysis.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/pr-nitpick-reviewer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/poem-bot.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/plan.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/pdf-summary.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/org-health-report.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/mcp-inspector.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/lockfile-stats.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/lint-monster.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/issue-arborist.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/github-remote-mcp-auth-test.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/github-mcp-tools-report.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/github-mcp-structural-analysis.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/firewall-escape.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/example-workflow-analyzer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/docs-noob-tester.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/developer-docs-consolidator.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/dependabot-go-checker.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/delight.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/deep-report.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-token-consumption-report.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-team-status.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-team-evolution-insights.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-syntax-error-quality.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-sentrux-report.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-security-red-team.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-security-observability.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-secrets-analysis.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-safe-outputs-conformance.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-safe-output-optimizer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-safe-output-integrator.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-repo-chronicle.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-rendering-scripts-verifier.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-regulatory.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-performance-summary.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-otel-instrumentation-advisor.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-observability-report.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-news.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-multi-device-docs-tester.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-mcp-concurrency-analysis.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-malicious-code-scan.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-issues-report.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-hippo-learn.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-grafana-otel-instrumentation-advisor.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-geo-optimizer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-function-namer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-firewall-report.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-experiment-report.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-doc-healer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-compiler-threat-spec-optimizer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-compiler-quality.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-code-metrics.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-cli-tools-tester.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-cli-performance.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-cache-strategy-analyzer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-architecture-diagram.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/daily-agentrx-trace-optimizer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/copilot-session-insights.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/copilot-pr-prompt-analysis.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/copilot-pr-nlp-analysis.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/copilot-pr-merged-report.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/copilot-cli-deep-research.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/copilot-agent-analysis.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/constraint-solving-potd.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/commit-changes-analyzer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/claude-code-user-docs-review.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/blog-auditor.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/auto-triage-issues.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/audit-workflows.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/artifacts-summary.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/api-consumption-report.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/agent-persona-explorer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.
.github/workflows/agent-performance-analyzer.lock.yml Regenerated lockfile reflecting updated validation/tool metadata.

Copilot's findings

Tip

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

Comments suppressed due to low confidence (1)

actions/setup/js/close_discussion.cjs:298

  • When allow_body is true (default), this handler will still close the discussion even if item.body is missing/empty, resulting in a close without the expected explanatory comment. Consider returning an error unless allow-body: false is configured, to preserve the existing contract that close_discussion normally posts a comment.
  • Files reviewed: 104/105 changed files
  • Comments generated: 3

Comment on lines 85 to 87
StateReason string `yaml:"state-reason,omitempty"` // Only used for issues
AllowBody *bool `yaml:"allow-body,omitempty"` // If false, any body provided by the agent is dropped with a warning; close proceeds without a comment
}
Comment on lines +248 to +269

**State Reasons**: `completed`, `not_planned`, `duplicate` (default: `completed`). Can also be set per-item in agent output.

**`allow-body: false`**: When set, any `body` field the agent provides is silently dropped (with a warning logged) and the issue is closed without posting a comment. Use this when you want to guarantee a clean close with no duplicate comment — for example, when a prior `add-comment` step already posted the summary.
Comment on lines 266 to +270

**State Reasons**: `completed`, `not_planned`, `duplicate` (default: `completed`). Can also be set per-item in agent output.

**`allow-body: false`**: When set, any `body` field the agent provides is silently dropped (with a warning logged) and the issue is closed without posting a comment. Use this when you want to guarantee a clean close with no duplicate comment — for example, when a prior `add-comment` step already posted the summary.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot review all comments

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot review all comments

Addressed in the latest commit:

  • Struct alignment: ran gofmt on close_entity_helpers.goAllowBody field is now properly tab-aligned with the rest of the struct.
  • Naming mismatch: the PR title/description is historical; all code, docs, and spec already consistently use allow-body / AllowBody / allow_body.
  • Contradictory phrasing: fixed "silently dropped (with a warning logged)" → "dropped (a warning is logged)" in both the close-issue and close-discussion sections of safe-outputs.md.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile, fix conflicts

@github-actions
Copy link
Copy Markdown
Contributor

``

@copilot review all comments

Please update the branch to resolve merge conflicts (mergeStateStatus: DIRTY). After addressing review feedback, run tests locally and push any fixes.

Generated by 👨‍🍳 PR Sous Chef · ● 130.9K ·

…wed-false-to-safe-outputs

# Conflicts:
#	.github/workflows/daily-cache-strategy-analyzer.lock.yml
#	.github/workflows/daily-observability-report.lock.yml
#	.github/workflows/issue-arborist.lock.yml

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot merge main and recompile, fix conflicts

Done — merged origin/main, resolved the three lock-file heredoc-hash conflicts by taking the main versions, then ran make build && ./gh-aw compile --validate --verbose --purge --stats to regenerate all 233 lock files with both main's and this PR's changes applied.

@pelikhan pelikhan merged commit a96c62f into main May 21, 2026
@pelikhan pelikhan deleted the copilot/add-body-allowed-false-to-safe-outputs branch May 21, 2026 00:44
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.

Add body-allowed: false (or equivalent) to close-discussion and close-issue safe-outputs

3 participants