fix(intent): fail closed INTENT_V2_DECISION_TIER unknown values to none

Align illegal-tier fallback with PlanTier's conservative policy so
unrecognized values never silently enable V2 query routing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
weichen
2026-09-18 02:26:47 +00:00
co-authored by Cursor
parent e35f106162
commit 07fc0ecf55
2 changed files with 10 additions and 1 deletions
+4 -1
View File
@@ -59,7 +59,10 @@ func parseV2DecisionTier(raw string) V2DecisionTier {
case "all":
return V2TierAll
default:
return V2TierQuery
// E-7: fail closed to none, aligned with intentflow.parsePlanTier's
// conservative fallback. An unrecognized value must never silently
// enable V2 query routing.
return V2TierNone
}
}
+6
View File
@@ -23,6 +23,12 @@ func TestTierAllowsRisk(t *testing.T) {
}
}
func TestUnknownV2DecisionTierFailsClosedToNone(t *testing.T) {
if parseV2DecisionTier("definitely-not-a-tier") != V2TierNone {
t.Fatal("unknown INTENT_V2_DECISION_TIER must fail closed to none, not query")
}
}
func TestBuildV2ShadowReport_MismatchDetection(t *testing.T) {
SetFeatureFlagsForTest(FeatureFlags{IntentV2Shadow: true})
defer ResetFeatureFlagsForTest()