Preserve project agent opt-ins across enabled legacy feature flags (#59496)

## Why

An enabled legacy feature flag could prevent a project's `agents.enabled = true` from overriding a lower-priority legacy opt-out, leaving V1 agent tools unavailable.

## What changed

Only stop scanning configuration layers at an explicit legacy feature opt-out. Enabled flags now allow the scan to continue, so project opt-ins can override lower-priority opt-outs while same-layer and higher-priority opt-outs remain effective.

## Testing

Extend the model runtime selector regression test to cover enabled `features.collab` flags in project configuration and CLI overrides, and verify that explicit `false` values still disable V1 agent tools.

GitOrigin-RevId: ca3dcf9dc6a642eb72e20929776fb74379715053
This commit is contained in:
jif
2026-11-04 21:23:11 +00:00
committed by copyberry
parent 464239de0a
commit b260ee5e83
2 changed files with 33 additions and 3 deletions
@@ -447,6 +447,36 @@ async fn migrating_only_the_project_agent_setting_preserves_v1_tools() -> Result
Some("multi_agent_v1"),
),
(migrated, config(), None, Some("multi_agent_v1")),
(
"[features]\nmulti_agent = true",
config().cli_overrides(vec![("features.collab".to_string(), true.into())]),
None,
Some("multi_agent_v1"),
),
(
migrated,
config().cli_overrides(vec![("features.collab".to_string(), true.into())]),
None,
Some("multi_agent_v1"),
),
(
"[agents]\nenabled = true\n[features]\ncollab = true",
config(),
None,
Some("multi_agent_v1"),
),
(
"[agents]\nenabled = true\n[features]\ncollab = false",
config(),
None,
None,
),
(
migrated,
config().cli_overrides(vec![("features.collab".to_string(), false.into())]),
None,
None,
),
(
migrated,
config(),