Skip to content

create SMART_ROUTING_ENABLED_SUBAGENT_ONLY to only route subagents - #752

Merged
lilly-luo merged 9 commits into
mainfrom
lilly/subagent-only-smart-routing
Sep 18, 2026
Merged

lilly-luo merged 9 commits into
mainfrom
lilly/subagent-only-smart-routing

Conversation

@lilly-luo

@lilly-luo lilly-luo commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

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

Screenshot 2026-09-18 at 5 10 09 PM Screenshot 2026-09-18 at 5 10 51 PM Screenshot 2026-09-18 at 6 54 07 PM

lilly-luo and others added 2 commits September 18, 2026 20:57
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>
@lilly-luo lilly-luo changed the title Lilly/subagent only smart routing create SMART_ROUTING_ENABLED_SUBAGENT_ONLY to only route subagents Sep 18, 2026
@lilly-luo
lilly-luo requested a review from rohita5l September 18, 2026 21:39
lilly-luo and others added 5 commits September 18, 2026 22:18
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>
@lilly-luo
lilly-luo merged commit 9858a84 into main Sep 18, 2026
20 checks passed
@lilly-luo
lilly-luo deleted the lilly/subagent-only-smart-routing branch September 18, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant