Repository navigation
Separate authored pricing overrides from reporting costs - #77326
Conversation
Co-authored-by: lpcox <[email protected]>
Co-authored-by: lpcox <[email protected]>
This comment has been minimized.
This comment has been minimized.
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Ponytail Reviewer completed successfully!
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
What this change does: It keeps compiler-resolved prices for reporting while sending only authored prices to AWF. Detection workflows inherit both sets of prices.
Should fix:
-
Remove the duplicate pricing test (
pkg/workflow/awf_config_test.go:1838)- What this is: This subtest checks that reporting prices are omitted and authored zero rates are preserved.
- Problem: The
BuildAWFConfigJSONtest above checks the same two outcomes through the generated configuration. - Fix: Delete this subtest and keep the configuration test.
- If we skip it: The same fixture and assertions need to be maintained twice.
Reviewed the changed lines and connected pricing and detection flow, assuming ordinary workflow compilation.
Verdict: Ship.
Lean: -30 lines possible.
Generated by ✂️ Ponytail Reviewer for #77326 · codex · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ⊞ 182
Comment /ponytail to run again
| assert.Nil(t, extractModelCostProviders(workflowData)) | ||
| }) | ||
|
|
||
| t.Run("ignores reporting-only model costs and preserves explicit zero rates", func(t *testing.T) { |
There was a problem hiding this comment.
Should fix: This repeats the reporting-only and zero-rate case already checked through BuildAWFConfigJSON above. Delete this subtest; the existing configuration test covers both outcomes, so keeping it adds a second fixture to maintain without adding a distinct case.
There was a problem hiding this comment.
Removed the duplicate subtest; the existing BuildAWFConfigJSON coverage already verifies reporting-only prices and explicit zero-rate overrides. Commit cfbb330.
There was a problem hiding this comment.
Reviewed the changed pricing separation and detection propagation paths, including the added regression coverage. I found no actionable correctness or maintainability issues in the changed lines. Static review only; tests were not run per review instructions.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR). 📄 Draft ADR committed:
📋 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. 🔗 Related decision: ADR-48107ADR-48107 (link unavailable: invalid HTTPS URL) (Draft) decided that 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
All ADRs are stored in
|
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. The split is correct and the targeted tests pass (go test ./pkg/workflow, 7s). Two follow-ups are worth doing before merge.
📋 Key Themes & Highlights
Key Themes
- Aliasing guard:
ModelCostsandModelCostOverridesshare one map atworkflow_builder.go:256. The copy inmergeModelPricingIntoModelCostskeeps it correct today, but nothing enforces that. - Detection propagation untested:
buildThreatDetectionWorkflowDatahas no test that checks the two fields carry through. - Intended behaviour change: catalog-resolved prices no longer reach AWF as
apiProxy.providers. Themax-ai-creditstests now assert this. Confirm that AWF's built-in table covers the models that previously relied on the injected price, or those models will lose proxy pricing.
Positive Highlights
- ✅ Clear separation:
ModelCostOverridesis the only source for proxy overrides, and reporting data stays inModelCosts. - ✅ Explicit zero rates are preserved as overrides and covered by a test.
- ✅ Good regression tests for both the reporting-only and override-only paths.
- ✅
gofmtis clean on all touched files.
@copilot please address the inline comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~6 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| mergedModelCosts := mergeModelCostOverlays(importsResult.MergedModelCosts, mainModelCosts) | ||
| if len(mergedModelCosts) > 0 { | ||
| workflowData.ModelCostOverrides = mergedModelCosts | ||
| workflowData.ModelCosts = mergedModelCosts |
There was a problem hiding this comment.
[/diagnosing-bugs] Both fields now alias the same map here. That is safe only because mergeModelPricingIntoModelCosts copies before writing. A future in-place write to ModelCosts would silently leak reporting prices into apiProxy.providers, which is the bug this PR fixes.
💡 Suggested fix and regression test
Clone at this boundary:
workflowData.ModelCosts = maps.Clone(mergedModelCosts)maps.Clone is shallow, so nested providers maps would still alias. Add a test that mutates ModelCosts["providers"] and asserts ModelCostOverrides is unchanged. If the nested assertion fails, deep-copy providers as well.
@copilot please address this.
There was a problem hiding this comment.
Separated reporting costs with a recursive clone so nested provider/model maps cannot mutate authored overrides; added a regression assertion. Commit cfbb330.
| if len(detectionData.SandboxConfig.Agent.Images) == 0 { | ||
| detectionData.SandboxConfig.Agent.Images = buildThreatDetectionContainerImages(detectionData) | ||
| } | ||
| detectionData.ModelCosts, detectionData.ModelCostOverrides = data.ModelCosts, data.ModelCostOverrides |
There was a problem hiding this comment.
[/tdd] Nothing tests this propagation. TestBuildDetectionEngineExecutionStepPropagatesModelCostsProviders builds WorkflowData by hand, so a regression here would not fail any test. Add a test that calls buildThreatDetectionWorkflowData(data, "") and asserts both fields carry through.
💡 Suggested test
Also cover the reporting-only case: set ModelCosts with no ModelCostOverrides, then assert extractModelCostProviders(detectionData) returns nil. Detection runs must not send reporting prices to the proxy.
@copilot please address this.
There was a problem hiding this comment.
Added direct buildThreatDetectionWorkflowData coverage for both pricing fields and confirmed reporting-only costs produce no proxy providers. Commit cfbb330.
There was a problem hiding this comment.
🟡 Changes recommended
Catalog-only pricing tests fail because they still expect proxy prices when ModelCostOverrides is empty, and the conformance check lacks explicit reporting-metadata assertions.
1 open issue
What changed in this PR
This PR separates gh-aw’s reporting prices from runtime pricing overrides, preserving AWF’s pricing authority while retaining explicitly authored rates.
Changes:
- Store authored pricing separately from compiler-resolved reporting prices.
- Send only authored overrides—including zero rates—to AWF in agent and detection workflows.
- Update regression coverage for the reporting-versus-override boundary.
| File | Description |
|---|---|
pkg/workflow/workflow_data.go |
Adds a separate field for authored pricing overrides. |
pkg/workflow/workflow_builder.go |
Captures overrides before resolving reporting prices. |
pkg/workflow/threat_detection_external.go |
Propagates both pricing fields to detection workflows. |
pkg/workflow/threat_detection_engine_env_test.go |
Uses the override field in detection fixtures. |
pkg/workflow/compiler_types.go |
Clarifies the resolver’s reporting-only purpose in comments. |
pkg/workflow/compiler_model_pricing.go |
Documents that resolved defaults are not AWF overrides. |
pkg/workflow/compiler_model_pricing_test.go |
Tests separation of resolved prices and authored overrides. |
pkg/workflow/awf_config_test.go |
Tests override-only emission and explicit zero rates. |
pkg/workflow/awf_config_build.go |
Reads proxy pricing exclusively from authored overrides. |
pkg/workflow/awf_config_auto_model_ai_credits_test.go |
Expects concrete-model defaults to remain reporting-only. |
Review effort: Max (dynamic)
|
|
||
| func extractModelCostProviders(workflowData *WorkflowData) map[string]any { | ||
| if workflowData == nil || len(workflowData.ModelCosts) == 0 { | ||
| if workflowData == nil || len(workflowData.ModelCostOverrides) == 0 { |
There was a problem hiding this comment.
Addressed in cfbb330: catalog prices are asserted in ModelCosts, proxy providers must be empty without authored pricing, and the conformance test checks GH_AW_INFO_MODEL_COSTS. Both targeted tests pass.
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "30093cd736df6fdd30549bbc49e9630a7809a6dd",
"kind": "requested",
"schema_version": "1",
"state": "553abe8ea1dc2ed7bb9736f237b028750b9243c39804b124adaba2c24e3ffb8f",
"work": [
"843066e6c8811db6bd0bc047f0e3955816d0b19035a77c6190e5aad22d03eef5",
"8f512201b0178fc6ee77c31f98b241617378fd140dbc3b54d856b4a0a970e633",
"fbdb1bf725d06ea5ebbb011a3de2a721686afba4b185e14f2e0d40806772ed26"
],
"workflow": "pr-sous-chef"
}
|
…ler-defaults Co-authored-by: gh-aw-bot <[email protected]>
|
@copilot address review feedback |
Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "b099dfaa64d0fdc7c6638ddba2bf9813b5960a83",
"kind": "requested",
"schema_version": "1",
"state": "77d0aa3be135a60a078e7c590d940437e89c3d7ab04ab5f0b3cabbb0f85271bf",
"work": [
"42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac"
],
"workflow": "pr-sous-chef"
}
|
…ler-defaults Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
Triage
|
|
/smoke-copilot |
|
📰 BREAKING: Smoke Copilot is now investigating this issue comment. Sources say the story is developing... |
|
Smoke Copilot: partial run. ✅ PR query, gh, curl, file, build, sub-agent (fallback), function count. Not run: Serena, Playwright, discussion, upload, dispatch, review tools. Overall: FAIL (incomplete).
|
|
🎉 This pull request is included in a new release. Release: |

Compiler-resolved catalog prices were merged with authored prices and could be sent to AWF as operator overrides, overriding AWF’s pricing authority. Keep automatic prices for reporting while preserving explicitly authored overrides, including zero rates.
ModelCostsretains reporting metadata;ModelCostOverridesholds explicit frontmatter/import pricing.apiProxy.providersreads onlyModelCostOverrides, including in detection workflows.