Skip to content

Separate authored pricing overrides from reporting costs - #77326

Merged
pelikhan merged 10 commits into
mainfrom
copilot/migrate-compiler-defaults
Nov 13, 2026
Merged

pelikhan merged 10 commits into
mainfrom
copilot/migrate-compiler-defaults

Conversation

Copilot AI commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Separate pricing data: ModelCosts retains reporting metadata; ModelCostOverrides holds explicit frontmatter/import pricing.
  • Limit proxy overrides: apiProxy.providers reads only ModelCostOverrides, including in detection workflows.
workflowData.ModelCostOverrides = mergedModelCosts
workflowData.ModelCosts = c.resolveModelPricingIfMissing(mergedModelCosts, workflowData)

Copilot AI changed the title [WIP] Migrate compiler defaults to AWF-owned pricing Separate authored pricing overrides from reporting costs Nov 13, 2026
Copilot AI requested a review from lpcox November 13, 2026 04:14
@lpcox
lpcox marked this pull request as ready for review November 13, 2026 04:15
Copilot AI adaptive review requested due to automatic review settings November 13, 2026 04:15
@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_no_action

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.

Generated from PR Specification Reviewer · gpt56 · ~3 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

Generated by PR Specification Reviewer for #77326

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #77326

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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 BuildAWFConfigJSON test 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

Comment thread pkg/workflow/awf_config_test.go Outdated
assert.Nil(t, extractModelCostProviders(workflowData))
})

t.Run("ignores reporting-only model costs and preserves explicit zero rates", func(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the duplicate subtest; the existing BuildAWFConfigJSON coverage already verifies reporting-only prices and explicit zero-rate overrides. Commit cfbb330.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/77326-separate-authored-pricing-overrides-from-reporting-costs.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch. It was generated from the PR diff and linked issue Migrate compiler defaults and cost reporting to AWF-owned pricing #77325.

  2. Complete the open items marked [TODO: verify]: the Deciders field, and whether models priced only by gh-aw's embedded catalog are covered by AWF's pricing table. Those models may now hit AWF's unknown-model AI-credits path unless the author adds explicit models.providers pricing.

  3. Commit the finalized ADR to docs/adr/ on your branch.

  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-77326: Separate Authored Pricing Overrides from Reporting Costs (link unavailable: invalid HTTPS URL)

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

🔗 Related decision: ADR-48107

ADR-48107 (link unavailable: invalid HTTPS URL) (Draft) decided that models.providers overlays from ModelCosts are embedded in apiProxy.providers. This PR narrows that decision: only ModelCostOverrides (explicit authored pricing) now reaches AWF, and compiler-resolved reporting prices stay in ModelCosts. When ADR-77326 is finalized, ADR-48107 should be marked superseded or amended.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context: What is the problem? What forces are at play?
  • Decision: What did you decide? Why?
  • Alternatives Considered: What else could have been done?
  • Consequences: What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number (for example, 0042-use-postgresql.md for PR #42).

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: ModelCosts and ModelCostOverrides share one map at workflow_builder.go:256. The copy in mergeModelPricingIntoModelCosts keeps it correct today, but nothing enforces that.
  • Detection propagation untested: buildThreatDetectionWorkflowData has no test that checks the two fields carry through.
  • Intended behaviour change: catalog-resolved prices no longer reach AWF as apiProxy.providers. The max-ai-credits tests 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: ModelCostOverrides is the only source for proxy overrides, and reporting data stays in ModelCosts.
  • ✅ Explicit zero rates are preserved as overrides and covered by a test.
  • ✅ Good regression tests for both the reporting-only and override-only paths.
  • ✅ gofmt is 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

Comment thread pkg/workflow/workflow_builder.go Outdated
mergedModelCosts := mergeModelCostOverlays(importsResult.MergedModelCosts, mainModelCosts)
if len(mergedModelCosts) > 0 {
workflowData.ModelCostOverrides = mergedModelCosts
workflowData.ModelCosts = mergedModelCosts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added direct buildThreatDetectionWorkflowData coverage for both pricing fields and confirmed reporting-only costs produce no proxy providers. Commit cfbb330.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/awf_config_test.go:1838): address unresolved feedback - Review comment
  3. Review (pkg/workflow/workflow_builder.go:256): address unresolved feedback - Review comment
  4. Review (pkg/workflow/threat_detection_external.go:173): address unresolved feedback - Review comment

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"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

@lpcox

lpcox commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Fix failing check impacted-go-tests (FAILURE): Check run.

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"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

Triage

  • Category: bug
  • Risk: medium
  • Score: 62 (impact 32 + urgency 17 + quality 13)
  • Recommended action: batch_review
  • Reason: pricing override bug fix in a critical workflow path but still scoped and internally consistent.
  • Batch: pr-batch:model-routing-and-audit

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~8 AIC · ⌖ ~2 AIC · ⊞ 15.9K · ◷

@pelikhan

Copy link
Copy Markdown
Collaborator

/smoke-copilot

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this issue comment. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

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).

📰 BREAKING: Report filed by Smoke Copilot · copilot · auto (Claude Sonnet 5.5) · ~29 AIC · ⌖ ~1 AIC · ⊞ 8.2K · ◷
Comment /smoke-copilot to run again
Add label smoke to run again

@pelikhan
pelikhan merged commit 09794b2 into main Nov 13, 2026
79 of 81 checks passed
@pelikhan
pelikhan deleted the copilot/migrate-compiler-defaults branch November 13, 2026 14:06
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate compiler defaults and cost reporting to AWF-owned pricing

5 participants