Add failure category filtering to report-failure-as-issue#39721
Conversation
- Added ReportFailureAsIssueConfig struct to support categories filter - Updated SafeOutputsConfig to accept both bool and object format - Modified parsing logic to handle both legacy bool and new categories filter - Updated notify_comment.go to pass categories as JSON to JavaScript - Added filtering logic in handle_agent_failure.cjs to check categories - Added tests for parsing and category matching - Updated documentation with examples and category reference table Closes #38565 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Updated main_workflow_schema.json to support both boolean and object with categories - Added example workflow demonstrating category filtering - Compiled example workflow successfully - All categories now properly validated by schema Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Added category filtering syntax and examples to glossary - Documented common failure categories - Linked to full safe-outputs reference Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot make it simpler and remove "categories" field, support list of categories directly. |
…r field
Remove the `categories` wrapper field from report-failure-as-issue configuration,
supporting direct array syntax for cleaner workflow definitions.
Before:
```yaml
report-failure-as-issue:
categories:
- agent_failure
- missing_safe_outputs
```
After:
```yaml
report-failure-as-issue:
- agent_failure
- missing_safe_outputs
```
Changes:
- Schema: Changed oneOf to support boolean OR array of strings (removed object type)
- Go: Removed ReportFailureAsIssueConfig struct, simplified to ReportFailureAsIssueCategories []string
- Parsing: Updated safe_outputs_config.go to parse arrays directly
- Runtime: Updated notify_comment.go to serialize categories from simplified field
- Tests: Updated to test array format instead of object format
- Docs: Updated safe-outputs.md and glossary.md with simpler syntax
- Example: Updated example-failure-category-filter.md to use array syntax
Backward compatibility maintained: boolean true/false values still work.
JavaScript runtime unchanged (already compatible with JSON array env var).
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done! The syntax is now simpler - categories are specified as a direct array instead of being wrapped in a New syntax: report-failure-as-issue:
- agent_failure
- missing_safe_outputsChanges in commit 9d89014:
|
- Preserve original value type in ReportFailureAsIssue for proper YAML serialization
- Clarify comment to specify []interface{} at YAML parsing level vs []string conversion
- Update comment to reflect actual YAML parsing behavior ([]any -> []string)
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot add syntax to define excluded categories |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done! Added exclusion syntax using "!" prefix. New syntax supports three modes:
report-failure-as-issue:
- agent_failure
- missing_safe_outputs
report-failure-as-issue:
- "!inference_access_error"
- "!ai_credits_rate_limit_error"
report-failure-as-issue:
- agent_failure
- "!unknown_model_ai_credits"Changes in commit 580082d:
|
There was a problem hiding this comment.
Pull request overview
This PR extends the safe-outputs.report-failure-as-issue setting to support category-based filtering (include-only, exclude-only via !prefix, and mixed include+exclude), reducing noise from transient/infrastructure failures while preserving actionable failure signals.
Changes:
- Added parsing and internal representation for category include/exclude filters (Go), and passed them to the runtime via new env vars.
- Implemented include/exclude/mixed filtering logic in the failure-handler runtime (JS).
- Updated schema + docs + example workflow to describe and demonstrate the new syntax.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/safe_outputs_config.go | Parses report-failure-as-issue as either boolean or category list, splitting included vs excluded categories. |
| pkg/workflow/notify_comment.go | Emits GH_AW_FAILURE_*_CATEGORIES_FILTER env vars for the failure handler based on parsed config. |
| pkg/workflow/compiler_types.go | Updates SafeOutputsConfig to store union-typed ReportFailureAsIssue and parsed include/exclude slices. |
| pkg/workflow/compiler_safe_outputs_config_test.go | Adds tests for boolean + included-category parsing (but currently lacks exclusion/mixed coverage). |
| pkg/parser/schemas/main_workflow_schema.json | Allows boolean or array for report-failure-as-issue with regex validation for known categories + optional !. |
| docs/src/content/docs/reference/safe-outputs.md | Documents boolean opt-out and the new include/exclude/mixed filtering modes with examples. |
| docs/src/content/docs/reference/glossary.md | Updates glossary entry to describe the new filtering syntax and semantics. |
| actions/setup/js/handle_agent_failure.cjs | Parses filter env vars and applies include/exclude/mixed logic to decide whether to create failure issues. |
| actions/setup/js/handle_agent_failure.test.cjs | Adds tests for failure-category generation (but currently doesn’t assert the new filter behavior). |
| .github/workflows/example-failure-category-filter.md | Adds an example workflow showing include-only, exclude-only, and mixed configuration. |
| .github/workflows/example-failure-category-filter.lock.yml | Generated compiled workflow reflecting the new configuration and env vars. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 11/11 changed files
- Comments generated: 3
| tests := []struct { | ||
| name string | ||
| reportValue any | ||
| expectBool *bool | ||
| expectCategories []string | ||
| }{ |
| }); | ||
| }); | ||
|
|
||
| describe("failure categories filter", () => { |
| describe("failure categories filter", () => { | ||
| let buildFailureMatchCategories; | ||
|
|
||
| beforeEach(() => { | ||
| vi.resetModules(); | ||
| ({ buildFailureMatchCategories } = require("./handle_agent_failure.cjs")); | ||
| }); |
|
🔎 PR Code Quality Reviewer is reviewing code quality for this pull request... |
|
🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills... |
|
🔬 Test Quality Sentinel is analyzing test quality on this pull request... |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. |
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (>100 new lines across Go config parsing and the JS failure-handling runtime) but does not have a linked Architecture Decision Record (ADR).
📄 Draft ADR-39721 (copy into
|
|
@copilot run pr-finisher skill |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Ran the pr-finisher pass and applied follow-up fixes in This includes:
|
report-failure-as-issuecurrently triggers on any workflow failure, including transient infrastructure errors (Docker registry timeouts, AI server 5xx, MCP image pulls). This forces scheduled workflows to choose between noise (opt-in) or losing actionable failure signals (opt-out withfalse).Changes
Syntax extension (backward compatible):
report-failure-as-issuenow accepts array of category strings in addition to boolean!to exclude them from issue creationBackend (Go):
SafeOutputsConfig.ReportFailureAsIssuefrom*booltoanyReportFailureAsIssueCategories []stringfield for parsed included categoriesReportFailureAsIssueExcludedCategories []stringfield for parsed excluded categoriessafe_outputs_config.gousingstrings.CutPrefixto detect "!" prefixGH_AW_FAILURE_CATEGORIES_FILTERenv varGH_AW_FAILURE_EXCLUDED_CATEGORIES_FILTERenv varRuntime (JavaScript):
handle_agent_failure.cjsSchema:
main_workflow_schema.jsonwithoneOfsupporting both boolean and arrayDocumentation:
Usage
Include-only (only these categories trigger issues):
Exclude-only (all except these trigger issues):
Mixed (must match included AND not match excluded):
Suppresses transient infra noise while preserving actionable failure signals for scheduled workflows.