Set frontmatter defaults and add shared import/expression support for max limits#31484
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
max-runs=100 and max-effective-tokens=25M
There was a problem hiding this comment.
Pull request overview
This PR updates gh-aw’s default workflow frontmatter limits so that omitted max-runs and max-effective-tokens values resolve to higher-capacity defaults and are explicitly emitted into the generated AWF apiProxy config.
Changes:
- Updated Go runtime defaults (
DefaultMaxRuns=100,DefaultMaxEffectiveTokens=25,000,000) and ensuredapiProxy.maxRuns/maxEffectiveTokensare always populated. - Updated workflow schema + editor autocomplete metadata to document/reflect the new defaults.
- Updated WASM golden fixtures and unit tests to match the newly emitted default values.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/testdata/TestWasmGolden_CompileFixtures/with-imports.golden | Golden fixture updated to include emitted apiProxy.maxRuns=100 and maxEffectiveTokens=25000000. |
| pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden | Golden fixture updated to include emitted default maxRuns and updated token budget. |
| pkg/workflow/testdata/TestWasmGolden_CompileFixtures/playwright-cli-mode.golden | Golden fixture updated to include emitted default maxRuns and updated token budget. |
| pkg/workflow/testdata/TestWasmGolden_CompileFixtures/basic-copilot.golden | Golden fixture updated to include emitted default maxRuns and updated token budget. |
| pkg/workflow/engine.go | GetMaxRuns() now falls back to the default rather than returning 0 when unset. |
| pkg/workflow/awf_config.go | AWF config generation now defaults maxRuns to DefaultMaxRuns instead of omitting it. |
| pkg/workflow/awf_config_test.go | Tests updated to expect emitted default maxRuns when not configured. |
| pkg/parser/schemas/main_workflow_schema.json | Added schema default metadata and updated descriptions for the new default values. |
| pkg/constants/constants.go | Bumped default max effective tokens to 25M and introduced DefaultMaxRuns=100. |
| docs/src/content/docs/reference/engines.md | Documentation updated to state the new omission defaults. |
| docs/public/editor/autocomplete-data.json | Autocomplete descriptions updated to reflect omission defaults. |
| .github/workflows/issue-monster.lock.yml | Comment-only change in a workflow lockfile snippet. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 12/12 changed files
- Comments generated: 1
| @@ -3693,7 +3693,8 @@ | |||
| "description": "Maximum effective-token (ET) budget as a numeric string." | |||
| } | |||
| ], | |||
| "description": "Explicit ET budget control for firewall cost enforcement. Defaults to 10000000 when omitted." | |||
| "default": 25000000, | |||
🧪 Test Quality Sentinel ReportTest Quality Score: 80/100✅ Excellent test quality
Test Classification Details
AnalysisBoth changes are straightforward behavioral contract updates reflecting the new
Build tag: Test Inflation NoteTest file: +3 additions / Production file ( Verdict
📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does:
Implementation Tests (Low Value) verify how the system does it:
Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators. Language SupportTests analyzed:
References: §25667079717
|
There was a problem hiding this comment.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · ● 5.5M
| const DefaultMaxEffectiveTokens int64 = 25000000 | ||
|
|
||
| // DefaultMaxRuns is the default AWF invocation cap enforced by the AWF API proxy. | ||
| const DefaultMaxRuns = 100 |
There was a problem hiding this comment.
[/tdd] DefaultMaxRuns is an untyped constant, while DefaultMaxEffectiveTokens is explicitly typed as int64. Since GetMaxRuns() returns int and the struct field is MaxRuns int, the constant should carry an explicit type for consistency and to catch accidental misuse:
const DefaultMaxRuns int = 100Untyped integer constants quietly satisfy any numeric type, which can hide narrowing bugs at call sites.
| @@ -154,7 +155,7 @@ func TestBuildAWFConfigJSON(t *testing.T) { | |||
|
|
|||
There was a problem hiding this comment.
[/tdd] The renamed test covers the path where WorkflowData is nil — great. There's now an additional observable behavior introduced in this PR: GetMaxRuns() falls back to DefaultMaxRuns when EngineConfig.MaxRuns is zero (i.e. explicitly set to 0 or left uninitialized). A direct unit test on GetMaxRuns() for this path would lock in the new contract:
func TestGetMaxRuns_ZeroValueFallsBackToDefault(t *testing.T) {
e := &EngineConfig{MaxRuns: 0}
assert.Equal(t, constants.DefaultMaxRuns, e.GetMaxRuns(),
"zero MaxRuns should fall back to DefaultMaxRuns")
}Without this, the fallback inside GetMaxRuns() is only tested indirectly through BuildAWFConfigJSON.
|
@copilot review all comments |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
This reverts commit 5aa1d64. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done. I reviewed and addressed the actionable review feedback. Fixed in
|
|
@copilot make sure those fields can be imported by shared agentic workflows and support github actions expressions (${{...) |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed in
|
max-runs=100 and max-effective-tokens=25M…default Adds a glossary entry for the top-level `max-effective-tokens` frontmatter field introduced for AWF apiProxy enforcement, mirroring the existing `max-runs` pattern. Updates the `max-runs` entry to mention the default value of 100, set by PR #31484. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
✨ Enhancement
What does this improve?
This PR raises default frontmatter limits (
max-runs=100,max-effective-tokens=25M) and makes those fields work consistently with shared imports and GitHub Actions expressions.Why is this valuable?
Shared agentic workflows can define these limits once for consumers, and workflows can now use
${{ ... }}expressions for both fields without schema validation failures.Implementation approach:
apiProxy.maxRuns/apiProxy.maxEffectiveTokensare emitted with default values when omitted.max-runsandmax-effective-tokensfrom shared workflows (with consumer override preserved).max-effective-tokens: "0"apiProxyconfig.