Skip to content

feat(.5231): router on/off toggle in SCXChat - #2

Open
Sir-J-AU wants to merge 1 commit into
fix/bughunt-5231from
feat/router-toggle
Open

feat(.5231): router on/off toggle in SCXChat#2
Sir-J-AU wants to merge 1 commit into
fix/bughunt-5231from
feat/router-toggle

Conversation

@Sir-J-AU

@Sir-J-AU Sir-J-AU commented Jul 5, 2026

Copy link
Copy Markdown
Owner

What

Adds a visual Router on/off toggle to the SCXChat status strip, plus the effective-base plumbing behind it. Per HR29 (additive layers): with the router OFF (default) requests go DIRECT to SCX and always work; ON routes via the local LiteLLM router at http://127.0.0.1:4180.

Changes

Settingkritical.scxcode.routerEnabled (boolean, default false) in src/package.json.

Toggle UI (chatHtml) — a glass/navy-cyan Router pill in the status strip:

  • Three visual states: off (muted), on (cyan-lit, knob slides right), direct (amber — enabled but router unreachable → running direct).
  • Tooltip explains ON = route via 127.0.0.1:4180, OFF = direct to SCX (HR29 baseline, always works).
  • Click + keyboard (Enter/Space) toggle; posts setConfig routerEnabled then re-requests config so the host re-probes and corrects the pill live.
  • Rendered in both the panel and the sidebar (shared chatHtml).

Host — effective base logic:

  • resolveEffectiveBase() computes the base URL per request — router when enabled and reachable, else the configured direct baseUrl. Never overwrites the operator's baseUrl setting.
  • Router enabled but unreachable → transparent fallback to direct + a subtle status hint (no hard-fail).
  • probeRouterUrl() health-checks /health/liveliness with a short timeout.
  • requestJson() picks http vs https by URL protocol and honours the port, so the plain-http localhost router works; scxPost and fetchLiveModels both route through it identically.
  • HR1 intact — SCX_API_KEY only.
  • Status strip dot/text reflect the effective base + router state (↺ router / ↺ router unreachable → direct).

Verify

  • cd src && npm run build → esbuild green (212.9kb).
  • node codex-wrapper/scx-agentic-shim.test.mjs6/6 pass.
  • Standalone tsc --noEmit on extension.ts → clean.
  • Router markup + handlers confirmed present in the built bundle.

Does not touch codex-wrapper/pack/.

🤖 Generated with Claude Code

Add a visual Router on/off toggle to the SCXChat status strip and the
effective-base plumbing behind it. HR29-additive: with the router OFF
(default) requests go DIRECT to SCX and always work; ON routes chat +
model-list requests via the local LiteLLM router (http://127.0.0.1:4180).

- New boolean setting kritical.scxcode.routerEnabled (default false) in
  src/package.json contributes.configuration.
- New glass/navy-cyan pill in the chat status strip labelled "Router"
  with on/off/direct states, a tooltip, click + keyboard toggle, posting
  setConfig routerEnabled and re-requesting config to reflect live state.
- Host: resolveEffectiveBase() computes the base URL per request without
  overwriting the operator's baseUrl. Router enabled but unreachable ->
  transparent fallback to direct + a subtle status hint (never hard-fail).
  probeRouterUrl() health-checks /health/liveliness with a short timeout.
- requestJson() picks http vs https by URL protocol and honours the port
  so the plain-http localhost router works; scxPost + fetchLiveModels
  both route through it identically. HR1 intact (SCX_API_KEY only).
- Status strip dot/text reflect the effective base and router state.

Build: esbuild green (212.9kb). Shim test 6/6.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Sir-J-AU

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 54 minutes.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sir-J-AU, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4079bfe5-8c7c-422c-abe0-69274690f8a9

📥 Commits

Reviewing files that changed from the base of the PR and between e47d018 and 97affa1.

📒 Files selected for processing (2)
  • src/extension.ts
  • src/package.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/router-toggle

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

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.

2 participants