mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #399] [MERGED] fix(scripts): forward environment explicitly for sudo-rs compatibility #403
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#403
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/399
Author: @yingdi-shan
Created: 10/20/2026
Status: ✅ Merged
Merged: 10/20/2026
Merged by: @yingdi-shan
Base:
main← Head:fix/sudo-rs-env-forwarding📝 Commits (1)
09c5df2fix(scripts): forward environment explicitly for sudo-rs compatibility📊 Changes
1 file changed (+4 additions, -2 deletions)
View changed files
📝
scripts/run-with-capabilities.sh(+4 -2)📄 Description
What
Make
scripts/run-with-capabilities.shforward the caller's environment throughenv(1)when escalating with sudo, instead of relying onsudo -E.Why
GitHub's
ubuntu-latestrunners moved to Ubuntu 26.04, which ships sudo-rs assudo. sudo-rs rejects-E(sudo: preserving the entire environment is not supported, '-E' is ignored), so the wrapper droppedAENV_HOME_PATH,AENV_DEPS_PATH,AENV_UBLK_DAEMON_BINARY_PATHand thetarget/debugPATHprefix. The privileged side then fell back to/tmp/aenv-test-<uid>, and every--test integrationcase panicked intests/common/mod.rs:29because regctl and the ublk daemon could not be found there.Failing run: https://github.com/kvcache-ai/AgentENV/actions/runs/39378372269 (job
agentenv-tests, imageubuntu-26.04). The previous passing run usedubuntu-24.04.Related issue
N/A: CI breakage caused by the runner image migration; no issue filed.
Scope and non-goals
Only the sudo re-exec line in the capability wrapper changes. Workflow
runs-onpins and other sudo usages are out of scope.Design and behavior changes
The non-root branch now captures
env -0into an array and runsexec sudo env "${caller_env[@]}" "$0" "$@". This keeps the previous-Ebehavior: the full caller environment reaches the root re-exec, which then drops to the runtime user withsetpriv. Behavior on hosts with classic sudo is unchanged.Compatibility and operations
Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
Skipped checks and reasons: Rust fmt/clippy/unit suites not run (no Rust changes). sudo-rs is not available locally; this PR's Integration Tests run on an Ubuntu 26.04 runner is the end-to-end check.
make test-agent-integrationwas not run locally.Risks and reviewer notes
The wrapper was already documented as not being a privilege boundary. Passing variables via
envbypasses sudo's env filtering, which-Emostly did as well. A very large caller environment could in theory hit argv limits, which is not a concern for CI or dev shells.Checklist
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.