Skip to content

Bug: gradle TOML filter match_command regex never matches bare gradle or gradlew #2708

Closed

Description

@guyoron1

Description

The match_command regex in src/filters/gradle.toml is structurally broken and never activates for bare gradle or gradlew invocations — only ./gradle and ./gradlew work.

Current regex

^(gradle|gradlew|\\./)gradlew?\\b

The alternation group (gradle|gradlew|\\./)captures the entire command name, then expects another gradlew? suffix immediately after. This creates impossible matches:

Input Group captures Then needs Full match attempt Result
gradle build gradle gradlew? gradlegradle or gradlegradlew NO MATCH
gradlew build gradlew gradlew? gradlewgradle or gradlewgradlew NO MATCH
./gradle build ./ gradlew? ./gradle MATCH
./gradlew build ./ gradlew? ./gradlew MATCH

Only the ./ prefix case works because it's the only branch where the suffix gradlew? makes sense.

Expected behavior

All four forms should match: gradle, gradlew, ./gradle, ./gradlew.

Impact

The gradle filter never activates for direct gradle or gradlew invocations, meaning users get unfiltered output with zero token savings for all Gradle commands unless they use the ./ prefix form.

Fix

Change the regex to make ./ optional and capture the command name in one group:

^(\\./)?(gradlew?)\\b

This correctly matches all four forms.

Activity

  1. added
    bug
    good first issue
    on Jun 29, 2026
  2. pszymkowiak commented on Jun 29, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 96%

    Summary

    Regex in src/filters/gradle.toml is structurally broken — only ./gradle/./gradlew match; bare gradle/gradlew invocations are never filtered. Fix: change regex to ^(\./)?(gradlew?)\b.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/filters/gradle.toml

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. nightcityblade commented on Jun 29, 2026

    @nightcityblade

    Hi, I'd like to work on this. I'll submit a PR shortly.

  4. nightcityblade commented on Jun 29, 2026

    @nightcityblade

    I’m unclaiming this one. I found that either another PR is already in flight for it or the requested changes already appear to be present upstream, so I don’t want to create duplicate noise.

  5. KuSh commented on Sep 27, 2026

    @KuSh
    Collaborator

    Fixed the other way. The gradle.toml filter was removed by #2709 because it was never reachable: the hook rewrites gradle build, gradlew build and ./gradlew build to rtk gradlew, which is the real filter, so the premise that these ran unfiltered does not hold, and widening the regex would only have created a second, shadowed path. That change is on develop and ships with the next release. ./gradle build is not rewritten, but that form was never filtered before either; open a new issue if you need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:configbuggood first issuepriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions