feat(playground): show environment servers as active in the composer's server menu - #3617
Conversation
…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>
Bugbot couldn't run - usage limit reachedBugbot 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) |
|
Warning Review limit reached
Next review available in: 29 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Walkthrough
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. Comment |
📄 Knowledge reviewDosu skipped reviewing this PR because your organization has used its |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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>
Bugbot couldn't run - usage limit reachedBugbot 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) |
|
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. |
There was a problem hiding this comment.
💡 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".
| <Switch | ||
| checked={server.enabled} | ||
| onCheckedChange={(next) => | ||
| onEnvironmentServerToggle?.( | ||
| server.serverId, | ||
| next === true | ||
| ) | ||
| } |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
🧹 Nitpick comments (1)
mcpjam-inspector/client/src/components/chat-v2/__tests__/ChatInput.test.tsx (1)
1433-1476: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd an assertion for the plugin badge.
The
environmentServersfixture setssource: "plugin"onsrv_b("excalidraw") specifically to exercise the plugin-badge branch inchat-input.tsx(server.source === "plugin"renders a "plugin" label). No test in this file asserts that label renders. The oldPlaygroundEnvironmentSection.test.tsxtest 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
📒 Files selected for processing (5)
mcpjam-inspector/client/src/components/chat-v2/__tests__/ChatInput.test.tsxmcpjam-inspector/client/src/components/chat-v2/chat-input.tsxmcpjam-inspector/client/src/components/playground/PlaygroundEnvironmentSection.tsxmcpjam-inspector/client/src/components/playground/__tests__/PlaygroundEnvironmentSection.test.tsxmcpjam-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>
Bugbot couldn't run - usage limit reachedBugbot 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) |
|
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 ( |
There was a problem hiding this comment.
💡 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".
| const hasServerOptions = isEnvironmentServerMode | ||
| ? environmentServers.length > 0 |
There was a problem hiding this comment.
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>
|
Codex P1 (zero-server environment with a live override hides Modified/reset) — fixed: the environment section now also renders while |
Bugbot couldn't run - usage limit reachedBugbot 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) |
There was a problem hiding this comment.
💡 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} |
There was a problem hiding this comment.
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 👍 / 👎.
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
ChatInputgains an optionalenvironmentServersprop. 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, andAdd server/Connect/Retryare withdrawn (they target the browser connection system, which environment turns bypass).setServerEnabledfromusePlaygroundEnvironment) — it is not a connect/disconnect, so the two surfaces can never disagree.PlaygroundMainpasses the environment preview's servers whenisEnvironmentMode, and the ad-hoc props otherwise. Chatboxes and otherChatInputcallers are untouched (environmentServersstays undefined).Tests
ChatInputtests: 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.AddServerModalmocked (it requires AuthKit).ChatInputsuite 56/56,PlaygroundMain/PlaygroundEnvironmentSectionsuites 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.
ChatInputadds optionalenvironmentServersand related callbacks; definingenvironmentServers(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).PlaygroundMainpasses environment preview servers in environment mode and ad-hoc server props otherwise.PlaygroundEnvironmentSectiondrops 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
ChatInputaddsenvironmentServers,onEnvironmentServerToggle,environmentServersOverridden, andonResetEnvironmentServers; when provided (even[]), they replace ad‑hoc rows.setServerEnabledfor per‑turn narrowing; the server section hides when zero servers unless an override exists.PlaygroundMainwires 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
Written for commit 63f72b3. Summary will update on new commits.