Skip to content

Guard default AI credits pricing for unsupported AWF pins - #50041

Merged
pelikhan merged 4 commits into
mainfrom
copilot/fix-api-proxy-pricing-issue
Aug 3, 2026
Merged

Guard default AI credits pricing for unsupported AWF pins#50041
pelikhan merged 4 commits into
mainfrom
copilot/fix-api-proxy-pricing-issue

Conversation

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

models.default-ai-credits-pricing compiled into awf-config.json, but AWF v0.27.42 dropped apiProxy.defaultAiCreditsPricing during config resolution, so the API proxy never received AWF_DEFAULT_AI_CREDITS_PRICING and rejected unknown models.

  • Version compatibility

    • Added AWFDefaultAiCreditsPricingMinVersion at v0.27.43, the first AWF version where the field survives resolution into the API proxy environment.
    • Added an awfSupportsDefaultAiCreditsPricing helper alongside existing AWF feature gates.
  • Compiler validation

    • Rejects models.default-ai-credits-pricing when the effective AWF version is too old, including both:
      • network.firewall.version
      • sandbox.agent.version
  • Regression coverage

    • Added tests for the known-broken v0.27.42 pin and the supported minimum version.

Example rejected config:

models:
  default-ai-credits-pricing:
    input: 5.0
    output: 25.0

sandbox:
  agent:
    version: v0.27.42

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 7.59 AIC · ⌖ 5.99 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix apiProxy.defaultAiCreditsPricing drop during AWF config resolution Guard default AI credits pricing for unsupported AWF pins Aug 3, 2026
Copilot AI requested a review from pelikhan August 3, 2026 17:17
@pelikhan
pelikhan marked this pull request as ready for review August 3, 2026 18:10
Copilot AI review requested due to automatic review settings August 3, 2026 18:10
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (72 additions detected).

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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

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.

Pull request overview

Adds an AWF version guard so unsupported pins cannot silently drop default AI-credit pricing.

Changes:

  • Defines v0.27.43 as the minimum supported AWF version.
  • Validates firewall and sandbox-agent version pins.
  • Adds regression tests and a patch changeset.
Show a summary per file
File Description
pkg/workflow/model_costs_pricing_validation.go Enforces the AWF minimum version.
pkg/workflow/model_costs_pricing_validation_test.go Tests unsupported and minimum versions.
pkg/workflow/awf_helpers.go Adds the feature-support helper.
pkg/constants/version_constants.go Defines the minimum version constant.
.changeset/patch-awf-default-ai-credits-pricing-version-guard.md Documents the compatibility guard.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Balanced

}
firewallConfig := getFirewallConfig(workflowData)
if !awfSupportsDefaultAiCreditsPricing(firewallConfig) {
return fmt.Errorf("models.default-ai-credits-pricing requires AWF %s or newer; pinned AWF version %q drops apiProxy.defaultAiCreditsPricing during config resolution", constants.AWFDefaultAiCreditsPricingMinVersion, getAWFImageTag(firewallConfig))
Comment on lines +21 to +22
firewallConfig := getFirewallConfig(workflowData)
if !awfSupportsDefaultAiCreditsPricing(firewallConfig) {

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

The implementation looks correct and complete.

  • getFirewallConfig already handles sandbox.agent.version override, so both firewall-pinned and sandbox-only version paths are correctly guarded.
  • Error message is clear and actionable, including the minimum required version and the dropped field name.
  • Tests cover the known-broken v0.27.42 pin, the sandbox-only override path, and the minimum supported version.

No blocking issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 22.9 AIC · ⌖ 10.4 AIC · ⊞ 5.4K

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 80/100 — Excellent

Analyzed 3 test(s): 3 design, 0 implementation, 0 violation(s).

📊 Metrics (3 tests)
Metric Value
Analyzed 3 (Go: 3, JS: 0)
✅ Design 3 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 2 (67%)
Duplicate clusters 0
Inflation Yes (52 test lines / 20 prod lines ≈ 2.6:1)
🚨 Violations 0
Test File Classification Issues
pinned AWF version with config resolution bug is rejected model_costs_pricing_validation_test.go:28 behavioral_contract, high_value, design_test None
sandbox agent AWF version override with config resolution bug is rejected model_costs_pricing_validation_test.go:47 behavioral_contract, high_value, design_test None
minimum AWF version is valid model_costs_pricing_validation_test.go:65 behavioral_contract, high_value, design_test None

Verdict

passed. 0% implementation tests (threshold: 30%). All 3 tests enforce behavioral contracts for the new AWF version guard. Minor inflation (2.6:1) reflects 3 distinct scenarios for a 4-line production change.

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 · 41.3 AIC · ⌖ 8.24 AIC · ⊞ 8.4K ·
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.

✅ Test Quality Sentinel: 80/100. 0% implementation tests (threshold: 30%). All tests enforce behavioral contracts.

@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 — one minor finding on error message fidelity; overall the change is solid.

📋 Key Themes & Highlights

Finding

  • Error message version format: getAWFImageTag strips the v prefix, so the error message prints 0.27.42 when users write v0.27.42 in their YAML. See inline comment on line 21 of model_costs_pricing_validation.go.

Positive Highlights

  • ✅ Version constant placed consistently alongside all other AWF feature-gate constants
  • awfSupportsDefaultAiCreditsPricing follows the established helper pattern exactly
  • ✅ Three regression tests cover the broken pin, sandbox agent override path, and minimum supported version
  • DefaultFirewallVersion was already bumped to v0.27.43, so the no-pin path is safe by default
  • ✅ Changeset entry is clear and accurate

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 40.1 AIC · ⌖ 7.95 AIC · ⊞ 7.1K
Comment /matt to run again

if p == nil {
return nil
}
firewallConfig := getFirewallConfig(workflowData)

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] getAWFImageTag strips the v prefix (returns 0.27.42 not v0.27.42), so the error message pinned-version quote won't match what users typed in their YAML. Consider using firewallConfig.Version directly in the error string to preserve fidelity.

The second regression test already asserts Contains(err.Error(), "0.27.42") without v, so it passes either way — but users seeing the CLI error will be confused if their YAML says v0.27.42 and the message echoes 0.27.42.

@copilot please address this.

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

Correctness bug: the new version guard checks the AWF version but ignores whether the firewall/api-proxy is even enabled, so it can reject harmless configs where the feature is a no-op.

💡 Themes
  • The overall approach (version gate + constant + helper, consistent with existing awfSupports* patterns) is sound and well tested for the enabled-firewall case.
  • The one blocking issue: validateDefaultAiCreditsPricing should also check isFirewallEnabled(workflowData) before applying the version gate, mirroring how BuildAWFConfigJSON/extractDefaultAiCreditsPricing only wire this value into the api-proxy config when the firewall path is active. As written, a workflow with sandbox.agent: false (or firewall otherwise disabled) but an old pinned sandbox.agent.version string would be spuriously rejected at compile time even though the buggy AWF config-resolution path is never exercised.
  • No regression test covers the firewall-disabled case, so this gap is not caught by the new tests added in this PR.

🔎 Code quality review by PR Code Quality Reviewer · auto · 73.9 AIC · ⌖ 4.99 AIC · ⊞ 7.9K
Comment /review to run again

return nil
}
firewallConfig := getFirewallConfig(workflowData)
if !awfSupportsDefaultAiCreditsPricing(firewallConfig) {

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.

Blocks harmless configs: this check only inspects the AWF version, not whether the firewall/sandbox is actually enabled.

💡 Details

getFirewallConfig can return FirewallConfig{Enabled: false, Version: agentVersion} when the firewall is disabled via sandbox.agent: false (or network.firewall.enabled: false) but a version is still recorded (carried over from sandbox.agent.version). awfSupportsDefaultAiCreditsPricing only calls awfVersionAtLeast, ignoring firewallConfig.Enabled entirely.

Since DefaultAiCreditsPricing is only wired into the AWF api-proxy config inside BuildAWFConfigJSON, which is only invoked when isFirewallEnabled(workflowData) is true, this new compile-time check will reject models.default-ai-credits-pricing for workflows where the firewall/api-proxy is disabled — even though the feature is a no-op there and the config-resolution bug this PR fixes cannot occur.

Suggested fix:

firewallConfig := getFirewallConfig(workflowData)
if isFirewallEnabled(workflowData) && !awfSupportsDefaultAiCreditsPricing(firewallConfig) {
    return fmt.Errorf(...)
}

No test in this PR covers the "firewall disabled + old pinned version" case, so this gap goes unverified.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot sous-chef triage:

This PR still needs another pass before maintainers can investigate quickly.

  • Open blocking reviews remain from: github-actions
  • Please refresh the branch if needed, address remaining review/CI blockers, then run the pr-finisher skill and post a concise merge-readiness summary for the current head.

Generated by PR Sous Chef · run: https://github.com/github/gh-aw/actions/runs/30841444939

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 7.59 AIC · ⌖ 5.99 AIC · ⊞ 8.3K ·
Comment /souschef to run again

…el_costs_pricing_validation.go

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot sous-chef triage:

This PR still needs another pass before maintainers can investigate quickly....

Addressed the blocking review feedback in commit Fix review feedback: use NewValidationError and update comment:

  1. pkg/workflow/model_costs_pricing_validation.go:23 — replaced fmt.Errorf with NewValidationError (structured field, value, reason, suggestion) to comply with the errormessage linter convention.
  2. pkg/workflow/model_costs_pricing_validation.go:21-22 — updated the function doc comment to document both validation conditions: the AWF version compatibility check and the non-positive price field check.

All tests pass and make agent-report-progress completes cleanly.

Copilot AI requested a review from gh-aw-bot August 3, 2026 18:53
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

PR Triage: #50041

  • Category: bug
  • Risk: medium
  • Score: 51/100 (Impact 28 + Urgency 15 + Quality 8)
  • Recommended action: defer

Guards default AI-credits pricing for unsupported AWF pins. mergeable_state is blocked and CI is still pending.

Generated by 🔧 PR Triage Agent · auto · 51.1 AIC · ⌖ 4.08 AIC · ⊞ 8K ·

@pelikhan
pelikhan merged commit 08d7a61 into main Aug 3, 2026
29 checks passed
@pelikhan
pelikhan deleted the copilot/fix-api-proxy-pricing-issue branch August 3, 2026 20:06
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.4

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.

apiProxy.defaultAiCreditsPricing is dropped during AWF config resolution, making the documented fallback inert

4 participants