Skip to content

Align model overlay parsed-to-raw fallback behavior - #78941

Merged
pelikhan merged 5 commits into
mainfrom
copilot/refactor-align-model-overlay-rules
Nov 18, 2026
Merged

pelikhan merged 5 commits into
mainfrom
copilot/refactor-align-model-overlay-rules

Conversation

@gh-aw-bot

@gh-aw-bot gh-aw-bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Model cost overlays and policy overlays used different fallback rules when parsed frontmatter lacked usable values. This could discard raw models.providers data instead of falling back consistently.

  • Fallback behavior: Costs now use parsed providers when non-empty, otherwise fall back to raw models.providers. Policy retains its field-specific predicate: parsed allowed or blocked entries take precedence; otherwise raw lists are used.
  • Shared lookup: Added a common raw models section lookup for costs, policy, and default pricing extraction.
  • Regression coverage: Added cases for unusable or empty parsed costs, empty parsed policy, and nil parsed frontmatter.
if parsedProvidersAreUsable {
    return parsedProviders
}
return rawModelsSection(frontmatter)["providers"]

gh-aw-bot and others added 2 commits November 18, 2026 05:30
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>
@gh-aw-bot gh-aw-bot changed the title [WIP] Refactor model overlay fallback rules in workflow_builder_model_overlays.go Align model overlay parsed-to-raw fallback behavior Nov 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Triage

  • Category: bug
  • Risk: medium
  • Total score: 58/100 (impact 32 + urgency 16 + quality 10)
  • Recommended action: fast_track
  • CI: passing across build/test, lint, impacted-go-tests, and security gates.

This is a small but product-relevant fallback fix in model overlay parsing, and it includes regression coverage for the affected edge cases.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~5 AIC · ⌖ ~1 AIC · ⊞ 14.5K · ◷

@pelikhan
pelikhan marked this pull request as ready for review November 18, 2026 07:15
Copilot AI adaptive review requested due to automatic review settings November 18, 2026 07:15
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

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.

Generated by PR Specification Reviewer for #78941 · copilot · gpt56 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.7K · ◷

@github-actions

github-actions Bot commented Nov 18, 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.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

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.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K · ◷

@github-actions

github-actions Bot commented Nov 18, 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 · copilot · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #78941 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@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 falls back to raw model providers when parsed providers are unavailable and shares the raw models lookup. It also adds fallback tests.

Should fix

  1. 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 {

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

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.

Reused modelOverlayMap at all three raw models lookup sites and removed the duplicate helper. Committed as dfe0225.

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-00825468-5c82-463b-8ea3-3b37537025c0","parents":[],"payload":{"id":"ldg-73d36d55-0c49-41ae-884a-761750669d06","operation":"append","value":{"finding_count":0,"head_sha":"5e6f42221211e3510e650e65d11713d9b3d7e6b8","outcome":"aligned"}},"sha":"sha256:46ce085edadef8d61308da5ab924d30e7192d1391a41ee318e96a4a42a16418d","timestamp":"2026-11-18T07:22:27.666Z","type":"ledger_append","version":1}
History

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

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

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-6070b992-269f-46d1-9228-d53bff642649","parents":[],"payload":{"id":"ldg-5a8e0c9c-2357-4fc6-a5c7-7fc0334de2fa","operation":"append","value":{"finding_count":0,"head_sha":"5e6f42221211e3510e650e65d11713d9b3d7e6b8","outcome":"no_findings"}},"sha":"sha256:cebbbf8e7330bf79953670dc7336a4a43da3c3bed1f944dc949b1575d1c1496a","timestamp":"2026-11-18T07:24:10.004Z","type":"ledger_append","version":1}
History

@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 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_FallsBackToRawFrontmatter previously used a nil parsedFrontmatter. It now uses &FrontmatterConfig{}, so the nil guard in extractMainModelPolicyOverlay is no longer covered. See the inline comment.
  • Description vs. code: The PR body says policy uses a "field-specific predicate", but extractMainModelPolicyOverlay gates on len(allowed) > 0 || len(blocked) > 0 and returns both fields together. Both parsed and raw values come from the same models map via parseModelPolicyList, 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

  • ✅ rawModelsSection removes the duplicated frontmatter["models"] type assertions across costs, policy, and default pricing.
  • ✅ modelOverlayMap makes 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{},

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

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.

Restored the nil parsed-frontmatter case alongside the empty case, asserting both allowed and blocked raw policy fallback. Committed as dfe0225.

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.

🟢 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.providers when parsed providers are empty or unusable.
  • Shares raw models lookup 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)

@gh-aw-bot

Copy link
Copy Markdown
Collaborator Author

@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/workflow_builder_model_overlays.go:12): address unresolved feedback - Review comment
  3. Review (pkg/workflow/workflow_builder_model_policy_test.go:87): 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": "5e6f42221211e3510e650e65d11713d9b3d7e6b8",
  "kind": "requested",
  "schema_version": "1",
  "state": "c07bf11d96c9ce3b8d0b59b0281c9d716df0cdf76eea2d4309deb2e8f8a7690b",
  "work": [
    "08bf98f1aa8d29b6800b4015c3511aae4e849eea5fe0f1447b5b1cccc092fcc2",
    "8992a5c62d0d471773df5a53c8d80ff6d798dc7647abccfdd93e1bf535c4f49a"
  ],
  "workflow": "pr-sous-chef"
}

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

gh-aw-bot and others added 2 commits November 18, 2026 07:51
…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>
@github-actions

Copy link
Copy Markdown
Contributor

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.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~6 AIC · ⌖ ~1 AIC · ⊞ 13K · ◷

@pelikhan
pelikhan merged commit fdba72f into main Nov 18, 2026
82 checks passed
@pelikhan
pelikhan deleted the copilot/refactor-align-model-overlay-rules branch November 18, 2026 22:02
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.

[refactor] Align model overlay fallback rules in workflow_builder_model_overlays.go

4 participants