Skip to content

fix(launch): guard zero-config default trio and report routing bundle in --dry-run#108

Open
elyasmnvidian wants to merge 1 commit into
mainfrom
emehtabuddin/qa-launch
Open

fix(launch): guard zero-config default trio and report routing bundle in --dry-run#108
elyasmnvidian wants to merge 1 commit into
mainfrom
emehtabuddin/qa-launch

Conversation

@elyasmnvidian

@elyasmnvidian elyasmnvidian commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Two launcher fixes.

Zero-config launch on a non-OpenRouter provider now stops before it launches.
With no --model and no --routing-profiles, switchyard launch claude (and codex/openclaw) uses the fixed default trio — strong anthropic/claude-opus-4.7, weak moonshotai/kimi-k2.6, classifier google/gemini-3.5-flash — which are all OpenRouter model ids. If your credentials resolve to a different provider (for example NVIDIA via NVIDIA_API_KEY), those ids don't exist on that endpoint. The old code launched anyway and only failed on the first request. Now the launcher exits first with a message that names the trio, the resolved provider, and the way out: pass --model for a single model or --routing-profiles FILE for a bundle, or set OPENROUTER_API_KEY.

launch --dry-run now labels a routing-profiles bundle as a bundle.
Running a dry run with --routing-profiles FILE printed route: single (the placeholder single-tier view). It now prints route: bundle, the bundle path, and the routable ids read from the YAML.

How to try it:

  • NVIDIA_API_KEY=... switchyard launch claude → exits with the "OpenRouter-only" guidance instead of spawning.
  • switchyard --routing-profiles routes.yaml -- launch claude --dry-run → prints route: bundle.

Regression tests for both live in tests/test_launch_claude_deterministic.py. The existing codex zero-flag test now points at an OpenRouter endpoint so it still exercises the deterministic dispatch path rather than tripping the new guard.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://NVIDIA-NeMo.github.io/Switchyard/pr-preview/pr-108/

Built to branch gh-pages at 2026-07-21 21:46 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The CLI now fails fast for zero-config deterministic launches using non-OpenRouter providers, while explicit model overrides remain supported. Dry-run output also reports routing-profile bundles for Claude, Codex, and OpenClaw.

Changes

Routing CLI behavior

Layer / File(s) Summary
Deterministic provider validation
switchyard/cli/launch_command.py, docs/guides/agent_launchers.md, tests/test_launch_claude_deterministic.py, tests/test_launch_codex.py
Deterministic zero-config launches require an OpenRouter provider, with explicit model overrides bypassing the guard; documentation and dispatch tests cover the behavior.
Routing-profile dry-run output
switchyard/cli/output.py, switchyard/cli/launch_command.py, tests/test_launch_claude_deterministic.py
Dry-run formatting reports bundle routes and routing-profile IDs, and launch subcommands pass the routing-profile path through to the formatter.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Poem

A bunny checked the routes with care,
Found OpenRouter models waiting there.
Bundles bloomed in dry-run light,
Explicit models made things right.
Hop, hop—safe launches take flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main launcher changes: zero-config guardrails and dry-run routing bundle reporting.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
tests/test_launch_claude_deterministic.py (1)

279-281: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the bundle path and route ID too.

This passes if only route: bundle is rendered; assert routing profiles: {yaml_path} and my-route to cover the stated dry-run contract.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_launch_claude_deterministic.py` around lines 279 - 281, Strengthen
the assertions in the dry-run output test by verifying the bundle path includes
both the routing profiles value using yaml_path and the route ID my-route, in
addition to route: bundle; retain the existing assertion that route: single is
absent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@switchyard/cli/launch_command.py`:
- Around line 121-126: Update the provider-guard bypass condition to return only
when args.model is set; do not treat args.weak_model or args.classifier_model as
opt-outs. Preserve deterministic routing and provider validation whenever only
the partial model overrides are provided.

In `@tests/test_launch_codex.py`:
- Around line 509-511: Remove the project-management tracker reference “NvBug
6401771” from the source comment near the deterministic default dispatch
behavior, while preserving the explanation that the zero-flag default trio is
OpenRouter-only and non-OpenRouter providers are rejected.

---

Nitpick comments:
In `@tests/test_launch_claude_deterministic.py`:
- Around line 279-281: Strengthen the assertions in the dry-run output test by
verifying the bundle path includes both the routing profiles value using
yaml_path and the route ID my-route, in addition to route: bundle; retain the
existing assertion that route: single is absent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 8bb30082-4f92-4343-88cc-ddbba579a886

📥 Commits

Reviewing files that changed from the base of the PR and between 2fa6b87 and a478815.

📒 Files selected for processing (5)
  • docs/guides/agent_launchers.md
  • switchyard/cli/launch_command.py
  • switchyard/cli/output.py
  • tests/test_launch_claude_deterministic.py
  • tests/test_launch_codex.py

Comment thread switchyard/cli/launch_command.py Outdated
Comment thread tests/test_launch_codex.py Outdated
… in --dry-run

Signed-off-by: Elyas Mehtabuddin <emehtabuddin@nvidia.com>
(cherry picked from commit 6109ae4)
Signed-off-by: Elyas Mehtabuddin <emehtabuddin@nvidia.com>
@elyasmnvidian
elyasmnvidian force-pushed the emehtabuddin/qa-launch branch from a478815 to 6e5cd4a Compare July 21, 2026 21:45
@elyasmnvidian

elyasmnvidian commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Live before/after — launcher guard and dry-run bundle reporting

These are launcher-behavior fixes, so the reproduction is command output. Same commands on main and this branch.

1) launch --dry-run with a routing bundleswitchyard --routing-profiles bundle.yaml launch claude --dry-run:

# main
route: single

# this branch
route: bundle
routing profiles: /tmp/live/bundle_108.yaml
  fast-kimi
  moonshotai/kimi-k2.6
  random-router
  anthropic/claude-opus-4.7

2) Zero-config launch on a non-OpenRouter endpointswitchyard launch claude --base-url https://inference-api.nvidia.com/v1 --api-key $NVIDIA_API_KEY (no --model):

  • main: no such guard exists (0 occurrences in launch_command.py), so the launcher proceeds to start the OpenRouter-only trio against the NVIDIA endpoint and only fails on the first request.

  • this branch — fails fast, before spawning:

    launch claude: the zero-config default trio (anthropic/claude-opus-4.7, moonshotai/kimi-k2.6, google/gemini-3.5-flash) is OpenRouter-only; the resolved provider is 'nvidia'. Pass --model, use --routing-profiles, or set OPENROUTER_API_KEY.
    

Audit follow-up in this push: the guard now rejects any deterministic launch on a non-OpenRouter endpoint. It previously skipped itself when --weak-model/--classifier-model was set, but the strong tier is always anthropic/claude-opus-4.7, so those flags don't make the trio reachable. The message and the launcher doc now name the real ways out (--model, --routing-profiles, OPENROUTER_API_KEY).

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