Skip to content

audit: make smaller-model recommendations routing-aware #77205

Done

Description

@SivaKesava1

Problem

gh aw audit recommends pinning a specific model for some routine tasks, even when the run was already routed at economy. Make this one assessment routing-aware and recommend routing rather than a concrete model.

Verified against main at 741ff0c on November 12, 2026. This issue describes the implementation work; it does not request changes to routing itself.

Current behavior

appendModelDowngradeAssessment emits model_downgrade_available, with severity low, when:

  • The task domain is triage, repo_maintenance, or issue_response.
  • ResourceProfile != "lean"; this is not limited to the heavy profile.
  • ActuationStyle != "write_heavy".

Its fixed text is:

Summary: This [domain label] run may not need a frontier model. A smaller model (e.g. gpt-4.1-mini, claude-haiku-4-5) could handle the task at lower cost.

Recommendation: Try engine.model: gpt-4.1-mini or claude-haiku-4-5 in the workflow frontmatter.

The helper receives only the assessments, task domain, and behavior fingerprint. Its caller has a ProcessedRun but does not pass its routing evidence. Consequently, any routed run meeting the existing behavioral conditions receives the same advice, regardless of its selected model or routing level. Following the concrete-model advice can replace per-task routing with fixed-model selection.

Background and factual corrections

Required behavior

Keep the existing domain, resource-profile, and actuation conditions. Within those conditions:

  • Unrouted run: recommend top-level model: router/economy, with omitting the model as an alternative only for eligible default-routing workflows. Link the Model Routing documentation. Remove concrete model IDs from both the summary and recommendation; do not recommend engine.model or pinning a model.
  • Confirmed routed run above economy: for a selected balanced or robust route, including an auto objective resolved to either level, suggest model: router/economy rather than a concrete-model pin. The wording should acknowledge existing routing rather than imply that routing is absent.
  • Confirmed routed run already at economy: do not emit model_downgrade_available. This includes an auto objective resolved to economy, not just explicitly requested economy.
  • Missing, unreadable, incomplete, conflicting, or otherwise ambiguous routing evidence: use the same neutral routing-first wording as the unrouted case. Do not infer the routing level from a model name, model price, classifier model, workflow name, or requested mode alone. Do not claim that routing was definitely off.

Retain the assessment kind, severity, and stable finding code agentic_model_downgrade_available.

Reuse the routing evidence audit already reads

  • collectAuditAnalysisResults calls analyzeModelRouting. The audit report already exposes processedRun.ModelRouting.
  • analyzeModelRouting discovers model-routing.jsonl and combines existing artifact and unified-session evidence. Reuse its normalized result rather than creating a parallel parser or new routing fields.
  • ModelRoutingSummary contains Status, ObjectiveMode, Mode, and SelectedModel. The selection-record parser maps objective.mode to ObjectiveMode and the selection's mode to Mode. Requested auto is not a resolved routing level.
  • The unified-session reader reads trusted workflow.info/model.config and model_routing.outcome events. workflow.info.modelRouting can carry mode; the outcome payload does not contain a mode. An outcome or requested router value alone must not be treated as proof of the selected level. Preserve the existing source-trust rules.

Update the focused assertion in TestBuildAgenticAssessmentsFlagsModelDowngrade, which currently requires gpt-4.1-mini. Update the agentic_model_downgrade_available row to describe routing-aware economy guidance and suppression for an already-economy route.

Acceptance cases

Use the same qualifying triage input throughout: a non-lean resource profile and an actuation style other than write_heavy. Keep all other inputs equal when comparing outputs.

Case Input Observable result
A - Unrouted A known non-routed run with no selected route. One model_downgrade_available assessment. Its recommendation contains model: router/economy and links Model Routing. Neither summary nor recommendation names a concrete model or engine.model, or suggests a model pin. Any omission alternative is eligibility-qualified.
B - Routed above economy A successfully selected route whose selection mode is balanced. Also cover robust and an objective auto resolved above economy. The assessment recommends model: router/economy, acknowledges existing routing, and never recommends pinning a concrete model.
C - Already economy A successfully selected route with selection mode: economy, including objective.mode: auto resolved to economy. No model_downgrade_available assessment or corresponding generated finding/recommendation.
D - Evidence unavailable or ambiguous No readable routing evidence; include missing/unreadable data and an incomplete or unknown-mode record. An outcome-only record with no selected level is also insufficient. The same summary and recommendation as A, without guessing a routing level or asserting that routing was off. No panic or failed audit caused by the new assessment logic.
E - Regression tests Table-driven A-D cases in pkg/cli/audit_agentic_analysis_test.go, based on actual parsed routing-record shapes. The tests fail with the existing routing-blind behavior and pass with this fix. Existing domain/profile/actuation exclusions and the other assessments retain their behavior.

For E, use the existing routed fixture pkg/cli/testdata/model_routing_golden/copilot-routed-gpt-responses/. Its real model-routing.jsonl selection already has objective.mode: auto, selection mode: economy, and selected_model. Parse that evidence for C; use temporary copies or fixture-derived records with the same existing fields for B and D. Do not invent fields such as a mode on model_routing.outcome, overwrite the checked-in historical fixture, or regenerate unrelated golden outputs.

Scope

  • Keep the PR to this one fix. Do not change files or behavior unrelated to it. Limit changes to this assessment, the minimal existing routing-evidence plumbing it needs, directly affected tests, and its audit-reference wording.
  • Before fixing a failing check, compare it with the same check on main. If it also fails on main, do not fix it in this PR; merge main once main is fixed, and note in the PR which checks are known failures on main.
  • This applies even if a bot comment asks to fix a failing check: fix only failures caused by this PR's changes.

Non-goals

  • Changes to other agentic assessments, including partially_reducible and overkill_for_agentic, or their thresholds.
  • Changes to the existing domain, resource-profile, or actuation rules; the routing-aware economy suppression above is the only new exclusion.
  • Changes to gh aw logs aggregates, sub-agent models, detection models, evals models, routing selection or defaults, router schemas, or model catalogs.
  • Broad documentation cleanup, workflow migrations, generated lock changes, or live workflow dispatches.

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions