Skip to content

fix(rewrite): handle env unset prefixes - #4115

Draft
taljeon wants to merge 2 commits into
rtk-ai:developfrom
taljeon:fix/env-unset-wrapper
Draft

taljeon wants to merge 2 commits into
rtk-ai:developfrom
taljeon:fix/env-unset-wrapper

Conversation

@taljeon

@taljeon taljeon commented Sep 18, 2026 •

Copy link
Copy Markdown

Summary

  • Recognize repeated env -u NAME and GNU env --unset[=]NAME options while preserving the wrapper text, exclusions, RTK_DISABLED, and intentional sudo passthrough.
  • Reconcile the conflict with current develop without changing its permission rules. Classification/rewrite consume unset options; permission readings retain upstream's boundary at env's own options.

This is the env -u portion of #4099, not a closing fix for the separate sudo design in #146/#2810. The shared assignment grammar remains in one helper, with two new regressions pinning the rewrite/permission split and deny/ask/allow verdicts.

Current head: c282557443cd94e883fa68cf442b0eb2a36af0ae, merged with develop@263cb43598d7dcbdaf94aa2383e543e5cbae91c3. The PR diff against develop remains one registry file; upstream changes are not claimed as new implementation here.

Test plan

Fresh on this merged source, Rust 1.98.0 / macOS arm64:

  • cargo +1.98.0 fmt --all --check
  • cargo +1.98.0 clippy --offline --locked --all-targets
  • cargo +1.98.0 test --offline --locked --all-targets for the root package: 4,287 unit checks passed / 8 existing ignored, plus 327 integration checks across 36 targets. The Windows-only target runs zero cases on macOS.
  • Six focused env-unset checks and their classification/rewrite/exclusion/disabled/sudo controls. Making the permission helper consume unset options incorrectly fails both new regressions; the other four focused checks still pass.

The synthetic localhost-listener test initially failed under sandbox restrictions on both candidate and pristine develop, with the same source blob. The final all-targets run used the normal approved host execution path, no warning suppression, removed tests or weakened guards. A shared-target run was discarded after its test inventory showed base artifacts; the reported run uses a fresh candidate-only target directory.

This is not Linux/Windows, proxy-package or whole-workspace testing, a new token-savings benchmark, or upstream CI success. The PR remains draft awaiting maintainer review/new-head checks; no Ready transition, workflow approval/rerun, reviewer request or upstream merge was performed.

AI assistance: OpenAI Codex reconciled and verified the bounded change; no Qwen generation or new external AI provider connection. The new merge commit uses the GitHub noreply identity and DCO sign-off.

@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working rewrite labels Sep 18, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Extends the rewrite prefix regex to preserve repeated env -u NAME and GNU env --unset[=]NAME options (and leading assignments) while still matching and rewriting the wrapped command. Adds tests covering classification, exclusions, RTK_DISABLED interaction, and confirms the existing sudo passthrough boundary remains untouched.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4099


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

@taljeon

taljeon commented Oct 14, 2026

Copy link
Copy Markdown
Author

Resolved the new develop conflict in existing branch head c282557443cd94e883fa68cf442b0eb2a36af0ae, based on 263cb43598d7dcbdaf94aa2383e543e5cbae91c3.

The shared prefix helper keeps unset-option parsing for classification/rewrite separate from the permission gate's existing own-option boundary. Two new regressions detect an incorrect shared grammar; exclusions, RTK_DISABLED and sudo passthrough remain covered. No permission setting or guard was weakened.

Fresh root-package validation: fmt/clippy passed; 4,287 unit checks passed with 8 existing ignored, plus 327 integration checks on macOS arm64. The body documents the identical base/candidate sandbox TCP failure and the clean candidate-only final build. Earlier shared-target output is not used as candidate proof.

Draft status is unchanged. New-head CI and maintainer review remain separate; no workflow approval/rerun, reviewer request or upstream merge. This continues the existing env-only scope, not the separate sudo feature.

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

Labels

bug Something isn't working rewrite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant