Document safe output patterns and multi-output workflow design #13005
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
74.8% of workflows (110/147) use multiple safe output types, but selection criteria and composition patterns were undocumented, leading to inconsistent output strategies and suboptimal routing decisions.
Changes
Core Documentation
docs/safe-outputs-guide.md- Decision tree, 4 workflow patterns, best practicesExample Workflows
docs/examples/safe-outputs/- 4 complete patterns with decision logicconditional-output.md- Security scanning with CVSS-based routingmulti-output-analysis.md- Code quality with discussion + child issuesfix-or-report.md- Dependency updates with automated/manual pathscomment-pattern.md- CI status with escalation thresholdsTechnical Reference
scratchpad/safe-outputs-patterns.md- Implementation detailsIntegration
AGENTS.md- Added "Safe Outputs Best Practices" section with quick decision guidescratchpad/README.md- Cross-reference to new documentationPattern Example
Decision logic: Critical findings → individual issues for tracking; all findings → discussion for audit; PR → comment with summary and links.
Statistics Referenced
Analysis of 147 production workflows:
create-issuecreate-discussioncreate-pull-requestOriginal prompt
This section details on the original issue you should resolve
<issue_title>[Code Quality] Document safe output patterns and multi-output workflow design best practices</issue_title>
<issue_description>## Description
74.8% of agentic workflows (110 out of 147) support multiple safe output types (issues, discussions, pull requests, comments). However, there's no documented guidance on when to use each output type or how to design multi-output workflows effectively.
Current State
Safe Output Usage (from Lock File Statistics #12946):
create-issuecreate-discussioncreate-pull-requestadd-commentupdate-issueMulti-Output Workflows: 110 workflows (74.8%) support 2+ output types
Problem
Without clear documentation, developers must:
This leads to:
Suggested Documentation
1. Safe Output Decision Tree
Create a decision tree for output type selection:
2. Multi-Output Workflow Patterns
Document patterns for workflows that produce multiple outputs:
Pattern 1: Conditional Outputs
Pattern 2: Hierarchical Outputs
Pattern 3: Fix-or-Report
3. Best Practices Guide
4. Examples Repository
Create
/docs/examples/safe-outputs/with:conditional-output.md- Workflow that chooses output type dynamicallymulti-output-analysis.md- Workflow creating discussion + issuesfix-or-report.md- Workflow attempting PR, falling back to issuecomment-pattern.md- Workflow adding comments to trigger sourceFiles to Create
docs/safe-outputs-guide.md- Main decision tree and patternsdocs/examples/safe-outputs/- Example workflow directoryAGENTS.md- Add "Safe Outputs Best Practices" sectionscratchpad/safe-outputs-patterns.md- Deep-dive technical guideSuccess Criteria
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.