create SMART_ROUTING_ENABLED_SUBAGENT_ONLY to only route subagents - #752
Merged
Merged
Conversation
The new env var enables smart routing for spawned subagents without routing the session's first prompt. Claude launches skip the PTY and first-prompt hook, and Codex launches exec the TUI directly with the routing hooks in its CLI config instead of starting the app-server and interposer. ENABLE_SMART_ROUTING_V2 keeps routing the first prompt and wins when both are set. Co-authored-by: Isaac <no-reply@databricks.com>
The mixed set/unset restore states are already covered through the real call path by the native-subcommand suppression tests. Co-authored-by: Isaac <no-reply@databricks.com>
Drive the installed route-subagent hook commands with a harness-shaped PreToolUse payload against the live router for both agents, asserting the allow decision, the model rewrite, and the audited decision record. Launch the real TUI with only ENABLE_SMART_ROUTING_SUBAGENT_ONLY set and assert the first-prompt banner and routing wrappers stay silent while Claude's SessionStart canary proves the hooks armed. Update the coverage matrix, case counts, and the smart-routing gap description to match. Co-authored-by: Isaac <no-reply@databricks.com>
Require "Using Unity Gateway Smart Router - Subagent" in the hook's systemMessage so the tests prove routing actually ran, not just that the hook emitted well-formed JSON. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
The full flag is often ambient (exported shells, managed config, parent sessions) while ENABLE_SMART_ROUTING_SUBAGENT_ONLY is always explicit, so an explicit subagent-only session now suppresses first-prompt routing even when the full flag is also set. Co-authored-by: Isaac <no-reply@databricks.com>
Set both the full and subagent-only routing flags in the Claude and Codex launch tests so the absent first-prompt banner proves precedence against a live session, not just against a single flag. Co-authored-by: Isaac <no-reply@databricks.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
SMART_ROUTING_ENABLED_SUBAGENT_ONLY takes priority over SMART_ROUTING_ENABLED_V2. ie if SMART_ROUTING_ENABLED_V2=1 and SMART_ROUTING_ENABLED_SUBAGENT_ONLY=1, we do not route the first prompt