Repository navigation
Conversation
…find`
`rtk find` does not implement GNU find's compound predicates/actions
(-not, -o, -a, -and, -or, -exec, -execdir, -ok, -okdir, -prune, `!`).
The rewrite registry currently turns e.g.
find . -name '*.ts' -not -path '*/node_modules/*'
into
rtk find . -name '*.ts' -not -path '*/node_modules/*'
which `rtk find` then rejects ("does not support compound predicates"),
so the command errors. Automated callers (coding agents) often retry the
same rewritten form in a loop.
Fix: in `rewrite_segment_inner`, skip the rewrite when the target is
`rtk find` and the command contains a compound predicate/action, so the
original bare `find` runs and the predicate works. Plain finds
(`find . -name x`) still rewrite as before.
Adds `has_find_compound_predicate` + 6 unit tests. `cargo test registry`:
294 passed.
|
|
multicam
force-pushed
the
fix/find-compound-predicate-no-rewrite
branch
from
June 19, 2026 00:27
a9165e4 to
62ad6cf
Compare
kylehgc
added a commit
to kylehgc/rtk
that referenced
this pull request
Jul 23, 2026
- Conflict list: drop rtk-ai#2579/rtk-ai#2590/rtk-ai#2615 (already flagged 07-17), add rtk-ai#2401/rtk-ai#2453 and the chunk-7 conflict cluster; note top-pick rtk-ai#2401 is a hand-port (issue #54). - Next-wave: restore recovered candidate rtk-ai#2256 (gh prompt-injection scan) dropped in distillation. Co-Authored-By: Claude Fable 5 <[email protected]>
Contributor
|
This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet. |
Contributor
|
Closing this pull request after a prolonged period of inactivity. If this is still relevant, please ask for it to be reopened. Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
rtk finddoesn't implement GNUfind's compound predicates/actions (-not,-o,-a,-and,-or,-exec,-execdir,-ok,-okdir,-prune,!). But the rewrite registry still rewrites them:The rewritten command then fails:
So a perfectly valid
findgets rewritten into something rtk refuses to run. Automated callers (coding agents using rtk as a PreToolUse rewrite hook) tend to retry the same rewritten form in a loop, since the rewrite is deterministic.Fix
In
rewrite_segment_inner, skip the rewrite when the target isrtk findand the command contains a compound predicate/action — let the original barefindrun, which handles these natively. Plain finds (find . -name x) still rewrite tortk findas before.Modeled on the existing
gh --jsonspecial-case in the same function.Tests
Adds
has_find_compound_predicate+ 6 unit tests (each compound operator passes through; plain find still rewrites).cargo test registry→ 294 passed.