Skip to content

fix: restore label validation to prevent gh issue create failures - #1346

Merged
atxtechbro merged 1 commit into
mainfrom
1342-fix-label-validation-in-issue-creation
Oct 9, 2025
Merged

fix: restore label validation to prevent gh issue create failures#1346
atxtechbro merged 1 commit into
mainfrom
1342-fix-label-validation-in-issue-creation

Conversation

@atxtechbro

Copy link
Copy Markdown
Owner

Summary

  • Restores defensive label validation removed in commit 9fd1b3a
  • Prevents gh issue create failures when non-existent labels are applied
  • Follows the same pattern already working in issue-triage.md

Problem

Issue #1342 reported that when creating GitHub issues with the gh CLI, if a label doesn't exist, the entire gh issue create command fails. This forces the user to restart the entire issue creation process, wasting time and tokens.

Solution

Added explicit validation steps to knowledge/procedures/issue-creation-procedure.md:

  1. Step 4: Fetch Available Labels - Run gh label list first
  2. Step 5: Select Labels - Cross-check selections against fetched list
  3. Validation note - Only apply labels that exist

The fix is minimal (following the issue's request for "1 line should suffice") while being explicit enough to prevent the failure mode.

Implementation Details

  • Renumbered steps 4-7 to 4-8 to accommodate new validation step
  • Added CRITICAL callout explaining the failure mode
  • Follows same pattern as .github/workflow-prompts/issue-triage.md:19

Test Plan

  • Reviewed diff to ensure only procedure changes
  • Confirmed step numbering is sequential
  • Verified alignment with issue-triage workflow pattern

Principles Applied

  • tracer-bullets: Get it working first (minimal defensive fix)
  • subtraction-creates-value: Minimal addition, maximum impact
  • systems-stewardship: Maintains single source of truth

Closes #1342

Closes #1342

When creating GitHub issues with gh CLI, attempting to apply a
non-existent label causes the entire command to fail, wasting cycles
and tokens.

This restores defensive label validation that was removed in commit
9fd1b3a. The procedure now:

1. Explicitly instructs to fetch available labels via `gh label list`
2. Cross-checks selected labels against the fetched list
3. Only applies labels that exist in the repository

This follows the same pattern already working in
.github/workflow-prompts/issue-triage.md (line 19).

Principle: tracer-bullets (get it working first)
Principle: subtraction-creates-value (minimal fix, 1-2 lines per issue)
@amazon-q-developer

Copy link
Copy Markdown
Contributor

Code review in progress. Analyzing for code quality issues and best practices. Detailed findings will be posted upon completion.

Using Amazon Q Developer for GitHub

Amazon Q Developer1 is an AI-powered assistant that integrates directly into your GitHub workflow, enhancing your development process with intelligent features for code development, review, and transformation.

Slash Commands

Command Description
/q <message> Chat with the agent to ask questions or request revisions
/q review Requests an Amazon Q powered code review
/q help Displays usage information

Features

Agentic Chat
Enables interactive conversation with Amazon Q to ask questions about the pull request or request specific revisions. Use /q <message> in comment threads or the review body to engage with the agent directly.

Code Review
Analyzes pull requests for code quality, potential issues, and security concerns. Provides feedback and suggested fixes. Automatically triggered on new or reopened PRs (can be disabled for AWS registered installations), or manually with /q review slash command in a comment.

Customization

You can create project-specific rules for Amazon Q Developer to follow:

  1. Create a .amazonq/rules folder in your project root.
  2. Add Markdown files in this folder to define rules (e.g., cdk-rules.md).
  3. Write detailed prompts in these files, such as coding standards or best practices.
  4. Amazon Q Developer will automatically use these rules when generating code or providing assistance.

Example rule:

All Amazon S3 buckets must have encryption enabled, enforce SSL, and block public access.
All Amazon DynamoDB Streams tables must have encryption enabled.
All Amazon SNS topics must have encryption enabled and enforce SSL.
All Amazon SNS queues must enforce SSL.

Feedback

To provide feedback on Amazon Q Developer, create an issue in the Amazon Q Developer public repository.

For more detailed information, visit the Amazon Q for GitHub documentation.

Footnotes

  1. Amazon Q Developer uses generative AI. You may need to verify generated code before using it in your environment. See the AWS Responsible AI Policy.

@atxtechbro
atxtechbro merged commit ff76c3b into main Oct 9, 2025

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review Summary

This PR successfully addresses issue #1342 by implementing defensive label validation to prevent gh issue create failures. The solution is well-executed and follows established patterns from the codebase.

Strengths

  • Problem-focused solution: Directly addresses the reported failure mode with minimal, targeted changes
  • Consistency: Follows the same validation pattern already established in issue-triage.md
  • Clear documentation: The CRITICAL callout effectively communicates the importance of validation
  • Proper maintenance: Sequential step renumbering maintains logical flow

Key Improvements Made

  • Added explicit label fetching step (gh label list)
  • Implemented cross-validation between selected and available labels
  • Maintained procedural integrity with proper step numbering
  • Added clear warnings about failure consequences

Minor Considerations

  • Consider making the gh label list command more explicit with repository parameters for broader applicability
  • The validation process could potentially be streamlined in future iterations

The implementation aligns well with the stated principles of tracer-bullets (get it working first) and subtraction-creates-value (minimal addition, maximum impact). This is a solid defensive fix that will prevent user frustration and wasted time.

Recommendation: Approve and merge. The changes are minimal, well-documented, and directly solve the reported problem.

From the **Available Labels** section above, select appropriate labels based on:
Before selecting labels, run `gh label list` to get the list of labels that actually exist in the repository.

**CRITICAL**: Only labels from this list can be applied. Using a non-existent label will cause `gh issue create` to fail.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The addition of explicit label validation is a solid defensive programming practice that addresses the reported failure mode. The solution follows the established pattern from issue-triage.md and maintains consistency across the codebase. The CRITICAL callout effectively communicates the importance of this validation step to users.

## Step 4: Fetch Available Labels

From the **Available Labels** section above, select appropriate labels based on:
Before selecting labels, run `gh label list` to get the list of labels that actually exist in the repository.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider making the command more explicit by including the repository parameter to ensure consistency across different repositories. This would prevent potential issues when the procedure is used in contexts where the current directory might not be the target repository.


## Step 5: Build Issue Content
**Validation**: Cross-check each selected label against the list from Step 4. Only include labels that exist.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The validation note is well-placed and provides clear guidance. However, consider adding a brief example of what happens when validation fails to make the consequences more concrete for users who might skip this step.

**Validation**: Cross-check each selected label against the list from Step 4. Only include labels that exist.

## Step 6: Build Issue Content

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Excellent step renumbering consistency. All subsequent steps have been properly updated to maintain sequential numbering, which preserves the logical flow of the procedure.

- "rapid", "quick test" → tracer-bullets
- "accumulate", "compound" → snowball-method

## Step 4: Select Labels

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The original step structure was clean and direct. While the new validation steps are necessary for preventing failures, consider if there's a way to make this validation more seamless or automated rather than requiring manual cross-checking.

@atxtechbro
atxtechbro deleted the 1342-fix-label-validation-in-issue-creation branch October 10, 2025 08:30
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.

Bug: Stop Optimistically Assuming a Github issuel label exists when creating one with gh cli

1 participant