Sync AWF v0.25.43 spec updates and wire apiProxy.modelMultipliers/apiProxy.maxRuns usage#31398
Sync AWF v0.25.43 spec updates and wire apiProxy.modelMultipliers/apiProxy.maxRuns usage#31398
apiProxy.modelMultipliers/apiProxy.maxRuns usage#31398Conversation
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>
apiProxy.modelMultipliers usage
There was a problem hiding this comment.
Pull request overview
This PR syncs gh-aw’s embedded AWF config schema to the latest gh-aw-firewall surface area and wires existing workflow engine.token-weights.multipliers inputs into generated AWF config via apiProxy.modelMultipliers.
Changes:
- Updated the embedded AWF JSON schema snapshot and drift-tracking documentation to reflect newly available config paths.
- Extended AWF config generation to emit
apiProxy.modelMultiplierswhen token-weight multipliers are present. - Added tests covering emission and omission of
modelMultipliers.
Show a summary per file
| File | Description |
|---|---|
specs/awf-config-sources-spec.md |
Tracks newly introduced schema paths in the “known drift” list. |
pkg/workflow/schemas/awf-config.schema.json |
Syncs embedded AWF schema and adds new config surface area (auth, maxRuns, dockerHostPathPrefix, etc.). |
pkg/workflow/awf_config.go |
Emits apiProxy.modelMultipliers derived from engine.token-weights.multipliers. |
pkg/workflow/awf_config_test.go |
Adds tests for modelMultipliers emission/omission behavior. |
.changeset/patch-awf-spec-sync-v0-25-43.md |
Adds a patch changeset entry describing the schema sync + new emission behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 3
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "$id": "https://github.com/github/gh-aw-firewall/releases/download/v0.25.38/awf-config.schema.json", | ||
| "$id": "https://raw.githubusercontent.com/github/gh-aw-firewall/main/docs/awf-config.schema.json", | ||
| "title": "AWF Configuration", |
| apiProxy := &AWFAPIProxyConfig{ | ||
| Enabled: true, | ||
| MaxEffectiveTokens: maxEffectiveTokens, | ||
| } | ||
|
|
||
| if modelMultipliers := extractModelMultipliers(config.WorkflowData); len(modelMultipliers) > 0 { | ||
| apiProxy.ModelMultipliers = modelMultipliers | ||
| awfConfigLog.Printf("API proxy: %d model multipliers configured", len(apiProxy.ModelMultipliers)) | ||
| } |
| if len(workflowData.EngineConfig.TokenWeights.Multipliers) == 0 { | ||
| return nil | ||
| } | ||
| return workflowData.EngineConfig.TokenWeights.Multipliers |
🧪 Test Quality Sentinel ReportTest Quality Score: 75/100
Test Classification Details
ObservationsTest inflation (minor)The test file gained 50 lines against the production file's 18 lines (ratio ≈ 2.8:1, threshold 2:1). This is largely due to the verbose Error-path coverage (suggestion)Neither new sub-test exercises an error return from Build tag ✅
Assertion messages ✅All assertions include descriptive message strings. No mock libraries ✅Real component interactions — no Verdict
📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does — observable outputs, state changes, error handling — and catch behavioral regressions if deleted. Implementation Tests (Low Value) verify how the system works internally — prone to breaking on legitimate refactoring even when behavior is correct. References: §25647329883
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 75/100. Test quality is acceptable — 0% of new tests are implementation tests (threshold: 30%). Both new sub-tests verify observable JSON output (behavioral contracts). Minor suggestion: consider adding nil-branch table rows to cover the three nil guards in extractModelMultipliers.
There was a problem hiding this comment.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · ● 3.9M
| @@ -324,3 +332,13 @@ | |||
| } | |||
There was a problem hiding this comment.
[/tdd] extractModelMultipliers returns the original map directly — if BuildAWFConfigJSON ever mutates apiProxy.ModelMultipliers post-assignment (e.g. filtering zero values), it would silently corrupt the caller's WorkflowData. Consider returning a shallow copy:
result := make(map[string]float64, len(workflowData.EngineConfig.TokenWeights.Multipliers))
for k, v := range workflowData.EngineConfig.TokenWeights.Multipliers {
result[k] = v
}
return resultThis is also the right place to enforce the schema's exclusiveMinimum: 0 constraint — filter or reject zero/negative entries before they propagate to JSON generation.
| assert.NotContains(t, jsonStr, `"modelMultipliers"`, "apiProxy should omit modelMultipliers when empty") | ||
| }) | ||
|
|
||
| t.Run("anthropic API target is included in apiProxy targets", func(t *testing.T) { |
There was a problem hiding this comment.
[/tdd] The two new test cases exercise the empty-multipliers path but not the nil-EngineConfig or nil-TokenWeights guard branches in extractModelMultipliers. Since those nil paths flow through the public BuildAWFConfigJSON function, they can be tested without reaching into the private function:
t.Run("apiProxy modelMultipliers omitted when EngineConfig is nil", func(t *testing.T) {
config := AWFCommandConfig{
EngineName: "copilot",
AllowedDomains: "github.com",
WorkflowData: &WorkflowData{
// EngineConfig intentionally nil
NetworkPermissions: &NetworkPermissions{
Firewall: &FirewallConfig{Enabled: true},
},
},
}
jsonStr, err := BuildAWFConfigJSON(config)
require.NoError(t, err)
assert.NotContains(t, jsonStr, `"modelMultipliers"`, "apiProxy should omit modelMultipliers when EngineConfig is nil")
})This ensures the guard clauses are exercised through the same public interface the rest of the tests use.
|
Commit pushed:
|
🏗️ Design Decision Gate — ADR RequiredThis PR introduces significant changes to core business logic (190 new lines in AI has analyzed the PR diff and generated a draft ADR to help you get started: 📄 Draft ADR: The draft has been committed to this PR's branch ( What to do next
Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision. What the draft capturedThe draft identifies two coupled decisions in this PR:
The second decision is the more architecturally significant one — it gives Why ADRs Matter
ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
This repository's ADRs also include a Part 2 — Normative Specification in RFC 2119 language to make the decision machine-checkable. The draft for this PR follows that two-part structure. All ADRs are stored in References: §25647329877
|
|
@copilot also wore a top level max-runs field to the maxRuns in config |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
apiProxy.modelMultipliers usageapiProxy.modelMultipliers/apiProxy.maxRuns usage
✨ Enhancement
This PR aligns
gh-awwith the latestgh-aw-firewallrelease updates referenced in #31379 by syncing the embedded AWF config schema and updating feature usage in config generation. It also updates internal drift documentation so new AWF config surface is explicitly tracked.What does this improve?
gh-awnow emits newly supported AWF config features from existing workflow inputs:apiProxy.modelMultipliersfromengine.token-weights.multipliersapiProxy.maxRunsfromuser-rate-limit.max-runs-per-windowIt also carries the current schema contract from firewall
v0.25.43.Why is this valuable?
It reduces schema/implementation drift and ensures current AWF capabilities are expressed through
gh-awwithout requiring new frontmatter fields.Implementation approach:
Schema alignment
pkg/workflow/schemas/awf-config.schema.jsonto the latest firewall spec snapshot, including new fields such as:apiProxy.maxRunsapiProxy.auth.*container.dockerHostPathPrefixFeature usage update
apiProxy.modelMultiplierswhenengine.token-weights.multipliersis configuredapiProxy.maxRunswhenuser-rate-limit.max-runs-per-windowis configuredDrift-spec refresh
specs/awf-config-sources-spec.md“known drift” coverage list to include the newly introduced config paths.Coverage updates
modelMultiplierswhen configuredmaxRunswhen rate limit max is configured{ "apiProxy": { "enabled": true, "maxEffectiveTokens": 10000000, "maxRuns": 7, "modelMultipliers": { "gpt-5": 1.2, "gpt-5-mini": 0.8 } } }