Skip to content

feat(playground): show environment servers as active in the composer's server menu - #3617

Merged
chelojimenez merged 4 commits into
mainfrom
feat/playground-env-servers-popover
Aug 2, 2026
Merged

feat(playground): show environment servers as active in the composer's server menu#3617
chelojimenez merged 4 commits into
mainfrom
feat/playground-env-servers-popover

Conversation

@chelojimenez

@chelojimenez chelojimenez commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Why

In environment mode the browser never connects to the environment's servers — the backend opens ephemeral connections per turn. But the composer's "+" menu still rendered the browser's ad-hoc connection list: dead "Connect" buttons and an "Add server" row that have no effect on environment turns. The playground read as "nothing is connected" while tools visibly executed in chat, which is especially confusing when switching between environments.

What

  • ChatInput gains an optional environmentServers prop. When present it replaces the ad-hoc server rows outright: environment servers render with an active indicator and "Connected automatically on every message" copy, plugin-contributed servers keep their badge, and Add server/Connect/Retry are withdrawn (they target the browser connection system, which environment turns bypass).
  • The row toggle is wired to the SAME per-turn narrowing override as the header chips (setServerEnabled from usePlaygroundEnvironment) — it is not a connect/disconnect, so the two surfaces can never disagree.
  • PlaygroundMain passes the environment preview's servers when isEnvironmentMode, and the ad-hoc props otherwise. Chatboxes and other ChatInput callers are untouched (environmentServers stays undefined).
  • An environment resolving to zero servers shows no server section at all rather than dead controls.

Tests

  • 3 new ChatInput tests: environment rows replace ad-hoc rows even when ad-hoc props are also passed; toggling reports the per-turn override (never a disconnect); zero-server environments render no section. AddServerModal mocked (it requires AuthKit).
  • Full ChatInput suite 56/56, PlaygroundMain/PlaygroundEnvironmentSection suites 112/112, client typecheck clean for changed files.

Not in this PR

Populating the left Tools rail with the environment's tools (needs a server-side one-shot list-tools read) — scoped as a fast-follow.

🤖 Generated with Claude Code


Note

Low Risk
Playground UI and prop wiring only; override behavior reuses existing environment hooks with added tests and streaming guards.

Overview
In project environment mode, the composer "+" menu now shows Environment servers (active indicators, auto-connect copy, plugin badges) instead of browser Connect / Add server rows, which do not apply when the backend connects servers each turn.

ChatInput adds optional environmentServers and related callbacks; defining environmentServers (including []) switches the menu. Toggles call the same per-turn narrowing override as before (setServerEnabled), with Modified / Reset to environment in the menu. Toggles and reset are disabled while a turn is streaming. Empty environments hide the server block unless an override remains (so reset stays available).

PlaygroundMain passes environment preview servers in environment mode and ad-hoc server props otherwise.

PlaygroundEnvironmentSection drops the header summary (rev, host, counts) and server chips so server control lives only in the composer menu (and Tools rail for tools); warnings and plugin selector stay in the header.

Reviewed by Cursor Bugbot for commit 63f72b3. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Shows environment servers as active in the composer’s “+” menu when an environment is selected, moving per‑turn server overrides into the menu and removing the header summary/chips. Toggles/reset are locked mid‑stream, and Modified/reset stays visible even if the environment temporarily resolves to zero servers.

  • New Features

    • ChatInput adds environmentServers, onEnvironmentServerToggle, environmentServersOverridden, and onResetEnvironmentServers; when provided (even []), they replace ad‑hoc rows.
    • Environment rows show a green indicator, “Connected automatically on every message.” copy, keep plugin badges, and use setServerEnabled for per‑turn narrowing; the server section hides when zero servers unless an override exists.
    • PlaygroundMain wires environment servers, toggle handler, override state, and reset in environment mode; the header summary line and server chips are removed, and the menu now owns toggles plus the Modified/reset affordance.
  • Bug Fixes

    • Disable environment server switches and “Reset to environment” while a turn is streaming.
    • Keep Modified/reset visible when an overridden environment resolves to zero servers.

Written for commit 63f72b3. Summary will update on new commits.

Review in cubic

…s server menu

In environment mode the backend connects the environment's servers on every
turn, so the "+" menu's browser-connection rows (Connect/Retry, Add server)
were all dead controls pointing at the wrong system — the popover read as
"nothing is connected" while tools visibly executed in chat.

The composer's server section now swaps wholesale when an environment is
selected: rows come from the environment preview (green dot, "Connected
automatically on every message" copy, plugin badge) and the toggle drives the
SAME per-turn narrowing override as the header chips (setServerEnabled), so
the two surfaces cannot disagree. Ad-hoc connect controls are withdrawn for
the duration; clearing the environment restores them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 2, 2026
@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_5ecd9790-f6e9-45b4-ae1e-e759793fbdbc)

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@chelojimenez, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 29 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b6319279-b89c-43e9-8cd6-8fbd1fbafc84

📥 Commits

Reviewing files that changed from the base of the PR and between 4c15bfc and 63f72b3.

📒 Files selected for processing (2)
  • mcpjam-inspector/client/src/components/chat-v2/__tests__/ChatInput.test.tsx
  • mcpjam-inspector/client/src/components/chat-v2/chat-input.tsx

Walkthrough

ChatInput now supports environment servers with per-turn toggles, override status, reset handling, source labels, and environment-specific menu behavior. PlaygroundMain passes these controls in environment mode and preserves standard server management otherwise. PlaygroundEnvironmentSection no longer renders server controls or override state. Tests cover the new ChatInput behavior and confirm the removed environment-section controls.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@dosubot

dosubot Bot commented Aug 2, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-09-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about inspector Add Dosu to your team

@chelojimenez

chelojimenez commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@dosubot dosubot Bot added the enhancement New feature or request label Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Internal preview

Preview URL will appear in Railway after the deploy finishes.
Deployed commit: 1b54103
PR head commit: 63f72b3
Backend target: staging fallback.
Access is employee-only in non-production environments.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 3 files

Re-trigger cubic

The composer's "+" menu now owns the environment server rows and their
per-turn toggles, and the Tools rail lists the resolved tools — the header's
summary line (name/rev/host/counts) and server chips repeated the same state
a third time. Removed; the picker itself still names the selected
environment, and the header keeps what no other surface says (skill-delivery
warning, plugin chips + preflight).

The Modified badge + "Reset to environment" move INTO the composer menu next
to the toggles that create the override, so the honesty affordance lives on
the only surface that can modify the set.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_f1b21abb-9f6b-4816-bd6c-19002b4735db)

@chelojimenez

Copy link
Copy Markdown
Contributor Author

Pushed a second commit per Marcelo's review: the header's environment summary line (name/rev/host/counts) and server chips are removed — the composer menu and the Tools rail (#3622) now carry that state. The Modified badge + "Reset to environment" moved into the composer's server menu, next to the toggles that create the override. Header keeps only what no other surface says: the skill-delivery warning and the plugin chips/preflight.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7aaf055333

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1578 to +1585
<Switch
checked={server.enabled}
onCheckedChange={(next) =>
onEnvironmentServerToggle?.(
server.serverId,
next === true
)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Disable environment toggles while a turn is running

When an environment turn is streaming, getChatComposerInteractivity deliberately leaves composerDisabled false, so the Options popover and this switch remain interactive. Before these controls moved, PlaygroundMain passed isStreamingActive || isPreparingServerForSend to PlaygroundEnvironmentSection, which disabled the server controls; now toggling immediately changes the displayed override even though the in-flight request continues with its original server set, and silently changes the next turn. Thread the in-flight state into these switches and the reset action so environment controls retain the previous mid-turn lock.

Useful? React with 👍 / 👎.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 5 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread mcpjam-inspector/client/src/components/chat-v2/chat-input.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
mcpjam-inspector/client/src/components/chat-v2/__tests__/ChatInput.test.tsx (1)

1433-1476: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add an assertion for the plugin badge.

The environmentServers fixture sets source: "plugin" on srv_b ("excalidraw") specifically to exercise the plugin-badge branch in chat-input.tsx (server.source === "plugin" renders a "plugin" label). No test in this file asserts that label renders. The old PlaygroundEnvironmentSection.test.tsx test that verified "plugin-owned servers are marked" was removed and has no replacement here, so this is a net loss in coverage for a PR-objective feature (plugin badges).

Add an assertion that the "plugin" text renders for the plugin-sourced server, and, if useful, that it does not render for the stateless (source: null) row.

✅ Suggested test addition
       expect(screen.getByText("bart")).toBeInTheDocument();
       expect(screen.getByText("excalidraw")).toBeInTheDocument();
       expect(screen.getByText("stateless")).toBeInTheDocument();
+      expect(screen.getAllByText("plugin")).toHaveLength(1);
       expect(screen.queryByText("adhoc")).not.toBeInTheDocument();
🤖 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 `@mcpjam-inspector/client/src/components/chat-v2/__tests__/ChatInput.test.tsx`
around lines 1433 - 1476, Extend the environment server test around the
environmentServers fixture to assert that the plugin-sourced “excalidraw” row
renders the “plugin” badge. Optionally verify the badge is absent for the
source-null “stateless” row, while preserving the existing environment-section
assertions.
🤖 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.

Nitpick comments:
In `@mcpjam-inspector/client/src/components/chat-v2/__tests__/ChatInput.test.tsx`:
- Around line 1433-1476: Extend the environment server test around the
environmentServers fixture to assert that the plugin-sourced “excalidraw” row
renders the “plugin” badge. Optionally verify the badge is absent for the
source-null “stateless” row, while preserving the existing environment-section
assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 96ecf894-f0ba-4b8d-b9cb-6db8f03e2431

📥 Commits

Reviewing files that changed from the base of the PR and between 5ad7623 and 7aaf055.

📒 Files selected for processing (5)
  • mcpjam-inspector/client/src/components/chat-v2/__tests__/ChatInput.test.tsx
  • mcpjam-inspector/client/src/components/chat-v2/chat-input.tsx
  • mcpjam-inspector/client/src/components/playground/PlaygroundEnvironmentSection.tsx
  • mcpjam-inspector/client/src/components/playground/__tests__/PlaygroundEnvironmentSection.test.tsx
  • mcpjam-inspector/client/src/components/ui-playground/PlaygroundMain.tsx

… streams

Review finding (Codex/cubic): the header section these controls moved from
was disabled during isStreamingActive || isPreparingServerForSend, but the
popover rows weren't — a mid-stream flip changes the NEXT turn's override
while looking like it changes the running one. Gate the switches and the
reset link on isLoading, matching the prior behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_b88848ee-2e8b-4948-abe0-2f289224ddfb)

@chelojimenez

Copy link
Copy Markdown
Contributor Author

Review triage: the one finding (Codex + cubic, same issue) is fixed in the latest commit — the environment server toggles and the "Reset to environment" link are now disabled while a turn is streaming (isLoading), restoring the guard the header section applied before these controls moved into the popover. Covered by a new test ("locks the toggles and reset while a turn is streaming").

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c15bfcb50

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +535 to +536
const hasServerOptions = isEnvironmentServerMode
? environmentServers.length > 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep reset visible for empty environments with overrides

When a selected environment is live-edited to resolve to zero servers after the user created an override, usePlaygroundEnvironment deliberately preserves that override across revisions, but this length check hides the entire server section—including the Modified badge and reset action. A retained server ID may still run when it remains an authorized project server, while the UI now claims no server state at all; otherwise the hidden override can continue affecting later revisions. Render the override/reset affordance whenever environmentServersOverridden is true, even if the resolved list is empty.

Useful? React with 👍 / 👎.

…onment resolves to zero servers

Codex P1: an override survives live edits of the environment (by design), so
an environment edited down to zero servers can still carry one — and a
retained id can still run if it remains an authorized project server. The
length-only visibility check hid the section, and with it the Modified
marker and the only reset affordance. The section now also renders while
environmentServersOverridden is true.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@chelojimenez

Copy link
Copy Markdown
Contributor Author

Codex P1 (zero-server environment with a live override hides Modified/reset) — fixed: the environment section now also renders while environmentServersOverridden is true, so the override stays visible and resettable even when the environment resolves to zero servers. New test covers it.

@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_0b853fe3-6f31-4d24-85ad-a025880e5dc1)

@chelojimenez
chelojimenez merged commit b6ae8cf into main Aug 2, 2026
12 of 13 checks passed
@chelojimenez
chelojimenez deleted the feat/playground-env-servers-popover branch August 2, 2026 21:20

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 63f72b30a5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// set, so a mid-stream flip would only
// change NEXT turn while looking like
// it changed this one.
disabled={isLoading}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Lock server overrides during send preparation

When the Options popover is open and a send enters the browser-server readiness preflight, PlaygroundMain sets isPreparingServerForSend but still passes isLoading: isStreamingActive to ChatInput, so this switch and the reset button remain active until streaming starts. A user or externally initiated send can therefore change the environment override after submission while the selected server reconnects, whereas the controls at their previous location were disabled for isStreamingActive || isPreparingServerForSend. The follow-up only added disabled={isLoading}, leaving this preparation phase uncovered; pass the combined in-flight state to these controls as well.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant