trunk-merge/pr-3643/74a61602-4d3f-4a86-81fc-715743ce25ca - #4062
Closed
trunk-io[bot] wants to merge 32 commits into
Closed
trunk-merge/pr-3643/74a61602-4d3f-4a86-81fc-715743ce25ca#4062trunk-io[bot] wants to merge 32 commits into
trunk-io[bot] wants to merge 32 commits into
Conversation
…ateway flag
Replaces the per-user MCP marketplace with the team gateway surface from the
design handoff when the mcp-gateway flag is on: servers home with connection
status, server detail with per-scope tool policies and the admin access
section, team & agents roster, agent service-account detail (identity, token
rotation, shared servers, call history), member detail with per-server
revocation, team settings (custom-server gate, approval baselines, server
access, team rules), the audit log, and the gateway add-server form with
sharing options. The legacy marketplace remains the fallback while the flag
is off.
Adds hand-written /api/projects/{id}/mcp_gateway/* client methods and types
to @posthog/api-client (the endpoints are not in the generated OpenAPI client
yet), and portable helpers with tests in @posthog/core/mcp-gateway.
Generated-By: PostHog Code
Task-Id: 7ecfb6f3-39d8-4443-96e7-36e9d1ebd144
…nstead of a state-sync effect Addresses the react-doctor blocking finding (no-adjust-state-on-prop-change) on the add-server form: the mutation now re-reads the gateway registry and returns the created server, so the form navigates from the mutation result instead of chaining pendingUrl state through an effect. Also derives the role-guarded route at render in McpGatewayView rather than correcting it in an effect, and renames the audit pager's map variable so the key reads as the page number it is. Generated-By: PostHog Code Task-Id: 7ecfb6f3-39d8-4443-96e7-36e9d1ebd144
The mcp_gateway/members/ endpoint returns a DRF-paginated object, not a bare array, so the Team & agents page crashed with "filteredMembers.slice is not a function". Parse results and pass limit=500 like the sibling gateway list endpoints. Generated-By: PostHog Code Task-Id: e58ce040-9955-42aa-8a4a-40bb4c98ad6a
The backend removed the team-shared credential concept (PostHog/posthog#72409): no auth_mode, shared_credential, allow_personal_connections, or your_connection.scope. Every credential is personal to the member who connected it, and agents reach it through explicit grants instead. These types are hand-mirrored rather than generated, so the removed fields failed silently instead of at compile time: the rail filtered on `auth_mode === "individual"`, which no server satisfies once the field is gone, so "Your connections" rendered its empty state even for a server that had just connected successfully. The two rail sections collapse into one connected-servers list, and the shared-credential panel, its rotate button, the personal-connections toggle and the pre-authorized member card are gone. The per-connection self-disable switch stays, now offered for any connection rather than only members on shared servers - it is the only surface that reveals a self-disabled installation.
…and catalog The registry is sparse now: a gateway row exists only for servers the team uses or an admin explicitly configured. The home screen merges real rows with recommended catalog templates (connect-only cards), team settings toggles untouched templates via set_template_enabled, and the enable/disable-all switch drives the new default_servers_enabled posture so it also covers catalog servers published later. Generated-By: PostHog Code Task-Id: 1e260db0-3ca7-420b-b2b1-61af484afaa2
Radix Tooltip stamps its own data-state (closed/delayed-open) onto its child. With a Radix Themes Switch as that child it overwrote the switch's own checked/unchecked state, and the track's colour is driven by selectors matching those two values — so neither matched, background position fell back to 0% and the off switch rendered full accent yellow. Wrapping the Switch in a span gives the Tooltip something else to stamp. Hover and focus still open the tooltip, since React's onFocus delegates through focusin, which bubbles from the inner button. The same pattern was fixed in GatewayServerDetail.
There is no rotate_token endpoint behind mcp_gateway/service_accounts/<id>/rotate_token/, so the Rotate button and its confirmation dialog could only ever fail. The masked token beside it went too - it is not actionable on its own, and the full token is still shown once at creation. That leaves nothing on this page that mints a token, so the NewTokenDialog render goes with it: newToken is per-hook-instance state and rotation was the only thing setting it here. Shared servers now sort granted-first with a labelled divider before the rest, so an agent's actual reach reads without scanning switches. The row moves into a ServerAccessRow component rather than duplicating the JSX across both groups.
…hooks The Code app renders neither an approval-baseline picker nor a team-rules list, so useGatewayRules had no consumer at all and useGatewayConfig's applyPreset mutation was never called. Presets and rules are set from the PostHog web UI; nothing here needs to write them. Removes the hooks plus the client methods only they reached (apply_preset, rules list, rules patch) and the types those methods owned. Rules still surface read-only through the resolved tool policy - decided_by "rule"/"preset", rule_name, rule_description - so the lock badges and their tooltips in GatewayToolRow and GiveAccessDialog are unaffected.
Connecting stored the credential but never listed the upstream tools, so a gateway server sat at zero tools until an admin pressed the manual refresh. List them on connect, register, and reconnect, and keep an empty-catalog backstop on the detail page so older connections and failed listings recover.
The audit row's avatar and label already branch three ways (agent, user, actor_label fallback for deleted actors), but the caller badge only branched two ways, so calls made by a since-deleted agent were badged "human". Badge the fallback state as "deleted" instead, since the null foreign keys mean the actor record is gone and its type can't be claimed. Generated-By: PostHog Code Task-Id: 950dadd8-b4aa-414e-9dbe-d1b6d621768a
The troubleshooting prose said a failed flag fetch makes isFeatureEnabled return `false`, contradicting the console snippet below it. posthog-js returns `undefined` when flags have never loaded; `false` only appears after flags load and the flag is absent. Generated-By: PostHog Code Task-Id: 8f10c212-547a-4dbe-943d-73397aa8b9ee
… between grants The dialog stays mounted while `open` toggles, so `selectedId` and `policyMap` survived a close (including the parent closing it after a successful grant) and switching the agent picker kept the previous agent's tool-policy overrides. The next grant was then seeded with the prior agent's policies instead of the per-tool defaults. Clear both on close and clear the policy draft whenever a different agent is selected. Generated-By: PostHog Code Task-Id: 88f6ba96-c074-49a5-b4cd-b961695dcb44
…cted The rail derived its dot and sub-label from the raw connection status alone, so a server the caller self-disabled, an admin turned off team-wide, or revoked the caller's access from still showed a green "Connected" dot — contradicting the detail and home screens. Fold those switches into a new getGatewayRailStatus and render gray "Off for the team" / "Access revoked" / "Disabled for you" states instead. Generated-By: PostHog Code Task-Id: 4dc7d546-7985-41d3-8a1b-bfff7920f7cf
…rs in team settings Server rows in the team-settings access list rendered ServerIcon from the URL-derived domain only, so a materialized catalog server whose curated icon_domain differs from its URL host showed the wrong icon on this screen while showing the brand icon everywhere else. Look up the originating template via templatesById, matching the other gateway components. Generated-By: PostHog Code Task-Id: d7f1a081-afed-4582-9826-1ca37e6354f3
…ites The bulk-approval filter short-circuited on teamScope, so "set all" on a shared installation sent PATCHes for rule-locked tools too — rule locks are meant to override every scope. Make the lock exclusion unconditional and keep only the ceiling check scope-conditional, matching useGatewayToolPolicies' setAllMutation, and cover the filter with hook tests. Generated-By: PostHog Code Task-Id: 50a9979d-3ad5-4663-826c-58d0fd0cc6fa
…n user getGatewayServerRemovalAction looked the caller up in server.connections, but that roster is admin-only (empty for members), so a member who registered a custom server never saw "delete for you" — and any member got it on a creator-less custom server via undefined === undefined. Pass the session user's id in (from useCurrentUser) and require a non-null creator; cover the real member-facing shape (connections: []) in the core tests plus a UI regression test for the member delete affordance. Generated-By: PostHog Code Task-Id: 2880070b-9691-450f-b566-b76d60089914
…t scope
A non-admin member with agent access viewing an agent scope rendered
two "Set all" panels at once — the top-level BulkTrio and the
scope-switcher's — and the top one exposed a "Needs Approval" bulk
action that is invalid for agent-scoped tools (the setAll mutation
rejects it). Gate the top trio behind scopes.length <= 1 so it never
co-exists with the switcher, and mirror the switcher's
allowNeedsApproval={!agentScope} guard for the residual case where the
initial scope is an agent absent from the scope list.
Fixes review finding on #3643 (discussion_r3691348600).
Generated-By: PostHog Code
Task-Id: 5266fbe7-3dbc-44c0-8299-6ab9564f1c99
…d of assuming OAuth Connecting always submitted an OAuth install, so members could never establish a correct connection to an api_key custom server (and api-key catalog templates never got the member's key). Mirror the backend: surface template_auth_type on the gateway row, connect plain OAuth templates directly, and collect credentials first for everything else — a dialog where custom-server members pick OAuth or API key (with optional client id/secret) and api-key servers take the member's key. Generated-By: PostHog Code Task-Id: a6fbcf9c-dab8-45d9-a9c5-c4a645be7c1a
… access patch setAccessMutation's no-refetch cache patch filled granted_by from the stale cache entry (null for a fresh grant), so the "shared by" attribution on the server-detail access row stayed blank until an unrelated refetch. The backend assigns granted_by to the requesting user on every enable, so mirror that by projecting the session user (useCurrentUser) into the patched agents row, falling back to the previous behavior only while the user is still loading. Generated-By: PostHog Code Task-Id: ebf7c1be-72ee-497b-8ed2-225c71d59b32
The only "Refresh tools from server" button lived inside the scope-switcher bar, which is gated to admins/agent-managers with multiple scopes. A plain connected member never saw it, yet the empty-state copy told them to "Refresh to try again." Render the refresh button in the always-visible Tools header row whenever the scope bar is hidden, so any connected member can manually retry tool discovery against their own credential. Generated-By: PostHog Code Task-Id: 4df9bfd3-de17-470b-a26d-7214a2e2af17
|
React Doctor found 8 issues in 6 files · 8 warnings. 8 warnings
Reviewed by React Doctor for commit |
trunk-io
Bot
deleted the
trunk-merge/pr-3643/74a61602-4d3f-4a86-81fc-715743ce25ca
branch
July 31, 2026 20:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request was created and is being managed by Trunk Merge.
This pull request is based on the main branch at SHA 4cf4612eff526d7c9e62db383ba7900150cf18b3.
See more details here.
When CI completes, this pull request will be closed automatically.
Pull Requests Being Tested
This pull request is testing the changes from pull request 3643.