Refactor AI credits pricing to a single shared type and schema ref#47723
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot default ai pricing also support cached write, read, etc... unify to a single type with all the field (see awf spec)_ |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated in 977dea2. |
🤖 PR Triage
Score breakdown: Impact 20 · Urgency 8 · Quality 10 Summary: DRAFT. Unifies AI credits pricing Go type and JSON schema — valid cleanup but no urgency. No reviews yet. Defer until draft is ready and higher-priority work is cleared. Next action: Author should undraft when ready for review.
|
|
Great work on this refactor! 👏 This PR beautifully consolidates the AI credits pricing representation across the codebase — unifying the schema definition and Go types while maintaining stricter validation for the default pricing config. What stands out:
This looks ready for core team review. The refactor should make pricing handling more maintainable and less error-prone going forward. 🎯
|
🤖 PR Triage
Rationale: DRAFT. Schema/type unification for AI credits pricing. Non-critical path refactor; good description but still a draft with no CI. Defer until undrafted and CI passes.
|
|
@copilot resolve the merge conflicts on this branch. |
There was a problem hiding this comment.
Pull request overview
Unifies AI credit pricing types and schema references across workflow parsing and AWF config generation.
Changes:
- Reuses
AiCreditsPricingConfig, including cache pricing fields. - Shares the pricing schema while retaining strict fallback validation.
- Adds schema, extraction, serialization, and workflow coverage.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/workflow_builder.go |
Extracts cache pricing. |
pkg/workflow/sandbox.go |
Adds JSON tags and cache fields. |
pkg/workflow/frontmatter_extraction_security_test.go |
Tests cache extraction. |
pkg/workflow/awf_config.go |
Reuses the shared pricing type. |
pkg/workflow/awf_config_test.go |
Tests AWF cache pricing output. |
pkg/parser/schemas/main_workflow_schema.json |
Unifies pricing schemas. |
pkg/parser/schema_test.go |
Tests pricing validation behavior. |
.github/workflows/daily-byok-ollama-test.lock.yml |
Regenerates fallback pricing output. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Medium
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in |
|
@copilot please run the Run: https://github.com/github/gh-aw/actions/runs/30110451496
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Done on branch head
Checks on prior heads are now stale after the new push from this agent. I can’t reliably retrigger PR CI from this environment; a maintainer should re-trigger checks (close/reopen PR, workflow_dispatch, or a maintainer push). |
|
@copilot please run the Unresolved review feedback: Run: https://github.com/github/gh-aw/actions/runs/30115096773
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Done on head
|
🤖 PR Triage
Rationale: Unifies AI credits pricing representation across Go types and JSON schema. Well-described with added schema behavior tests. CI mostly passing but Blockers:
|
|
@copilot please run the Failed checks on the latest head: Run: https://github.com/github/gh-aw/actions/runs/30117832197
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |
models.providers.*.models.*.costandmodels.default-ai-credits-pricingdiverged in representation, which made pricing handling inconsistent across workflow parsing and AWF config emission. This PR unifies both paths around one Go type and one schema ref while preserving stricter constraints for default fallback pricing.Go type unification
AiCreditsPricingConfigfor AWFapiProxy.defaultAiCreditsPricinginstead of a duplicate AWF-only struct.AiCreditsPricingConfigso serialized config remains{"input": ..., "output": ...}.Schema unification
$defs/ai_credits_pricingformodels.providers.*.models.*.cost.models.default-ai-credits-pricingstrict (input/outputrequired, numeric, non-negative) viaallOflayering on top of the shared ref.Schema behavior coverage
models.providerspricing:PR Sous Chef run marker
Run: https://github.com/github/gh-aw/actions/runs/30117832197