Uh oh!
There was an error while loading. Please reload this page.
Harden gh aw env update with strict input validation and non-mutating preview - #35358
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
gh aw env update for safer DevOps operationsgh aw env update with strict input validation and non-mutating previewThere was a problem hiding this comment.
Pull request overview
Tightens gh aw env update by adding strict YAML parsing (rejecting unknown fields), pre-mutation validation for numeric and model fields, and a new --dry-run flag that renders the preview without mutating any variables. Preview rendering is factored into a shared helper so dry-run and the real apply path output the same change set.
Changes:
- Add
--dry-runflag and short-circuit before confirmation/mutation indefaultsUpdateFromFile. - Introduce
defaultsParseFile(withDisallowUnknownField) anddefaultsValidateFile(positive-int and non-empty checks); extractrenderDefaultsUpdatePreview. - Extend unit tests for the new flag, strict parsing, and validation; update cost-management docs.
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/env_command.go | Adds dry-run plumbing, strict YAML parsing, field validation, and shared preview renderer. |
| pkg/cli/env_command_test.go | Adds coverage for the dry-run flag, unknown-field rejection, and validator behavior. |
| docs/src/content/docs/reference/cost-management.md | Documents --dry-run, unknown-key rejection, and invalid-numeric handling. |
| .github/workflows/*.lock.yml (20 files) | Regenerated lock files adding GH_AW_COMMANDS to the safe-outputs job env and rotating heredoc markers; unrelated to the env-command changes described in the PR. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 24/24 changed files
- Comments generated: 1
| } | ||
| } | ||
| validatePositiveInt("default_max_effective_tokens", file.DefaultMaxEffectiveTokens) |
pelikhan
commented
May 28, 2026
@copilot merge main, recompile, review comments |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in |
Add two new terms from recent changes: - Tool Call Limits (max-calls): per-tool call cap on tools.github.allowed entries, from PR #35376 - GH_AW_DEFAULT_*: family of compiler/runtime env vars for org-wide defaults, from PRs #35286/#35338/#35358 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
gh aw envhad operational gaps for DevOps usage: updates could apply from typoed YAML keys silently, and there was no safe preview mode for automation or change review. This PR tightens update safety by validating input schema/values before mutation and adding an explicit dry-run path.Safety model improvements
--dry-runtogh aw env updateto render the full update preview without applying variable changes.Strict config parsing
Input validation before mutation
default_max_effective_tokensas a non-zero integer when set, preserving negative values as the existing signal to disable token steering / budget enforcementdefault_max_turnsas a positive integerdefault_timeout_minutesas a positive integerdefault_detection_modeldefault_model_copilotdefault_model_claudedefault_model_codexCoverage and docs alignment
default_max_effective_tokenscoverage.--dry-runand the stricter input handling, including the preserved negative-value semantics fordefault_max_effective_tokens.