Commit Graph

1220 Commits

Author SHA1 Message Date
guy oron 36dd8f2479 fix(hook): use ask action in audit log for AskRewrite verdict dev-0.43.1-rc.296 2026-06-29 14:18:05 +02:00
Guy Oron a0c16ef0bc fix(hook): use ask permission for AskRewrite in Cursor hook
Address PR #2609 review feedback:
- RC=3 in shell script now emits "permission": "ask" (future-proof)
- Add cursor_ask() and use it for all AskRewrite decisions
- Remove has_rules guard (unnecessary with ask semantics)
- Remove dead cursor_has_explicit_rules() function
2026-06-29 14:18:05 +02:00
guy oron 33623258b8 fix(hook): include ask rules in cursor_has_explicit_rules check
Align cursor_has_explicit_rules() with the inline has_rules check in
run_cursor_inner_with_rules() — both now consider deny, ask, and allow
rules when determining whether the user has configured explicit
permission policies.
2026-06-29 14:18:05 +02:00
guy oron ff0b9ac28c fix(hook): handle AskRewrite in Cursor hook when no rules configured
When no explicit permission rules exist in ~/.cursor/cli-config.json
(the default for fresh installs), every command gets Default verdict
which maps to AskRewrite. The Cursor hook only handled AllowRewrite,
silently dropping all rewrites and making RTK non-functional.

Now treat AskRewrite as allow when no rules are configured — Cursor
has no ask-the-user UX, so deferring is indistinguishable from
dropping. When explicit rules exist, preserve the conservative
behavior of deferring mixed/unmatched commands.

Also fix the legacy shell script (rtk-rewrite.sh) which treated
exit code 3 (ask) as failure via || short-circuit.

Fixes #2372
2026-06-29 14:18:05 +02:00
aesoft 113ae1188a Merge pull request #2681 from guyoron1/fix/run-signal-exit-code
fix(run): propagate signal exit code instead of unwrap_or(1)
2026-06-28 18:15:13 +02:00
guy oron a58de9d60a fix(run): propagate signal exit code instead of unwrap_or(1)
`Commands::Run` used `status.code().unwrap_or(1)` which silently
maps signal kills (SIGTERM, SIGKILL, OOM) to exit code 1 instead
of the POSIX-conventional 128+signal. Use the existing
`exit_code_from_status()` helper already used by Commands::Proxy.

Fixes #2680
2026-06-28 09:54:57 +03:00
aesoft d3553fb7ee Merge pull request #2641 from rtk-ai/fix/grep-faithful-engine
refacto(search): run the invoked engine instead of substituting rg for grep
dev-0.43.0-rc.292
2026-06-26 20:00:02 +02:00
Adrien Eppling 05f3c54886 fix(grep): surface the engine error and exit code, add nothing
- drop the synthetic "search failed with exit code N" line (an rtk addition)
- surface the engine stderr verbatim in every path, incl. partial match + error
- remove the now-vestigial is_grep_error_exit (the "0 matches" it guarded is gone)
- error/exit matrix tests vs real grep/rg (#2465: an error is never a silent no-match)
2026-06-26 19:43:51 +02:00
Adrien Eppling 059131cd56 test(grep): rename compress suite to search_compress, cover binary skip
- grep_compress_test.rs -> search_compress_test.rs (tests the shared grep/rg filter)
- binary match skipped as noise by default, -a opts back in
- fix parse_flags doc: -I is an intentional binary skip, not a no-op
2026-06-26 17:44:57 +02:00
Adrien Eppling c66e510372 test(grep): cover #1436 comment-reported cases
- leading ^ anchor must stay scoped to the path (tenequm)
- line ending in `:` keeps full content (BTCAlchemist)
- rg surfaces a regex parse error as exit 2, not a silent 0 (jhagberg)
2026-06-26 17:34:26 +02:00
Adrien Eppling 37ee6cf6fa fix(grep): match real grep output and read piped stdin
- line number always (the openable position); filename only when grep/rg prints one (multi-file, dir, -r, -H)
- single file and stdin equal `grep -n` byte-for-byte: no synthetic filename, header, or lossy truncation
- read piped stdin instead of injecting `.`; rg no longer searches the cwd on a pipe
- pattern-less and format-flag commands run verbatim (rg --type-list, --files, grep -c/-o)
- grouped/capped form only when capping actually shrinks the output
- byte-for-byte tests vs grep -n across flags, pipes and edge cases (incl #1436)
2026-06-26 17:25:01 +02:00
Adrien Eppling eafadcee00 fix(grep): run the invoked engine instead of substituting rg for grep
- grep runs grep, rg runs rg: drop the substitution, forced --no-ignore-vcs, and BRE-to-rg translation
- add `rtk rg` command (native ripgrep, sharing the same output filter)
- split rewrite rule: grep to rtk grep, rg to rtk rg
- record the agent's real command in tracking (was synthesized as "grep -rn")
- emit nothing on a clean no-match (never-worse parity with the shared guard)
- rename grep_cmd.rs to search.rs, now hosting both engines
- cover engine faithfulness, ignore semantics, and rg savings with issue-referenced tests
- benchmark the grep and rg paths
2026-06-26 14:11:28 +02:00
aesoft 9a52647f65 Merge pull request #2499 from hgunduzoglu/fix/git-worktree-list-exit-code
fix(git): propagate exit code on git worktree list failure
dev-0.43.0-rc.291
2026-06-26 13:58:31 +02:00
aesoft 29272484de Merge pull request #2496 from hgunduzoglu/fix/git-commit-false-success
fix(git): propagate exit code when commit fails instead of reporting ok
dev-0.43.0-rc.290
2026-06-26 13:24:34 +02:00
aesoft a9b2ef5b3c Update git.rs 2026-06-26 13:16:32 +02:00
aesoft adaf2b259c Update git.rs 2026-06-26 13:13:37 +02:00
aesoft 23aae98c5b Merge pull request #2500 from hgunduzoglu/fix/git-stash-list-show-exit-code
test(git): cover exit-code propagation for git stash list/show failure
dev-0.43.0-rc.289
2026-06-26 12:43:34 +02:00
Husam c04dec1fe1 test(git): cover exit-code propagation for git stash list/show failure
develop already propagates the exit code for failed git stash list/show
(via the empty-stdout guard). Add regression tests so the masking-failure
behavior (#2497) can't creep back.
2026-06-26 13:16:24 +03:00
aesoft d86f0073ec Merge pull request #2498 from hgunduzoglu/fix/git-status-compact-exit-code
fix(git): propagate exit code on git status failure in compact path
dev-0.43.0-rc.288
2026-06-26 11:49:23 +02:00
Husam a271b5e003 chore: re-trigger CI (transient crates.io download failure on windows runner) 2026-06-26 12:10:00 +03:00
Husam 8ef08cf6f0 refactor(git): trim verbose comments on commit outcome to a concise note 2026-06-26 12:04:25 +03:00
Husam d8e1428110 refactor(git): drop explanatory comment on worktree list failure guard
Per review (#2498): self-explanatory guard; remove comment to avoid noise.
2026-06-26 11:35:37 +03:00
Husam ee5a675f40 refactor(git): drop explanatory comment on status failure guard
Per review (#2498): the guard is self-explanatory; remove the comment
to avoid noise.
2026-06-26 11:35:00 +03:00
aesoft af81b08175 Merge pull request #2554 from rtk-ai/fix/global-never-worse-guard
fix(core): never-worse output guard
dev-0.43.0-rc.287
2026-06-25 09:02:04 +02:00
Adrien Eppling 5a344524e3 test(bench): drop env --show-all (flag removed) 2026-06-24 20:37:04 +02:00
Adrien Eppling 3d4189cc63 fix(docker): report 0 containers/images instead of empty output 2026-06-24 20:37:02 +02:00
Adrien Eppling 9870c1c8bc Merge remote-tracking branch 'origin/develop' into fix/global-never-worse-guard
# Conflicts:
#	src/cmds/system/grep_cmd.rs
2026-06-24 20:11:28 +02:00
Adrien Eppling 25a095e90d fix(aws): guard the s3 ls and s3 sync/cp text emits 2026-06-24 19:27:06 +02:00
Adrien Eppling b52db52da0 fix(docker): make the agent's command authoritative for the guard baseline
docker ps/ps -a/images ran a plain command for the raw baseline and a
separate --format command for parsing, capturing the plain run with
unwrap_or_default(). A failed plain run while --format succeeded left
raw empty, and never_worse("", summary) dropped real output.

Run the agent's actual command first as the source of truth: on failure
show its output/exit faithfully; on success use its stdout as raw and
treat --format as a best-effort parse aid that falls back to raw. The
guard stays pure and always sees a real baseline. Parsers unchanged.
2026-06-24 18:44:42 +02:00
Adrien Eppling 9a2ad90360 fix(read): make guard baseline faithful to cat/cat -n output
Compare filtered output against the raw the agent's command would
emit (numbered for -n), not against unnumbered content, so the
guard keeps requested line numbers instead of dropping to plain.
2026-06-24 16:43:54 +02:00
Adrien Eppling 9d9ad7cb17 fix(pipe): apply the never-worse guard
pipe filters piped stdin but bypassed the guard; route its output through
never_worse like every other compressor.
2026-06-24 14:32:25 +02:00
Adrien Eppling 223dda2996 fix(env): clean up feature from secrets rewrite
Masking env secrets is not what core RTK (OSS) is for -- it compresses command
output, it does not redact what the command itself already reveals. It also
broke raw-vs-filtered consistency, which the never-worse guard relies on.
2026-06-24 11:18:32 +02:00
aesoft ee9e2f8a2a Merge pull request #2550 from rtk-ai/fix/grep-context-flags
fix(grep): correctly handle all flag shapes and never exceed raw output
dev-0.43.0-rc.286
2026-06-23 21:54:56 +02:00
Adrien Eppling 861a46dee5 fix(core): never-worse output guard so RTK never exceeds the raw command
RTK could emit more tokens than the underlying command on small inputs:
filters that add headers, summaries, re-indentation, or a tee hint, plus
synthetic no-result messages ("0 matches", "No stashes", "[docker] 0
containers") printed where the raw command emitted nothing. Both break the
Transparency principle and inflate tokens instead of saving them.

- core::guard::never_worse(raw, filtered) returns raw when the filtered form
  has more tokens (reuses tracking::estimate_tokens), so RTK output is never
  larger than the real command.
- runner::emit_guarded(filtered, hint, raw) composes body + tee hint, guards
  the whole, prints, and returns what was shown so printed == tracked.
- run_captured_filter guards the run_filtered* family centrally; per-site
  guards cover the remaining single-string filters.
- On empty raw, emit empty and preserve the exit code instead of a synthetic
  no-result message (the messages were cosmetic with no dependents; #2461
  reports the grep one as actively harmful).
- git stash show now propagates its exit code instead of masking a real
  failure as Ok(0).

Resolves #2551.
2026-06-23 21:53:35 +02:00
aesoft ced70c6f0d Merge pull request #1334 from wlami/feat/pulumi-add-cli-filters
feat(pulumi): add CLI filters for preview/up/destroy/refresh/stack
dev-0.43.0-rc.285
2026-06-23 21:39:20 +02:00
Adrien Eppling 3a59d23235 test(grep): cover bundled -rln files-with-matches cluster (#2543)
Review feedback on #2550: the flag-shape tests all used standalone flags, leaving the exact #2543 repro -- a bundled -rln/-ln files-with-matches cluster -- unexercised. Assert rtk grep -rln <pat> <dir> lists matching files instead of a false '0 matches'.
2026-06-23 16:09:29 +02:00
Wladi Mitzel 5cfe4d5f87 fix(pulumi): keep Owner and version in pulumi-stack filter
Per review: avoid signal loss that pushes agents to retry with
`rtk proxy`. pulumi-stack now keeps the full stack identity block
(Owner:, Pulumi version used:) alongside the header and Last updated:.
Only interactive prompt and help-footer noise is stripped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:51:39 +02:00
Adrien Eppling 0adfae6cf6 fix(grep): correctly handle all flag shapes and never exceed raw output
The grep argument-parsing rework routed many flag shapes through the
grouping reparse, which silently dropped any line it could not parse and
returned a success exit. Common invocations produced wrong or empty
output -- and grep-only syntax like `--include` failed outright -- which
pushed agents back to unfiltered `rtk proxy grep`.

Every valid grep invocation now produces correct output:

- Context (`-A`/`-B`/`-C`) is grouped and compressed instead of dropped;
  the header counts matches only and context lines are shown.
- Output the reparse cannot represent (`-N`, `-I`, `--color`, `-p`,
  `--heading`, binary-file notices, ...) is passed through verbatim
  instead of reported as a false "0 matches".
- Format/shape flags (`-c`, `-l`, `-o`, `-Z`, `--column`, `-b`,
  `--vimgrep`, `--null-data`) pass through cleanly with no NUL leak.
- grep-only syntax (`--include`, `--exclude`, ...) works: ripgrep is the
  fast path and rtk falls back to system grep when ripgrep rejects a flag.
- rtk grep never emits more than plain grep: if grouping is not smaller
  than `file:line:content`, the raw form is shown.

Resolves #2543.
2026-06-23 13:16:27 +02:00
Wladi Mitzel 1f6e36b27e fix(pulumi): keep stack identity in pulumi-stack filter
Stop stripping `Current stack is X:` and `Last updated:`. pulumi stack
is read-only (exit 0) so there's no tee fallback; dropping the active
stack identity was irreversible signal loss. Keeping the header also
fixes the orphaned indented `Managed by <user>` line.

Owner: and Pulumi version used: remain stripped as noise.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 07:57:18 +02:00
aesoft 6946bf9562 Merge pull request #2502 from Tailoo/fix/2501-dotnet-test-failure-dedup
fix(dotnet): stop duplicating failures on failing test runs (#2501)
dev-0.43.0-rc.284
2026-06-22 15:50:05 +02:00
Wladi Mitzel 729ac36682 Merge remote-tracking branch 'upstream/develop' into feat/pulumi-add-cli-filters
# Conflicts:
#	src/core/toml_filter.rs
2026-06-22 13:41:33 +02:00
Tailoo 5e7eab5846 fix(dotnet): keep raw fallback when parsed failures incomplete
test_needs_raw_fallback dropped the raw stdout prepend whenever every
parsed failure carried detail, but never checked the list was complete
against summary.failed. A run reporting 5 failures but parsing only 3
detailed blocks would silently lose the 2 unparsed failures.

Add a `failed_tests.len() < summary.failed` clause so the raw fallback is
kept when the structured section is numerically incomplete. Add a
regression test and fix an inconsistent existing fixture (failed: 5 with a
single parsed entry) that the new clause correctly flagged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 22:41:00 +02:00
aesoft e3f60e9822 Merge pull request #2294 from jsiu93/fix/vitest-reporter-passthrough
fix(vitest): preserve explicit reporters
dev-0.43.0-rc.283
2026-06-20 17:17:41 +02:00
xiaozh f9469d12cf fix(vitest): add passthrough recovery hint
Explicit Vitest reporters can produce successful output that exceeds the passthrough cap. Track truncation as structured state and use force_tee_hint so the full verbose output remains recoverable.
2026-06-20 19:31:01 +08:00
aesoft 444f1c0908 Merge pull request #2514 from rtk-ai/fix/oc-classification-resync
fix(tests): resync & list oc as passthrough for test
dev-0.43.0-rc.282
2026-06-19 17:25:14 +02:00
Adrien Eppling d2babe2bfb test(main): classify oc subcommand in PASSTHROUGH allowlist 2026-06-19 13:15:20 +02:00
Adrien Eppling 177242ad83 Merge remote-tracking branch 'origin/master' into fix/oc-classification-resync 2026-06-19 11:29:58 +02:00
Tailoo 2d9dc1ab9e fix(dotnet): stop duplicating failures on failing test runs
On failing `dotnet test` runs the orchestrator prepended the full raw
stdout ahead of the filtered summary. The `Failed Tests:` section already
reproduces each failure (name + message + clipped stack) parsed from
TRX/console, so every failure was printed twice — inflating output +65%
vs raw, scaling linearly with failure count (issue #2501).

Gate the raw-stdout prepend behind `test_needs_raw_fallback`: skip it when
the structured section carries detail, keep it when the filter is blind
(no failures parsed, or a parsed failure has empty detail — e.g. a
self-closing <UnitTestResult> with no <ErrorInfo>, or a build failure /
crash where nothing reaches failed_tests).

Extracts two pure, unit-tested fns (`test_needs_raw_fallback`,
`compose_failure_output`) so the orchestration decision is covered without
running dotnet.

Closes #2501

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 22:46:27 +02:00
aesoft 39cbb96897 Merge pull request #2243 from Alcamech/feat/oc-support
feat(oc): add Openshift CLI support with shared k8s filtering
2026-06-18 22:08:08 +02:00
Husam ebaaf8db58 fix(git): propagate exit code on git worktree list failure
run_worktree list mode never checked result.success() — a failed
`git worktree list` (e.g. run outside a repo) was flattened to empty
output + exit 0. The has_action branch already guards on success; apply
the same guard to list mode and surface git's error with its exit code.

Part of #2497
2026-06-18 22:55:50 +03:00