Skip to content

t295: Issue-sync label passthrough — replace hardcoded allowlist with on-the-fly label creation#1155

Closed
marcusquinn wants to merge 1 commit intomainfrom
feature/t295
Closed

t295: Issue-sync label passthrough — replace hardcoded allowlist with on-the-fly label creation#1155
marcusquinn wants to merge 1 commit intomainfrom
feature/t295

Conversation

@marcusquinn
Copy link
Owner

Summary

Implements label passthrough for issue-sync to eliminate the hardcoded tag-to-label allowlist (~20 tags) and instead create labels on-the-fly via gh label create --force.

Changes

1. New create_label_if_needed() function

  • Creates labels on GitHub using gh label create --force
  • Assigns consistent colors based on label name hash
  • Idempotent: safe to call multiple times

2. Updated map_tags_to_labels() function

  • Now accepts optional repo_slug parameter
  • Removed hardcoded case statement with ~20 allowlisted tags
  • Implements passthrough: all tags become labels
  • Creates labels during issue creation when repo_slug is provided

3. Enhanced cmd_enrich() function

  • Extracts tags from TODO.md task lines
  • Syncs labels to existing GitHub issues
  • Creates missing labels on-the-fly
  • Maintains status labels (status:available, status:claimed)

Benefits

  • No more silent drops: Tags like #auto-dispatch, #supervisor, #shell, #ci, #memory, #release, #reliability, #automation, etc. are now preserved as labels
  • Automatic label creation: Labels are created on-the-fly as needed
  • Consistent colors: Labels get deterministic colors based on their names
  • Backward compatible: Existing allowlisted tags still work
  • Label sync: Existing issues get updated with new labels from TODO.md

Testing

  • ✓ Shellcheck: zero violations
  • ✓ Bash syntax: valid
  • ✓ Unit tests: all tag passthrough scenarios pass
    • Empty tags
    • Single tag passthrough
    • Multiple tags (including previously dropped ones)
    • Tag prefix stripping
    • Deduplication

Related Issues

Ref #295

- Replace hardcoded tag-to-label allowlist with passthrough that creates labels on-the-fly
- Add create_label_if_needed() function using gh label create --force
- Update map_tags_to_labels() to accept repo_slug and create labels during issue creation
- Add label sync to cmd_enrich() to update existing issues with new labels from TODO.md tags
- All tags now become labels instead of silently dropping unknown ones
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 54 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/t295

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the issue synchronization process by transitioning from a restrictive, hardcoded tag-to-label mapping to a flexible, on-the-fly label creation system. This change ensures that all tags from TODO.md are accurately reflected as labels on GitHub issues, preventing silent drops of important metadata. It also introduces automatic label creation with consistent coloring and improves the synchronization of labels for existing issues, making the system more robust and user-friendly.

Highlights

  • Label Passthrough Implementation: Replaced the hardcoded allowlist for mapping TODO.md tags to GitHub labels with an on-the-fly label creation mechanism, ensuring all tags are preserved as labels.
  • New create_label_if_needed() Function: Introduced a new shell function that creates GitHub labels using gh label create --force, assigning consistent colors based on an MD5 hash of the label name, and ensuring idempotency.
  • Updated map_tags_to_labels() Function: Modified this function to accept an optional repo_slug parameter, removed the extensive case statement for tag filtering, and integrated the new label creation logic to allow all tags to become labels.
  • Enhanced cmd_enrich() Function: Extended the cmd_enrich command to extract tags from TODO.md task lines and synchronize these as labels to existing GitHub issues, including adding status:available or status:claimed labels.
Changelog
  • .agents/scripts/issue-sync-helper.sh
    • Introduced create_label_if_needed function to programmatically create GitHub labels with consistent colors.
    • Modified map_tags_to_labels to accept an optional repo_slug parameter.
    • Removed the hardcoded case statement from map_tags_to_labels, enabling all TODO.md tags to be passed through as GitHub labels.
    • Integrated create_label_if_needed into map_tags_to_labels to create labels on-the-fly during issue creation.
    • Updated cmd_push to utilize the new repo_slug parameter in map_tags_to_labels for issue creation.
    • Enhanced cmd_enrich to extract tags from TODO.md task lines.
    • Implemented label synchronization in cmd_enrich, allowing existing GitHub issues to be updated with labels derived from TODO.md tags.
    • Ensured cmd_enrich adds appropriate status:available or status:claimed labels during synchronization.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a great improvement, replacing the hardcoded label allowlist with a dynamic, on-the-fly label creation system. This enhances the flexibility and robustness of the issue synchronization process. The implementation is well-structured, but I have identified a few areas for improvement. My review comments focus on enhancing shell script portability, adhering to the repository's style guide for error handling, and simplifying a piece of redundant logic. These suggestions aim to make the script more robust and easier to debug.

Comment on lines +529 to +530
local color
color=$(echo -n "$label_name" | md5sum | cut -c1-6)

Choose a reason for hiding this comment

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

medium

md5sum is a GNU coreutils command and is not available on macOS by default, which uses md5. This could lead to portability issues. The style guide emphasizes portability with the sed_inplace wrapper (line 20). To ensure cross-platform compatibility, it would be best to handle both cases, for example by checking for the command's existence.

Suggested change
local color
color=$(echo -n "$label_name" | md5sum | cut -c1-6)
local color
if command -v md5sum >/dev/null; then
color=$(echo -n "$label_name" | md5sum | cut -c1-6)
else
color=$(echo -n "$label_name" | md5 | cut -c1-6)
fi
References
  1. The style guide recommends using wrappers like sed_inplace for macOS/Linux portability, suggesting that cross-platform compatibility is a concern. (link)

local color
color=$(echo -n "$label_name" | md5sum | cut -c1-6)

gh label create "$label_name" --repo "$repo_slug" --color "$color" --force 2>/dev/null || true

Choose a reason for hiding this comment

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

medium

The use of 2>/dev/null here suppresses all error messages from gh label create. This violates the repository style guide (line 50), which states that 2>/dev/null should not be used for blanket suppression. While --force makes the command idempotent for existing labels, other errors (like authentication failures or an invalid repository slug) will be silently ignored, making debugging difficult. The || true already prevents the script from exiting on failure.

Suggested change
gh label create "$label_name" --repo "$repo_slug" --color "$color" --force 2>/dev/null || true
gh label create "$label_name" --repo "$repo_slug" --color "$color" --force || true
References
  1. The style guide states that 2>/dev/null is acceptable only when redirecting to log files, and not for blanket suppression of errors. (link)

Comment on lines +961 to +965
if [[ -n "$labels" ]]; then
labels="${labels},${status_label}"
else
labels="$status_label"
fi

Choose a reason for hiding this comment

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

medium

The if [[ -n "$labels" ]] check on line 961 is redundant because it's nested inside an identical check on line 955. This makes the else block on line 964 unreachable. The code can be simplified by removing the inner conditional.

Suggested change
if [[ -n "$labels" ]]; then
labels="${labels},${status_label}"
else
labels="$status_label"
fi
labels="${labels},${status_label}"

labels="$status_label"
fi
# Update issue labels
if gh issue edit "$issue_number" --repo "$repo_slug" --add-label "$labels" 2>/dev/null; then

Choose a reason for hiding this comment

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

medium

Similar to a previous comment, the use of 2>/dev/null here suppresses potentially useful error messages from gh issue edit. This violates the repository style guide (line 50). If the command fails due to issues like invalid permissions or network problems, the error will be hidden, complicating troubleshooting. Since gh issue edit --add-label doesn't fail if labels already exist, simply checking the command's success in the if statement is sufficient.

Suggested change
if gh issue edit "$issue_number" --repo "$repo_slug" --add-label "$labels" 2>/dev/null; then
if gh issue edit "$issue_number" --repo "$repo_slug" --add-label "$labels"; then
References
  1. The style guide states that 2>/dev/null is acceptable only when redirecting to log files, and not for blanket suppression of errors. (link)

@marcusquinn
Copy link
Owner Author

Stale duplicate — t295 was already merged via PR #1154. Closing.

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.

1 participant