feat(compile): add awf_path_prepends for chroot PATH injection#359
feat(compile): add awf_path_prepends for chroot PATH injection#359jamesadevine merged 2 commits intomainfrom
Conversation
079891a to
e834a85
Compare
🔍 Rust PR ReviewSummary: Good feature with one concrete bug that will silently corrupt generated YAML when multiple extensions contribute path entries, plus a docs/code mismatch. Findings🐛 Bugs / Logic Issues
|
…PATH injection Add a new CompilerExtension trait method awf_path_prepends() that lets extensions declare directories to prepend to PATH inside the AWF chroot. The compiler collects these paths and generates a dedicated pipeline step (Generate GITHUB_PATH file) that writes them to a file and sets the GITHUB_PATH env var via ##vso[task.setvariable]. AWF natively reads this file at startup and merges entries into the chroot PATH, bypassing the sudo secure_path reset that strips custom PATH entries. LeanExtension declares \C:\Users\devinejames/.elan/bin so lean, lake, and elan are discoverable by the agent without requiring absolute paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
e834a85 to
7a317b1
Compare
🔍 Rust PR ReviewSummary: Looks good — solid, well-scoped feature with correct design throughout. A couple of minor nits worth cleaning up before merge. Findings
|
|
@copilot implement suggestions from feedback |
…e collection, e2e test Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/7947ef47-4f5c-4df7-88bc-461d12b9f9ff Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Done in 9091383. Changes made based on review feedback:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Summary
Adds
awf_path_prepends()to theCompilerExtensiontrait so extensions can declare directories that should be on PATH inside the AWF chroot. The Lean runtime uses this to makelean,lake, andelandiscoverable without absolute paths.Problem
After PR #354 added the
$HOME/.elanAWF mount, the agent could access Lean binaries at~/.elan/bin/lean— butleanwasn't on PATH. The agent had to do an extra step (which leanfails →~/.elan/bin/lean -hworks) before it could use Lean.Root cause:
sudoresets PATH viasecure_path. AWF reconstructs PATH internally fromprocess.env.PATH(post-sudo, missing elan). On GitHub Actions, AWF reads the$GITHUB_PATHfile to recover lost paths, but no equivalent existed for ADO.Solution
CompilerExtension::awf_path_prepends()trait method — extensions declare bin directories to inject into the chroot PATHLeanExtensionreturns["$HOME/.elan/bin"]generate_awf_path_step()generates a dedicated pipeline step ("Generate GITHUB_PATH file") that writes path entries to a heredoc file and setsGITHUB_PATHvia##vso[task.setvariable]generate_awf_path_env()appendsGITHUB_PATH: $(GITHUB_PATH)to the{{ engine_env }}block on the AWF step for explicit env passthrough$GITHUB_PATHat startup and merges entries into the chroot PATHGenerated step (when Lean is enabled):
The heredoc uses an unquoted delimiter so
$HOMEis expanded by bash at write time — AWF reads the file as literal paths and does not perform shell expansion itself.Changes
src/compile/extensions/mod.rsawf_path_prepends()trait method + macro dispatchsrc/runtimes/lean/extension.rs["$HOME/.elan/bin"]src/compile/common.rsgenerate_awf_path_step(),generate_awf_path_env(), appends toengine_env+ testssrc/compile/standalone.rs{{ awf_path_step }}replacementsrc/compile/onees.rs{{ awf_path_step }}replacementsrc/data/base.yml{{ awf_path_step }}marker after{{ prepare_steps }}src/data/1es-base.yml{{ awf_path_step }}marker after{{ prepare_steps }}src/compile/extensions/tests.rsawf_path_prependstestsdocs/extending.mddocs/template-markers.md{{ awf_path_step }}markerTesting
awf_path_prepends()default + Lean impl,generate_awf_path_step()with/without Lean,generate_awf_path_env()with/without Lean