Repository navigation
Description
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, orissue_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
- Default implicit model routing to cost/auto instead of cost/balanced #76602, merged November 10, 2026, changed existing implicit routing from
goal: cost, mode: balancedtogoal: cost, mode: auto. It did not introduce default routing. The current compiler default remains conditional on eligibility, not merely the absence of a model. - Choose model routing with
model: routerandrouter/economy|balanced|robust#76617, merged November 11, 2026, added the explicitmodel: routerandrouter/economy|balanced|robustsyntax. For routine, low-risk work,model: router/economysets the lowest benchmark success target; it is not a guarantee of success, the cheapest possible model, or a spending cap. - Do not describe
engine.modelas deprecated. It remains supported and takes precedence over top-levelmodel, as the routing reference documents. Prefer top-levelmodelin the new recommendation without claiming that the older field is invalid. - docs: lead model-choice guidance with default routing and model: router #76983 is a documentation issue, not a pull request. On the reviewed
main, Choose a Cheaper Model already leads with eligible default routing andmodel: router/economy. Audit should give consistent advice; do not redo that documentation change. - Distinguish routing mode
autofrommodel: auto, which uses the engine/provider's own selector and does not enable gh-aw per-task routing.
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 recommendengine.modelor pinning a model. - Confirmed routed run above economy: for a selected
balancedorrobustroute, including anautoobjective resolved to either level, suggestmodel: router/economyrather 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 anautoobjective resolved toeconomy, 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
collectAuditAnalysisResultscallsanalyzeModelRouting. The audit report already exposesprocessedRun.ModelRouting.analyzeModelRoutingdiscoversmodel-routing.jsonland combines existing artifact and unified-session evidence. Reuse its normalized result rather than creating a parallel parser or new routing fields.ModelRoutingSummarycontainsStatus,ObjectiveMode,Mode, andSelectedModel. The selection-record parser mapsobjective.modetoObjectiveModeand the selection'smodetoMode. Requestedautois not a resolved routing level.- The unified-session reader reads trusted
workflow.info/model.configandmodel_routing.outcomeevents.workflow.info.modelRoutingcan carrymode; 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 onmain, do not fix it in this PR; mergemainoncemainis fixed, and note in the PR which checks are known failures onmain. - 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_reducibleandoverkill_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 logsaggregates, 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.
Activity