Repository navigation
Align model overlay parsed-to-raw fallback behavior - #78941
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Triage
This is a small but product-relevant fallback fix in model overlay parsing, and it includes regression coverage for the affected edge cases.
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ 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.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. 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. ✅
|
|
✅ Ponytail Reviewer completed successfully!
|
There was a problem hiding this comment.
What this change does: It falls back to raw model providers when parsed providers are unavailable and shares the raw models lookup. It also adds fallback tests.
Should fix
- Reuse the existing map conversion helper, as noted inline.
Verdict: fix 1 first.
Lean: -8 lines possible.
Generated by ✂️ Ponytail Reviewer for #78941 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185
Comment /ponytail to run again
| return map[string]any{"providers": providersMap} | ||
| } | ||
| } | ||
| func rawModelsSection(frontmatter map[string]any) map[string]any { |
There was a problem hiding this comment.
Should fix: rawModelsSection duplicates modelOverlayMap in this file. Call modelOverlayMap(frontmatter["models"]) at the three sites and delete this helper; both return the same map or nil, so this removes a duplicate conversion to maintain.
There was a problem hiding this comment.
Reused modelOverlayMap at all three raw models lookup sites and removed the duplicate helper. Committed as dfe0225.
Comment MemoryPeek at saved memory (spec-review-history)History |
There was a problem hiding this comment.
Review completed with no actionable findings on the changed lines. The parsed-to-raw fallback behavior is covered by the added regression cases; no correctness, performance, or security issue was identified.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again
Comment MemoryPeek at saved memory (review-history)History |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. The fallback logic is correct and the targeted overlay tests pass locally. One coverage gap and one wording mismatch to address; neither blocks merge.
📋 Key Themes & Highlights
Key Themes
- Test coverage gap: The policy test
TestExtractMainModelPolicyOverlay_FallsBackToRawFrontmatterpreviously used a nilparsedFrontmatter. It now uses&FrontmatterConfig{}, so the nil guard inextractMainModelPolicyOverlayis no longer covered. See the inline comment. - Description vs. code: The PR body says policy uses a "field-specific predicate", but
extractMainModelPolicyOverlaygates onlen(allowed) > 0 || len(blocked) > 0and returns both fields together. Both parsed and raw values come from the samemodelsmap viaparseModelPolicyList, so the two paths should not diverge in practice. Consider rewording the PR body, or make the predicate per-field if that was the intent.
Positive Highlights
- ✅
rawModelsSectionremoves the duplicatedfrontmatter["models"]type assertions across costs, policy, and default pricing. - ✅
modelOverlayMapmakes non-map parsed provider values fall back cleanly. - ✅ The cost fallback test covers unusable parsed costs, empty parsed costs, and nil parsed frontmatter.
@copilot please address the review comment above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| func TestExtractMainModelPolicyOverlay_FallsBackToRawFrontmatter(t *testing.T) { | ||
| toolsResult := &toolsProcessingResult{} | ||
| toolsResult := &toolsProcessingResult{ | ||
| parsedFrontmatter: &FrontmatterConfig{}, |
There was a problem hiding this comment.
[/diagnosing-bugs] This change drops the nil parsedFrontmatter case from the policy fallback test. The nil guard at workflow_builder_model_overlays.go:129 is no longer exercised, so a regression there would go unnoticed. Keep a nil case in this test.
💡 Suggested test
for _, parsed := range []*FrontmatterConfig{nil, {}} {
toolsResult := &toolsProcessingResult{parsedFrontmatter: parsed}
policy := extractMainModelPolicyOverlay(toolsResult, frontmatter)
require.NotNil(t, policy)
assert.Equal(t, []string{"gpt-5-mini"}, policy["allowed"])
}Nil and empty parsed frontmatter should both fall back to the raw models section.
@copilot please address this.
There was a problem hiding this comment.
Restored the nil parsed-frontmatter case alongside the empty case, asserting both allowed and blocked raw policy fallback. Committed as dfe0225.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the model-overlay fallback changes.
No open issues 🎉
What changed in this PR
Aligns model overlay fallback behavior in the workflow compiler, addressing #78890 while preserving policy-specific precedence rules.
Changes:
- Falls back to raw
models.providerswhen parsed providers are empty or unusable. - Shares raw
modelslookup across cost, policy, and default pricing extraction. - Adds regression coverage for unavailable parsed costs and empty parsed policy.
| File | Description |
|---|---|
pkg/workflow/workflow_builder_model_policy_test.go |
Covers missing providers, empty parsed costs and policy, and nil parsed frontmatter. |
pkg/workflow/workflow_builder_model_overlays.go |
Aligns cost fallback behavior and centralizes raw model-section lookup. |
Review effort: Balanced (adaptive)
|
🍳 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": "5e6f42221211e3510e650e65d11713d9b3d7e6b8",
"kind": "requested",
"schema_version": "1",
"state": "c07bf11d96c9ce3b8d0b59b0281c9d716df0cdf76eea2d4309deb2e8f8a7690b",
"work": [
"08bf98f1aa8d29b6800b4015c3511aae4e849eea5fe0f1447b5b1cccc092fcc2",
"8992a5c62d0d471773df5a53c8d80ff6d798dc7647abccfdd93e1bf535c4f49a"
],
"workflow": "pr-sous-chef"
}
|
…n-model-overlay-rules Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
Category: bug | Risk: medium | Score 72/100 (impact 34 + urgency 23 + quality 15) | Action: fast_track | Reason: fallback fix addresses inconsistent model overlay behavior and is likely to affect default runtime behavior.
|
Model cost overlays and policy overlays used different fallback rules when parsed frontmatter lacked usable values. This could discard raw
models.providersdata instead of falling back consistently.models.providers. Policy retains its field-specific predicate: parsedallowedorblockedentries take precedence; otherwise raw lists are used.modelssection lookup for costs, policy, and default pricing extraction.