feat: add Lean 4 runtime support with runtimes: front matter#208
Conversation
Add `tools: lean:` front matter configuration that auto-configures:
- elan installation step (injected into prepare_steps before AWF sandbox)
- lean/lake/elan added to bash command allow-list
- Lean-specific domains (elan.lean-lang.org, leanprover.github.io,
lean-lang.org) added to AWF network allowlist
- Agent prompt supplement informing the agent Lean 4 is available
Supports both simple (`lean: true`) and object (`lean: { toolchain: ... }`)
front matter formats. Default toolchain is "stable"; lean-toolchain files
in the repo override automatically via elan.
Includes:
- LeanToolConfig types with deserialization tests
- Lean domain entries in allowed_hosts.rs
- Standalone compiler wiring (prepare_steps, allowed_domains, copilot_params)
- 1ES compiler: bash allow-list works; elan install via manual steps
- AGENTS.md documentation
- Example agent (examples/lean-verifier.md)
- Unit tests for types, copilot params, allowed domains, prepare steps
Related issues:
- #206 (first-class tool documentation pattern)
- #207 (network ecosystem identifiers)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 Rust PR ReviewSummary: Looks good overall — well-structured feature following established patterns, with solid test coverage. One security issue needs addressing before merge. Findings🔒 Security Concerns
|
…lity AWF chroot mode reconstructs PATH from standard system locations, so $HOME/.elan/bin is not on PATH inside the sandbox. Symlink lean, lake, and elan into /tmp/awf-tools/ which is always mounted at /tmp inside the AWF container. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 Rust PR ReviewSummary: Solid implementation following established patterns — one security concern needs addressing before merge. Findings🔒 Security Concerns
|
Lean is a language runtime, not a tool (like edit, bash, memory). Refactor to align with gh-aw's `runtimes:` front matter model: - New `src/runtimes/` module alongside `src/tools/` and `src/safeoutputs/` - `src/runtimes/lean.rs`: LeanRuntimeConfig, LeanOptions, install/prompt generators - `src/runtimes/mod.rs`: module documentation - `RuntimesConfig` struct in types.rs with `runtimes` field on FrontMatter - Front matter changes from `tools: lean:` to `runtimes: lean:` - All compiler references updated (standalone.rs, common.rs) - AGENTS.md: new "Runtimes Configuration" section, separate from Tools - Example updated Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Resolved in 53b9284. The only conflict was in 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:
|
Replace \x20 hex escape sequences with a readable approach: build the script body as a plain string, then indent each line by 4 spaces for the YAML block scalar. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 Rust PR ReviewSummary: Solid feature addition, but there's one real security concern that should be addressed before merging. Findings🔒 Security Concerns
|
- Use LEAN_BASH_COMMANDS constant in common.rs instead of inline list - Move lean domains from mcp_required_hosts() to LEAN_REQUIRED_HOSTS constant in runtimes/lean.rs (lean is a runtime, not an MCP) - Update standalone.rs and allowed_hosts.rs tests accordingly Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 Rust PR ReviewSummary: Mostly well-executed — good architecture, solid test coverage, and clean integration with the existing toolchain. One security concern worth addressing. Findings🔒 Security Concerns
|
Summary
Add Lean 4 as a first-class runtime in the ado-aw compiler, introducing the
runtimes:front matter field (aligned with gh-aw'sruntimes:model).When enabled via
runtimes: lean:, the compiler auto-configures:{{ prepare_steps }}(runs before AWF sandbox)/tmp/awf-tools/(AWF reconstructs PATH from standard system locations, so$HOME/.elan/binisn't on PATH inside the sandbox)lean,lake,elanauto-added to allowed commandselan.lean-lang.org,leanprover.github.io,lean-lang.orgArchitecture: Tools vs Runtimes
This PR introduces the
runtimes:front matter field as a peer totools:, with a newsrc/runtimes/module alongsidesrc/tools/andsrc/safeoutputs/:tools:src/tools/runtimes:src/runtimes/safe-outputs:src/safeoutputs/Front Matter Syntax
Default toolchain is
stable. If alean-toolchainfile exists in the repo, elan overrides automatically.Files Changed
src/runtimes/mod.rssrc/runtimes/lean.rsLeanRuntimeConfig,LeanOptions,generate_lean_install(),generate_lean_prompt(),LEAN_BASH_COMMANDSsrc/compile/types.rsRuntimesConfigstruct,runtimesfield onFrontMatter, deserialization testssrc/compile/standalone.rssrc/compile/common.rsgenerate_copilot_params(); testssrc/allowed_hosts.rs"lean"match arm inmcp_required_hosts()+ testsrc/main.rsruntimesmoduleAGENTS.mdruntimes:in front matter referenceexamples/lean-verifier.mdruntimes: lean:Design Notes
runtimes:declares language toolchains andtools:declares agent capabilities.$HOME:rwbut reconstructs PATH from standard locations. The install step symlinks lean binaries into/tmp/awf-tools/which is always on PATH inside AWF.{{ prepare_steps }}which executes after Docker/AWF binary download but before AWF network isolation, giving full network access for toolchain download.generate_copilot_params(); elan installation requires manualsteps:front matter.Related Issues
Testing
All 824 tests pass including 14 new tests covering:
LeanRuntimeConfigdeserialization (bool, object, empty options, not set, tools+runtimes together)generate_copilot_paramswith lean enabled / unrestricted bashgenerate_allowed_domainswith lean enabled / disabledgenerate_prepare_stepswith lean / custom toolchain / lean + memorymcp_required_hosts("lean")domain verification