Repository navigation
[Safe Outputs Conformance] REQ-002: Complete add_labels and remove_labels specification sections - #77677
Conversation
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
🟡 Changes recommended
The specification contains an unresolved security-critical fail-open parsing discrepancy plus additional documented behavior mismatches for validation ordering, 404 handling, and label limits.
4 open issues
What changed in this PR
This documentation-only PR completes the safe-output specification coverage for add_labels and remove_labels, aligning their documented schemas, operational behavior, configuration, permissions, security requirements, and target authorization with the handlers.
Changes:
- Added MCP schemas and handler-derived operational semantics for both label operations.
- Documented configuration, filtering, staged execution, intent metadata, label creation/removal, and security requirements.
- Corrected the documented default operation limit from 3 to 5 for both types.
| File | Description |
|---|---|
| docs/src/content/docs/specs/safe-outputs-specification.md | Completes the add_labels and remove_labels specification sections with schemas, behavior, configuration, permissions, target authorization, and security documentation. |
Review effort: Lite (dynamic)
| **Security Requirements**: | ||
|
|
||
| - Label names MUST undergo sanitization and be validated against `allowed` and `blocked` before any API call | ||
| - Cross-repository targets MUST be validated against the `allowed-repos` allowlist | ||
| - The target MUST be selected only according to the Target Authorization rules, enforced at runtime |
| 4. **Validation**: Labels are sanitized, de-duplicated, and checked against `allowed` and `blocked`; the number of labels MUST NOT exceed the configured `max`. The item succeeds with no labels removed when none remain valid. | ||
| 5. **Staged Mode**: In staged mode the handler previews the labels it would remove and performs no mutation. | ||
| 6. **Per-Label Removal**: Labels are removed one at a time because the GitHub API has no bulk-removal endpoint. | ||
| 7. **Missing Labels**: A label that is not present on the target (HTTP 404 or "Label does not exist") is skipped silently and is not a failure. |
|
|
||
| **Security Requirements**: | ||
|
|
||
| - Label names MUST undergo sanitization and be validated against `allowed` and `blocked` before any API call |
| 1. **Target Resolution**: The target issue or pull request is resolved per the Target Authorization rules below. When no item number can be resolved, the item fails without calling the GitHub API. | ||
| 2. **Filter Evaluation**: When `required-labels` or `required-title-prefix` is configured, the handler MUST fetch the target and skip the operation if the target lacks any required label or its title does not start with the required prefix. | ||
| 3. **Empty Input**: An empty `labels` list fails the item with a message listing the allowed labels when an allowlist is configured. | ||
| 4. **Validation**: Labels are sanitized, de-duplicated, and checked against `allowed` and `blocked`; the number of labels MUST NOT exceed the configured `max`. The item succeeds with no labels removed when none remain valid. |
There was a problem hiding this comment.
Reviewed head d18ddc1 against the Safe Outputs Specification (sections 7.0.3, add_labels AL-001–AL-005, remove_labels RML-001–RML-005).
Blocking findings:
- The add_labels MCP schema omits the functional repo field despite compiled schema/handler support and advertised cross-repository support. With additionalProperties=false, the contract is inaccurate.
- The new add_labels security requirement says label validation occurs before any API call, but the handler fetches the target for required-label/title filters before validation.
No specification synchronization was applied; the documented contract must be corrected or implementation evidence/changes supplied.
Generated by PR Specification Reviewer for #77677 · copilot · gpt50 · ~5 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review-specs to run again
| }, | ||
| "description": "Labels to add. Each entry is a label name string or an object with a name plus optional issue-intent metadata." | ||
| }, | ||
| "item_number": { |
There was a problem hiding this comment.
REQUEST_CHANGES: The documented MCP schema omits the repo property that is accepted by the compiled add_labels tool schema and by the handler (AddLabelsMessage.repo). Because additionalProperties is false, this specification would incorrectly declare cross-repository requests invalid while the same section advertises cross-repository support. Please include repo (with its owner/repo description and allowlist behavior) in this schema; the provenance note does not cover functional fields.
|
|
||
| **Security Requirements**: | ||
|
|
||
| - Label names MUST undergo sanitization and be validated against `allowed` and `blocked` before any API call |
There was a problem hiding this comment.
REQUEST_CHANGES: This new MUST is stronger than the implemented behavior and is not met: when required-labels or required-title-prefix is configured, add_labels.cjs fetches the target via issues.get before it calls validateLabels and checks allowed/blocked (the filter block precedes validation). Either change the contract to require validation before mutation/API writes, or provide implementation evidence that no API call occurs until label validation completes; do not document an unmet security guarantee as conformance.
Comment MemoryPeek at saved memory (spec-review-history)History |
|
🎉 This pull request is included in a new release. Release: |



Conformance Check Failure
Check ID: REQ-002
Severity: MEDIUM
Category: Specification
Problem Description
scripts/check-safe-outputs-conformance.shreports REQ-002 failures for 27 safe output types whose specification sections lack required subsections. This PR addressesadd_labelsandremove_labels(each had 1/5 sections), which share target-authorization rules and handler structure. The other 25 types are left for separate PRs so each can be checked against its own handler.Affected Components
docs/src/content/docs/specs/safe-outputs-specification.mdactions/setup/js/add_labels.cjs,actions/setup/js/remove_labels.cjs,pkg/workflow/add_labels.go,pkg/workflow/remove_labels.go,pkg/workflow/js/safe_outputs_tools.json🔍 Current vs Expected Behavior
Current Behavior
Both type sections had only Required Permissions (plus notes and target authorization rules). They lacked MCP Tool Schema, Operational Semantics, Configuration Parameters and Security Requirements.
Expected Behavior
Each type documents all five sections, derived from the implementation.
Remediation Steps
safe_outputs_tools.json.required-labels/required-title-prefixfilters,max-labels, validation, staged mode,create-if-missing, issue-intent GraphQL path and PR fallback, per-label removal with 404 tolerance, and partial failure reporting.DefaultMax: 5/defaultMaxAddLabelsCalls = 5in the code.Verification
Validation actually run (documentation-only change, so Go/JS tests were not run):
add_labels1/5 andremove_labels1/5).update_pull_request,close_pull_request,assign_to_user,create_project). Those are not addressed here.References
🤖 Generated with [Claude Code]((claude.com/redacted)