Repository navigation
consolidate smart routing configuration env vars into SMART_ROUTER_CONFIG #1051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
d81e0fc
Add backward-compatible smart routing configuration versions
lilly-luo 3913637
Version smart routing presets and validate complete flag definitions
lilly-luo 9bbd850
Require explicit smart routing version names without aliases
lilly-luo 34c00c8
Document how to extend smart routing configurations
lilly-luo e8377ea
Verify smart routing versions override all legacy flags
lilly-luo 6614bd1
Include orchestrator in smart routing environment controls
lilly-luo 5e0785d
Resolve smart routing versions before CLI command processing
lilly-luo 1aa9880
Replace smart routing config tests with exhaustive permutation grid
lilly-luo 98e4102
Simplify smart routing configuration permutation test
lilly-luo c4ffbbb
Rename smart router selector and add customer routing preset
lilly-luo 9bc917d
Limit smart router preset coverage to routing tests
lilly-luo 31819bf
Preserve legacy integration cases alongside smart router presets
lilly-luo e84d777
Cover four smart router presets in the routing CUJ
lilly-luo d1dd938
Merge remote-tracking branch 'origin/main' into lillyluo/smart-routin…
lilly-luo 142994e
Name and document smart router configuration versions
lilly-luo 7d36e28
Use named smart router versions in the routing CUJ
lilly-luo 0c82331
Fix async Claude CUJ evidence and clean up routing presets
lilly-luo 0e58854
Simplify routing presets and fix CUJ evidence matching
lilly-luo 853c7ce
Trim routing config and CUJ regression coverage
lilly-luo aa926c4
Filter CUJ inference requests before decoding payloads
lilly-luo 4050124
Merge branch 'main' into lillyluo/smart-routing-config-version
lilly-luo 424ad93
Verify Claude thinking-display recovery in smart-routing CUJs
lilly-luo a3ee548
Confirm Claude background-work dialog during TUI exit
lilly-luo 524dba3
Wait longer for Claude exit without confirming background-work dialog
lilly-luo c3cbb47
Wait for Claude background tasks before requesting exit
lilly-luo 2c4e6bd
Verify chained Claude native compatibility retries in CUJs
lilly-luo 913ce4e
Acknowledge Claude auto-mode billing notice in CUJ TUI waits
lilly-luo dfc2069
Fix Claude smart-routing CUJ completion evidence
lilly-luo 52dc912
Recognize completed Claude background tasks before exit
lilly-luo 09548c6
Wait for Claude background work before CUJ4 exit
lilly-luo 995eca1
Wait for routed child evidence without reconstructing parent turns
lilly-luo 2a44f77
Correlate Claude compatibility retries with their agent context
lilly-luo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| """Resolve external smart-routing versions into backward-compatible feature flags.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import os | ||
| from collections.abc import Mapping, MutableMapping | ||
|
|
||
| from ucode.constants import ( | ||
| ENABLE_SMART_ROUTER_ORCHESTRATOR_ENV_VAR, | ||
| ENABLE_SMART_ROUTING_ENV_VAR, | ||
| ENABLE_SUBAGENT_ROUTING_ENV_VAR, | ||
| SMART_ROUTER_CONFIG_VERSION_ENV_VAR, | ||
| SMART_ROUTING_ENV_KEYS, | ||
| ) | ||
|
|
||
| # Customer preset: route the first prompt and subagents, without orchestration. | ||
| FIRST_PROMPT_AND_SUBAGENT_NO_ORCH_V0 = "first_prompt_and_subagent_no_orch_v0" | ||
|
|
||
| # Route only subagents, with V2 disabled and no orchestration. | ||
| SUBAGENT_ONLY_V0 = "subagent_only_v0" | ||
|
|
||
| # Route only subagents, with both V2 and subagent-only flags enabled; no orchestration. | ||
| SUBAGENT_ONLY_V1 = "subagent_only_v1" | ||
|
|
||
| # Route only subagents and inject the Smart Router Orchestrator workflow. | ||
| SUBAGENT_ORCH_V0 = "subagent_orch_v0" | ||
|
|
||
| # Route only subagents with V2, subagent-only, and orchestration all enabled. | ||
| SUBAGENT_ORCH_V1 = "subagent_orch_v1" | ||
|
|
||
| _VERSIONS = { | ||
| FIRST_PROMPT_AND_SUBAGENT_NO_ORCH_V0: { | ||
| ENABLE_SMART_ROUTING_ENV_VAR: "1", | ||
| ENABLE_SUBAGENT_ROUTING_ENV_VAR: "0", | ||
| ENABLE_SMART_ROUTER_ORCHESTRATOR_ENV_VAR: "0", | ||
| }, | ||
| SUBAGENT_ONLY_V0: { | ||
| ENABLE_SMART_ROUTING_ENV_VAR: "0", | ||
| ENABLE_SUBAGENT_ROUTING_ENV_VAR: "1", | ||
| ENABLE_SMART_ROUTER_ORCHESTRATOR_ENV_VAR: "0", | ||
| }, | ||
| SUBAGENT_ONLY_V1: { | ||
| ENABLE_SMART_ROUTING_ENV_VAR: "1", | ||
| ENABLE_SUBAGENT_ROUTING_ENV_VAR: "1", | ||
| ENABLE_SMART_ROUTER_ORCHESTRATOR_ENV_VAR: "0", | ||
| }, | ||
| SUBAGENT_ORCH_V0: { | ||
| ENABLE_SMART_ROUTING_ENV_VAR: "0", | ||
| ENABLE_SUBAGENT_ROUTING_ENV_VAR: "1", | ||
| ENABLE_SMART_ROUTER_ORCHESTRATOR_ENV_VAR: "1", | ||
| }, | ||
| SUBAGENT_ORCH_V1: { | ||
| ENABLE_SMART_ROUTING_ENV_VAR: "1", | ||
| ENABLE_SUBAGENT_ROUTING_ENV_VAR: "1", | ||
| ENABLE_SMART_ROUTER_ORCHESTRATOR_ENV_VAR: "1", | ||
| }, | ||
| } | ||
|
|
||
|
|
||
| def _validate_versions(versions: Mapping[str, Mapping[str, str]]) -> None: | ||
| """Require every version to explicitly configure the complete managed flag set.""" | ||
| expected = set(SMART_ROUTING_ENV_KEYS) | ||
| for version, values in versions.items(): | ||
| missing = expected - values.keys() | ||
| unexpected = values.keys() - expected | ||
| if missing or unexpected: | ||
| raise ValueError( | ||
| f"Invalid smart-routing version {version!r}: " | ||
| f"missing env vars {sorted(missing)}; unexpected env vars {sorted(unexpected)}." | ||
| ) | ||
| for key, value in values.items(): | ||
| if value not in ("0", "1"): | ||
| raise ValueError( | ||
| f"Invalid smart-routing version {version!r}: " | ||
| f"{key} must be '0' or '1', got {value!r}." | ||
| ) | ||
|
|
||
|
|
||
| _validate_versions(_VERSIONS) | ||
|
|
||
|
|
||
| def resolve_environment(env: Mapping[str, str] | None = None) -> dict[str, str]: | ||
| """Expand a version before applying any launch or session-specific overrides.""" | ||
| resolved = dict(os.environ if env is None else env) | ||
| version = resolved.pop(SMART_ROUTER_CONFIG_VERSION_ENV_VAR, "").strip() | ||
| resolved.update(_VERSIONS.get(version, {})) | ||
| return resolved | ||
|
|
||
|
|
||
| def apply_config(env: MutableMapping[str, str] | None = None) -> dict[str, str | None]: | ||
| """Consume the launch selector, returning the values needed to restore its input.""" | ||
| target = os.environ if env is None else env | ||
| version = target.get(SMART_ROUTER_CONFIG_VERSION_ENV_VAR, "").strip() | ||
| preset = _VERSIONS.get(version) | ||
| if preset is None: | ||
| return {} | ||
| keys = (*SMART_ROUTING_ENV_KEYS, SMART_ROUTER_CONFIG_VERSION_ENV_VAR) | ||
| previous = {key: target.get(key) for key in keys} | ||
| target.update(preset) | ||
| target.pop(SMART_ROUTER_CONFIG_VERSION_ENV_VAR, None) | ||
| return previous |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.