feat: add runtime parameters support with auto-injected clearMemory#166
feat: add runtime parameters support with auto-injected clearMemory#166jamesadevine merged 4 commits intomainfrom
Conversation
Add a `parameters` front matter field that emits Azure DevOps runtime
parameters at the top of generated pipeline YAML. Parameters are
surfaced in the ADO UI when manually queuing a run.
First use case: when `safe-outputs.memory` is configured, a
`clearMemory` boolean parameter (default: false) is automatically
injected. Setting it to true skips downloading the previous memory
artifact and starts the agent with a fresh memory directory.
- Add PipelineParameter type in types.rs
- Add generate_parameters() helper in common.rs
- Add {{ parameters }} template marker to base.yml and 1es-base.yml
- Wire parameters in both standalone and 1ES compilers
- Auto-inject clearMemory when memory is enabled (deduped if user-defined)
- Make memory download/restore conditional on clearMemory parameter
- Add 4 integration tests covering parameters, auto-injection, dedup, markers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 Rust PR ReviewSummary: Looks good overall — clean design with one real bug, one error-handling gap, and a security concern worth addressing. Findings🐛 Bugs / Logic Issues
🔒 Security Concerns
|
The McpOptions struct no longer has a `command` field — it was renamed to `container` in a prior refactor. Update the 1ES test to use the correct field name. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 Rust PR ReviewSummary: Looks good overall — well-structured feature with solid test coverage. Two minor issues worth addressing before merge. Findings
|
- Fix 1ES compiler missing clearMemory auto-injection (was calling generate_parameters directly instead of build_parameters) - Move build_parameters to common.rs so both compilers share it - Add parameter name validation ([A-Za-z_][A-Za-z0-9_]*) to prevent YAML/template expression injection via malicious parameter names - Change generate_parameters to return Result, replacing expect() with context() per project convention - Add doc comment to generate_schedule (was lost during insertion) - Add 5 unit tests for parameter validation and build_parameters Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix condition syntax: remove quotes around ${{ parameters.clearMemory }}
so ADO correctly compares boolean values (not string-to-boolean)
- Add validation to reject ADO expressions (${{ and $() in parameter
displayName, default, and values fields — parameter definitions must
contain only literal values to prevent template expression injection
- Add 4 unit tests for expression rejection + 1 for literal acceptance
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 Rust PR ReviewSummary: Looks good overall — well-structured feature with solid injection prevention, but one logic bug worth fixing and a couple of minor observations. Findings🐛 Bugs / Logic Issues
|
Summary
Adds a
parametersfront matter field that emits Azure DevOps runtime parameters at the top of generated pipeline YAML. Parameters are surfaced in the ADO UI when manually queuing a run.First use case: Clear Memory
When
safe-outputs.memoryis configured, aclearMemoryboolean parameter (default:false) is automatically injected. Setting it totruewhen queuing a run skips downloading the previous memory artifact and starts the agent with a fresh memory directory.Front matter syntax
Changes
src/compile/types.rs—PipelineParameterstruct +parametersfield onFrontMattersrc/compile/common.rs—generate_parameters()helpersrc/compile/standalone.rs—build_parameters()with clearMemory auto-injection + conditional memory downloadsrc/compile/onees.rs— wired parameters for 1ES targettemplates/base.yml&templates/1es-base.yml—{{ parameters }}template markertests/compiler_tests.rs— 4 new integration tests (all 44 pass)AGENTS.md— documented parameters field, template marker, and clearMemory auto-injectionHow it works
name:in the pipelinesafe-outputs.memoryis configured,clearMemory(boolean, default false) is auto-prepended unless the user already defines onecondition: eq('${{ parameters.clearMemory }}', false)clearMemory=true