Skip to content

UI implementation for Agent Identity#1302

Open
rasika2012 wants to merge 21 commits into
wso2:mainfrom
rasika2012:fix-config
Open

UI implementation for Agent Identity#1302
rasika2012 wants to merge 21 commits into
wso2:mainfrom
rasika2012:fix-config

Conversation

@rasika2012

@rasika2012 rasika2012 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Purpose

Issue: #1269

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter �N/A� plus brief explanation of why there�s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type �Sent� when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type �N/A� and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary by CodeRabbit

  • New Features
    • Added environment-scoped agent identity pages for Agents, Groups, and Roles (create/edit/delete) including scope selection and role/group assignment workflows.
    • Added agent detail view showing effective role and group membership per environment.
    • Introduced a new identity-backed API surface (including agent groups/roles) plus React Query hooks for lists and updates.
    • Added reusable UI components (BackButton, EntityHeader, EditFormSkeleton, ListingSkeletonRows) and URL-driven Thunder/MCP navigation.
  • Bug Fixes
    • Refined notification behavior to treat only unauthorized (401) errors as handled.
    • Improved loading placeholder sizing across identity listings.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds environment-scoped agent identity APIs, backend role/group retrieval, React Query hooks, identity management pages, MCP proxy identity security and endpoint editing, nested routing, shared UI components, and supporting type/configuration updates.

Changes

Agent identity backend APIs

Layer / File(s) Summary
Agent role and group retrieval flow
agent-manager-service/{api,clients,controllers,services}/...
Adds authenticated agent role/group retrieval with environment visibility validation, Thunder identity lookups, and 400/404 error handling.
Generated API contracts and backend validation
agent-manager-service/{docs,spec}/..., agent-manager-service/**/*_test.go
Documents and generates the new endpoints and tests provisioning, delegation, visibility, and missing-binding behavior.

Agent identity console

Layer / File(s) Summary
Identity contracts and API integration
console/workspaces/libs/{types,api-client}/...
Adds typed group, role, assignment, agent, and scope contracts with authenticated API wrappers and cache-aware hooks.
Identity routes and management pages
console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/..., .../ViewThunderInstance.tsx, console/workspaces/libs/types/src/routes/...
Adds nested agent, group, and role routes with searchable listings, create/edit forms, validation, pagination, assignment tracking, and save flows.

MCP proxy console updates

Layer / File(s) Summary
Security and tool-scope behavior
console/workspaces/libs/types/src/api/{llm-providers,mcp-proxies,mcp-proxy-scopes}.ts, console/workspaces/libs/api-client/..., console/workspaces/pages/mcp-proxies/src/subComponents/{mcpEndpoints,MCPProxySecurityTab,MCPProxyManageToolsTab}.tsx
Adds identity authentication configuration, proxy scope CRUD, ACL helpers, tool-scope reconciliation, and Manage Tools policy handling.
Endpoint editor and proxy detail flows
console/workspaces/pages/mcp-proxies/src/subComponents/{EndpointFormFields,EndpointsEditorSection,EditMCPProxyDrawer,ViewMCPProxy}.tsx
Replaces endpoint dialogs with inline add/edit flows and a validated drawer, while moving proxy tabs and endpoint selection into URL state.
Proxy capability and environment presentation
console/workspaces/pages/mcp-proxies/src/..., console/workspaces/pages/env-thunders/src/subComponents/{ThunderInstanceOverviewTab,ThunderInstancesTable}.tsx
Refactors capability pickers, endpoint displays, environment labels, and proxy overview cards.

Shared console UI and supporting updates

Layer / File(s) Summary
Reusable navigation and loading components
console/workspaces/libs/shared-component/src/components/..., console/workspaces/pages/identities/src/...
Adds shared navigation/entity/loading components and reduces loading skeleton row counts in identity listings.
Supporting console contracts and configuration
console/AGENTS.md, console/workspaces/pages/*/package.json, console/workspaces/libs/api-client/src/hooks/react-query-notifications.ts
Updates TextField guidance, page dependencies, and expected-error notification handling.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • wso2/agent-manager#1265: Adds backend agent identity routes and scope catalog operations corresponding to the new frontend clients and hooks.
🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning Most required sections are left as template placeholders, so the PR description is largely incomplete. Replace placeholders with concrete content for Goals, Approach, User stories, Release note, Documentation, Testing, Security checks, and other required sections.
Docstring Coverage ⚠️ Warning Docstring coverage is 38.32% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is generic and does not clearly identify the main change beyond a broad UI update. Make the title specific to the main feature, e.g. mention agent roles/groups or the Agent Detail UI update.
✅ Passed checks (2 passed)
Check name Status Explanation
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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.

Actionable comments posted: 4

🧹 Nitpick comments (2)
console/workspaces/pages/mcp-proxies/src/subComponents/ViewMCPProxy.tsx (1)

79-100: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep TABS and TAB_SLUGS in a single array

TABS and TAB_SLUGS are index-aligned but maintained as separate arrays. Adding a tab to one without the other would silently break deep-linking. Consider a single array of { label, slug } objects.

♻️ Proposed refactor: single array of tab definitions
-const TABS = [
-  "Overview",
-  "Capabilities",
-  "Connection",
-  "Manage Tools",
-  "Security",
-  "Rewrite",
-  "Policies",
-] as const;
-
-const TAB_SLUGS = [
-  "overview",
-  "capabilities",
-  "connection",
-  "manage-tools",
-  "security",
-  "rewrite",
-  "policies",
-] as const;
+const TAB_DEFS = [
+  { label: "Overview", slug: "overview" },
+  { label: "Capabilities", slug: "capabilities" },
+  { label: "Connection", slug: "connection" },
+  { label: "Manage Tools", slug: "manage-tools" },
+  { label: "Security", slug: "security" },
+  { label: "Rewrite", slug: "rewrite" },
+  { label: "Policies", slug: "policies" },
+] as const;
+
+const TABS = TAB_DEFS.map((t) => t.label);
+const TAB_SLUGS = TAB_DEFS.map((t) => t.slug);
🤖 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 `@console/workspaces/pages/mcp-proxies/src/subComponents/ViewMCPProxy.tsx`
around lines 79 - 100, Consolidate the separate TABS and TAB_SLUGS arrays into
one tab-definition array containing paired label and slug values, then update
all consumers of TABS and TAB_SLUGS to read the corresponding label or slug
properties. Preserve the existing tab order and URL slugs while ensuring
selection and deep-linking use the unified definitions.
console/workspaces/libs/api-client/src/apis/scopes.ts (1)

37-94: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

throw await res.json() can mask non-JSON error responses.

If the server returns a non-JSON error body (e.g., plain text, HTML, or empty 500), res.json() throws a SyntaxError, hiding the actual HTTP status and error. This pattern is used across all functions in this file and in agent-identity.ts. Consider wrapping with a fallback:

♻️ Proposed refactor
-  if (!res.ok) throw await res.json();
+  if (!res.ok) {
+    let detail: unknown;
+    try { detail = await res.json(); } catch { detail = await res.text().catch(() => undefined); }
+    throw detail ?? new Error(`HTTP ${res.status}`);
+  }
🤖 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 `@console/workspaces/libs/api-client/src/apis/scopes.ts` around lines 37 - 94,
Replace direct throw await res.json() error handling in listScopes, createScope,
updateScope, and deleteScope with a shared fallback that attempts to parse JSON
but preserves the HTTP status and response text when parsing fails, including
empty or non-JSON bodies. Apply the same robust error-handling pattern to the
related functions in agent-identity.ts.
🤖 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 `@console/workspaces/libs/api-client/src/apis/scopes.ts`:
- Around line 66-94: Guard against an undefined scopeName in both updateScope
and deleteScope before obtaining the token or making the HTTP request; reject
the operation using the existing project convention for invalid required path
parameters, and remove the scopeName ?? "" fallback from URL construction so
only a validated, encoded scope name is used.

In
`@console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleEditPage.tsx`:
- Around line 107-139: Preserve role scopes that are absent from the catalog
when initializing selectedScopes. Update the initialization logic in the
selectedScopes useEffect to merge matching catalogScopes with placeholder
ScopeResponse entries such as { id: name, name } for every initialScopeNames
value not found in the catalog, so scopesDirty remains false initially and
updateRole retains them on save.

In
`@console/workspaces/pages/mcp-proxies/src/subComponents/EditMCPProxyDrawer.tsx`:
- Around line 85-96: Update the form-reset useEffect in EditMCPProxyDrawer to
run only when the drawer transitions from closed to open, rather than whenever
proxy changes while open. Track the previous open state with a ref or equivalent
transition guard, keep initializing from the current proxy on that transition,
and avoid including proxy as a trigger that can reset unsaved edits during
background refetches.

In
`@console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxySecurityTab.tsx`:
- Around line 381-397: After a successful save in the update handler,
synchronize the React state with the normalized values that were persisted:
update identityMode to savedIdentityMode and toolScopeRows to the saved
tool-scope rows alongside lastSavedIdentityModeRef and
lastSavedToolScopeRowsRef. Ensure the isDirty/toolScopesDirty calculations use
these synchronized values so switching away from identity does not leave the
form dirty.

---

Nitpick comments:
In `@console/workspaces/libs/api-client/src/apis/scopes.ts`:
- Around line 37-94: Replace direct throw await res.json() error handling in
listScopes, createScope, updateScope, and deleteScope with a shared fallback
that attempts to parse JSON but preserves the HTTP status and response text when
parsing fails, including empty or non-JSON bodies. Apply the same robust
error-handling pattern to the related functions in agent-identity.ts.

In `@console/workspaces/pages/mcp-proxies/src/subComponents/ViewMCPProxy.tsx`:
- Around line 79-100: Consolidate the separate TABS and TAB_SLUGS arrays into
one tab-definition array containing paired label and slug values, then update
all consumers of TABS and TAB_SLUGS to read the corresponding label or slug
properties. Preserve the existing tab order and URL slugs while ensuring
selection and deep-linking use the unified definitions.
🪄 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: Pro

Run ID: 4d843555-d630-41c1-9935-60fcc84efe96

📥 Commits

Reviewing files that changed from the base of the PR and between a445025 and 15e4adc.

⛔ Files ignored due to path filters (1)
  • console/common/config/rush/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (45)
  • console/workspaces/libs/api-client/src/apis/agent-identity.ts
  • console/workspaces/libs/api-client/src/apis/index.ts
  • console/workspaces/libs/api-client/src/apis/scopes.ts
  • console/workspaces/libs/api-client/src/hooks/agent-identity.ts
  • console/workspaces/libs/api-client/src/hooks/index.ts
  • console/workspaces/libs/api-client/src/hooks/react-query-notifications.ts
  • console/workspaces/libs/api-client/src/hooks/scopes.ts
  • console/workspaces/libs/shared-component/src/components/BackButton.tsx
  • console/workspaces/libs/shared-component/src/components/EditFormSkeleton.tsx
  • console/workspaces/libs/shared-component/src/components/EntityHeader.tsx
  • console/workspaces/libs/shared-component/src/components/ListingSkeletonRows.tsx
  • console/workspaces/libs/shared-component/src/components/index.ts
  • console/workspaces/libs/types/src/api/agent-identity.ts
  • console/workspaces/libs/types/src/api/index.ts
  • console/workspaces/libs/types/src/api/llm-providers.ts
  • console/workspaces/libs/types/src/api/mcp-proxies.ts
  • console/workspaces/libs/types/src/api/scopes.ts
  • console/workspaces/libs/types/src/routes/generated-route.map.ts
  • console/workspaces/libs/types/src/routes/routes.map.ts
  • console/workspaces/pages/env-thunders/package.json
  • console/workspaces/pages/env-thunders/src/ThunderInstances.Organization.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstanceComingSoonTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ViewThunderInstance.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/AgentsTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupCreatePage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupEditPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupsPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleCreatePage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleEditPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RolesPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/schemas.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/useAgentLookup.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/useAssignmentDelta.ts
  • console/workspaces/pages/identities/src/GroupsPage.tsx
  • console/workspaces/pages/identities/src/RolesPage.tsx
  • console/workspaces/pages/identities/src/UsersPage.tsx
  • console/workspaces/pages/mcp-proxies/package.json
  • console/workspaces/pages/mcp-proxies/src/subComponents/EditMCPProxyDrawer.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyManageToolsTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyOverviewTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxySecurityTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/ManageEndpointsDialog.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/ViewMCPProxy.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/mcpEndpoints.ts
  • console/workspaces/pages/mcp-proxies/src/subComponents/useCopyWithFeedback.ts
💤 Files with no reviewable changes (1)
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstanceComingSoonTab.tsx

Comment thread console/workspaces/libs/api-client/src/apis/scopes.ts Outdated
Comment thread console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxySecurityTab.tsx Outdated
@rasika2012 rasika2012 changed the title Fix config UI implementation for Agent Identity Jul 12, 2026

@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.

Actionable comments posted: 2

🤖 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
`@console/workspaces/pages/mcp-proxies/src/subComponents/EditMCPProxyDrawer.tsx`:
- Around line 130-139: Update EndpointsEditorSection to generate collision-proof
temporary IDs for newly added endpoint drafts instead of simple numeric values
such as "1". Ensure these IDs cannot match backend endpoint IDs, so the
existingByHandle lookup in the endpoint-mapping flow only reuses data for
genuinely existing endpoints and new drafts receive fresh identity and
configuration.

In
`@console/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsx`:
- Around line 123-152: The performFetch flow currently skips newer requests
while an older fetch is pending, allowing stale capabilities to overwrite the
latest URL. Update performFetch and its response-handling logic to let each
latest debounced fetch run, track request generations or equivalent identity,
and ignore results from older requests so only the newest URL’s response updates
fetchedInfo and related form state.
🪄 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: Pro

Run ID: e1b2052d-6a22-449a-99ba-d867ee2a8aa2

📥 Commits

Reviewing files that changed from the base of the PR and between 15e4adc and f3ca4f3.

⛔ Files ignored due to path filters (1)
  • console/common/config/rush/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (22)
  • console/AGENTS.md
  • console/workspaces/pages/env-thunders/src/ThunderInstances.Organization.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstanceOverviewTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstancesTable.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ViewThunderInstance.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleEditPage.tsx
  • console/workspaces/pages/llm-providers/src/subComponents/LLMProviderSecurityTab.tsx
  • console/workspaces/pages/mcp-proxies/package.json
  • console/workspaces/pages/mcp-proxies/src/components/MCPCapabilitiesView.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/AddEndpointDialog.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/AddMCPProxyForm.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EditMCPProxyDrawer.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointRow.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointsEditorSection.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyManageToolsTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyOverviewTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyRewriteTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxySecurityTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/ManageEndpointsDialog.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/ViewMCPProxy.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/mcpEndpoints.ts
💤 Files with no reviewable changes (2)
  • console/workspaces/pages/mcp-proxies/src/subComponents/ManageEndpointsDialog.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/AddEndpointDialog.tsx
🚧 Files skipped from review as they are similar to previous changes (6)
  • console/workspaces/pages/env-thunders/src/ThunderInstances.Organization.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleEditPage.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/mcpEndpoints.ts
  • console/workspaces/pages/env-thunders/src/subComponents/ViewThunderInstance.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/ViewMCPProxy.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyOverviewTab.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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
console/workspaces/pages/mcp-proxies/src/subComponents/EndpointsEditorSection.tsx (1)

235-239: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Count only currently available environments.

usedEnvIds.size includes IDs present in endpoint drafts even when those environments are no longer in environments. This can display invalid values such as “2 of 1 environments have an endpoint.” Count the intersection with the current environment list instead.

Proposed fix
+      const configuredEnvironmentCount = environments.filter(
+        (environment) => environment.id && usedEnvIds.has(environment.id),
+      ).length;
+
       {environments.length > 0 ? (
         <Typography variant="caption" color="text.secondary">
-          {usedEnvIds.size} of {environments.length} environments have an
+          {configuredEnvironmentCount} of {environments.length} environments have an
           endpoint.
🤖 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
`@console/workspaces/pages/mcp-proxies/src/subComponents/EndpointsEditorSection.tsx`
around lines 235 - 239, Update the environment count display in
EndpointsEditorSection to count only IDs from usedEnvIds that match currently
available environments, using the environments collection as the source of valid
IDs. Keep environments.length as the denominator and preserve the existing text
and conditional rendering.
🤖 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.

Outside diff comments:
In
`@console/workspaces/pages/mcp-proxies/src/subComponents/EndpointsEditorSection.tsx`:
- Around line 235-239: Update the environment count display in
EndpointsEditorSection to count only IDs from usedEnvIds that match currently
available environments, using the environments collection as the source of valid
IDs. Keep environments.length as the denominator and preserve the existing text
and conditional rendering.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 34c23a81-8dde-40ae-bea6-43674eeeef57

📥 Commits

Reviewing files that changed from the base of the PR and between f3ca4f3 and c8fe6d8.

📒 Files selected for processing (7)
  • console/workspaces/libs/api-client/src/apis/scopes.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleEditPage.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EditMCPProxyDrawer.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointsEditorSection.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxySecurityTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/ViewMCPProxy.tsx
🚧 Files skipped from review as they are similar to previous changes (6)
  • console/workspaces/libs/api-client/src/apis/scopes.ts
  • console/workspaces/pages/mcp-proxies/src/subComponents/ViewMCPProxy.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EditMCPProxyDrawer.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxySecurityTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleEditPage.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.

Actionable comments posted: 2

🧹 Nitpick comments (3)
agent-manager-service/docs/api_v1_openapi.yaml (2)

6297-6420: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Inconsistent tag naming for new endpoints.

New paths use tags [MCPProxyScopes] (6302, 6326, 6362, 6398) and [AgentIdentities] (10578), diverging from this file's established Title-Case space-separated convention (e.g. "MCP Proxies", "MCP API Keys", "Agent Identity"). This will fragment the generated Swagger/docs grouping.

✏️ Proposed fix
-      tags: [MCPProxyScopes]
+      tags: [MCP Proxies]
-      tags: [AgentIdentities]
+      tags: [Agent Identity]

Also applies to: 10573-10599

🤖 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 `@agent-manager-service/docs/api_v1_openapi.yaml` around lines 6297 - 6420,
Update the tags on the new MCP proxy scope operations to use the established
display name “MCP Proxies” rather than “MCPProxyScopes”, and update the Agent
Identities endpoint near the Agent identity operations to use the existing
“Agent Identity” convention instead of “AgentIdentities”. Keep each endpoint’s
operationId and behavior unchanged.

6297-6420: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

New MCP Proxy Scopes endpoints omit ErrorResponse schema for error responses.

Unlike virtually every other endpoint in this file, the 400/404/409 responses for listMCPProxyScopes, createMCPProxyScope, updateMCPProxyScope, and deleteMCPProxyScope only have a description, with no content/schema referencing #/components/schemas/ErrorResponse. This means generated clients won't decode structured errors for these status codes, unlike sibling operations.

🤖 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 `@agent-manager-service/docs/api_v1_openapi.yaml` around lines 6297 - 6420,
Update the error responses for listMCPProxyScopes, createMCPProxyScope,
updateMCPProxyScope, and deleteMCPProxyScope to include application/json content
whose schema references `#/components/schemas/ErrorResponse`, matching sibling
endpoints. Preserve each existing status code and description while adding the
structured error schema to every declared 400, 404, and 409 response.
agent-manager-service/services/agent_thunder_provisioning_service.go (1)

511-566: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract shared binding-lookup helper to remove duplication.

GetAgentRoles (511-523) and GetAgentGroups (537-549) duplicate the same binding lookup + ThunderAgentID empty-check block verbatim.

♻️ Proposed refactor
+func (s *agentThunderProvisioningService) resolveProvisionedBinding(ctx context.Context, ouID, projectName, agentName, envName string) (*models.AgentThunderClient, error) {
+	binding, err := s.repo.Get(ctx, ouID, projectName, agentName, envName)
+	if err != nil {
+		if errors.Is(err, repositories.ErrAgentThunderClientNotFound) {
+			return nil, fmt.Errorf("%w: %s in %s", utils.ErrAgentIdentityNotProvisioned, agentName, envName)
+		}
+		return nil, err
+	}
+	if binding.ThunderAgentID == "" {
+		return nil, fmt.Errorf("%w: %s in %s", utils.ErrAgentIdentityNotProvisioned, agentName, envName)
+	}
+	return binding, nil
+}
+
 func (s *agentThunderProvisioningService) GetAgentRoles(ctx context.Context, ouID, projectName, agentName, envName string) ([]thundersvc.ThunderRole, error) {
-	binding, err := s.repo.Get(ctx, ouID, projectName, agentName, envName)
-	if err != nil {
-		if errors.Is(err, repositories.ErrAgentThunderClientNotFound) {
-			return nil, fmt.Errorf("%w: %s in %s", utils.ErrAgentIdentityNotProvisioned, agentName, envName)
-		}
-		return nil, err
-	}
-	if binding.ThunderAgentID == "" {
-		return nil, fmt.Errorf("%w: %s in %s", utils.ErrAgentIdentityNotProvisioned, agentName, envName)
-	}
+	binding, err := s.resolveProvisionedBinding(ctx, ouID, projectName, agentName, envName)
+	if err != nil {
+		return nil, err
+	}

Apply the analogous change to GetAgentGroups.

🤖 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 `@agent-manager-service/services/agent_thunder_provisioning_service.go` around
lines 511 - 566, Extract the duplicated repository lookup and empty
ThunderAgentID validation from GetAgentRoles and GetAgentGroups into a shared
helper on agentThunderProvisioningService. Have the helper return the binding or
the existing ErrAgentIdentityNotProvisioned-wrapped error, then update both
methods to reuse it while preserving their current downstream role and group
retrieval behavior.
🤖 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 `@agent-manager-service/services/agent_manager.go`:
- Line 2192: Update both call sites of cleanupAgentMonitors in DeleteAgent to
dispatch the cleanup asynchronously with go, matching the existing non-blocking
post-delete cleanup pattern. Preserve the current arguments and ensure both
paths return without waiting for cleanupAgentMonitors or DeleteMonitorsByAgent
to complete.
- Around line 3055-3062: Update the error logging in visiblePipelineEnvironments
to include ouID alongside projectName and error, providing the organization
identifier as correlation context when GetProjectDeploymentPipeline fails.

---

Nitpick comments:
In `@agent-manager-service/docs/api_v1_openapi.yaml`:
- Around line 6297-6420: Update the tags on the new MCP proxy scope operations
to use the established display name “MCP Proxies” rather than “MCPProxyScopes”,
and update the Agent Identities endpoint near the Agent identity operations to
use the existing “Agent Identity” convention instead of “AgentIdentities”. Keep
each endpoint’s operationId and behavior unchanged.
- Around line 6297-6420: Update the error responses for listMCPProxyScopes,
createMCPProxyScope, updateMCPProxyScope, and deleteMCPProxyScope to include
application/json content whose schema references
`#/components/schemas/ErrorResponse`, matching sibling endpoints. Preserve each
existing status code and description while adding the structured error schema to
every declared 400, 404, and 409 response.

In `@agent-manager-service/services/agent_thunder_provisioning_service.go`:
- Around line 511-566: Extract the duplicated repository lookup and empty
ThunderAgentID validation from GetAgentRoles and GetAgentGroups into a shared
helper on agentThunderProvisioningService. Have the helper return the binding or
the existing ErrAgentIdentityNotProvisioned-wrapped error, then update both
methods to reuse it while preserving their current downstream role and group
retrieval behavior.
🪄 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: Pro

Run ID: afe19c95-0fa8-405a-b6e3-7fff227b9822

📥 Commits

Reviewing files that changed from the base of the PR and between c8fe6d8 and fcce9a3.

⛔ Files ignored due to path filters (1)
  • console/common/config/rush/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (67)
  • agent-manager-service/api/agent_routes.go
  • agent-manager-service/clients/clientmocks/env_identity_client_mock.go
  • agent-manager-service/clients/thundersvc/identity_client.go
  • agent-manager-service/controllers/agent_controller.go
  • agent-manager-service/docs/api_v1_openapi.yaml
  • agent-manager-service/services/agent_manager.go
  • agent-manager-service/services/agent_manager_test.go
  • agent-manager-service/services/agent_thunder_provisioning_service.go
  • agent-manager-service/services/agent_thunder_provisioning_service_test.go
  • agent-manager-service/spec/api_agent_identity.go
  • console/AGENTS.md
  • console/workspaces/libs/api-client/src/apis/agent-identity.ts
  • console/workspaces/libs/api-client/src/apis/index.ts
  • console/workspaces/libs/api-client/src/apis/mcp-proxy-scopes.ts
  • console/workspaces/libs/api-client/src/hooks/agent-identity.ts
  • console/workspaces/libs/api-client/src/hooks/index.ts
  • console/workspaces/libs/api-client/src/hooks/mcp-proxy-scopes.ts
  • console/workspaces/libs/api-client/src/hooks/react-query-notifications.ts
  • console/workspaces/libs/shared-component/src/components/BackButton.tsx
  • console/workspaces/libs/shared-component/src/components/EditFormSkeleton.tsx
  • console/workspaces/libs/shared-component/src/components/EntityHeader.tsx
  • console/workspaces/libs/shared-component/src/components/ListingSkeletonRows.tsx
  • console/workspaces/libs/shared-component/src/components/index.ts
  • console/workspaces/libs/types/src/api/agent-identity.ts
  • console/workspaces/libs/types/src/api/index.ts
  • console/workspaces/libs/types/src/api/llm-providers.ts
  • console/workspaces/libs/types/src/api/mcp-proxies.ts
  • console/workspaces/libs/types/src/api/mcp-proxy-scopes.ts
  • console/workspaces/libs/types/src/routes/generated-route.map.ts
  • console/workspaces/libs/types/src/routes/routes.map.ts
  • console/workspaces/pages/env-thunders/package.json
  • console/workspaces/pages/env-thunders/src/ThunderInstances.Organization.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstanceComingSoonTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstanceOverviewTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstancesTable.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ViewThunderInstance.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/AgentsTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupCreatePage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupEditPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupsPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleCreatePage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleEditPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RolesPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/schemas.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/scopeChoice.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/useAgentLookup.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/useAssignmentDelta.ts
  • console/workspaces/pages/identities/src/GroupsPage.tsx
  • console/workspaces/pages/identities/src/RolesPage.tsx
  • console/workspaces/pages/identities/src/UsersPage.tsx
  • console/workspaces/pages/llm-providers/src/subComponents/LLMProviderSecurityTab.tsx
  • console/workspaces/pages/mcp-proxies/package.json
  • console/workspaces/pages/mcp-proxies/src/components/MCPCapabilitiesView.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/AddEndpointDialog.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/AddMCPProxyForm.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EditMCPProxyDrawer.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointRow.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointsEditorSection.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyManageToolsTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyOverviewTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyRewriteTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxySecurityTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/ManageEndpointsDialog.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/ViewMCPProxy.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/mcpEndpoints.ts
  • console/workspaces/pages/mcp-proxies/src/subComponents/useCopyWithFeedback.ts
💤 Files with no reviewable changes (3)
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstanceComingSoonTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/ManageEndpointsDialog.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/AddEndpointDialog.tsx
🚧 Files skipped from review as they are similar to previous changes (43)
  • console/AGENTS.md
  • console/workspaces/pages/identities/src/UsersPage.tsx
  • console/workspaces/libs/api-client/src/hooks/index.ts
  • console/workspaces/libs/api-client/src/apis/index.ts
  • console/workspaces/libs/shared-component/src/components/index.ts
  • console/workspaces/libs/shared-component/src/components/BackButton.tsx
  • console/workspaces/libs/types/src/api/index.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/schemas.ts
  • console/workspaces/pages/env-thunders/package.json
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointRow.tsx
  • console/workspaces/libs/types/src/routes/routes.map.ts
  • console/workspaces/libs/shared-component/src/components/EditFormSkeleton.tsx
  • console/workspaces/pages/env-thunders/src/ThunderInstances.Organization.tsx
  • console/workspaces/libs/api-client/src/hooks/react-query-notifications.ts
  • console/workspaces/libs/shared-component/src/components/EntityHeader.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/useAssignmentDelta.ts
  • console/workspaces/libs/shared-component/src/components/ListingSkeletonRows.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/useAgentLookup.ts
  • console/workspaces/libs/types/src/routes/generated-route.map.ts
  • console/workspaces/pages/identities/src/GroupsPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupEditPage.tsx
  • console/workspaces/libs/api-client/src/apis/agent-identity.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/AgentsTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstancesTable.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyOverviewTab.tsx
  • console/workspaces/pages/mcp-proxies/src/components/MCPCapabilitiesView.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/AddMCPProxyForm.tsx
  • console/workspaces/libs/api-client/src/hooks/agent-identity.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleEditPage.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/mcpEndpoints.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleCreatePage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstanceOverviewTab.tsx
  • console/workspaces/pages/mcp-proxies/package.json
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupsPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ViewThunderInstance.tsx
  • console/workspaces/libs/types/src/api/agent-identity.ts
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointsEditorSection.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RolesPage.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyManageToolsTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupCreatePage.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EditMCPProxyDrawer.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyRewriteTab.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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 2

🧹 Nitpick comments (3)
agent-manager-service/docs/api_v1_openapi.yaml (2)

6297-6420: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Inconsistent tag naming for new endpoints.

New paths use tags [MCPProxyScopes] (6302, 6326, 6362, 6398) and [AgentIdentities] (10578), diverging from this file's established Title-Case space-separated convention (e.g. "MCP Proxies", "MCP API Keys", "Agent Identity"). This will fragment the generated Swagger/docs grouping.

✏️ Proposed fix
-      tags: [MCPProxyScopes]
+      tags: [MCP Proxies]
-      tags: [AgentIdentities]
+      tags: [Agent Identity]

Also applies to: 10573-10599

🤖 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 `@agent-manager-service/docs/api_v1_openapi.yaml` around lines 6297 - 6420,
Update the tags on the new MCP proxy scope operations to use the established
display name “MCP Proxies” rather than “MCPProxyScopes”, and update the Agent
Identities endpoint near the Agent identity operations to use the existing
“Agent Identity” convention instead of “AgentIdentities”. Keep each endpoint’s
operationId and behavior unchanged.

6297-6420: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

New MCP Proxy Scopes endpoints omit ErrorResponse schema for error responses.

Unlike virtually every other endpoint in this file, the 400/404/409 responses for listMCPProxyScopes, createMCPProxyScope, updateMCPProxyScope, and deleteMCPProxyScope only have a description, with no content/schema referencing #/components/schemas/ErrorResponse. This means generated clients won't decode structured errors for these status codes, unlike sibling operations.

🤖 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 `@agent-manager-service/docs/api_v1_openapi.yaml` around lines 6297 - 6420,
Update the error responses for listMCPProxyScopes, createMCPProxyScope,
updateMCPProxyScope, and deleteMCPProxyScope to include application/json content
whose schema references `#/components/schemas/ErrorResponse`, matching sibling
endpoints. Preserve each existing status code and description while adding the
structured error schema to every declared 400, 404, and 409 response.
agent-manager-service/services/agent_thunder_provisioning_service.go (1)

511-566: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract shared binding-lookup helper to remove duplication.

GetAgentRoles (511-523) and GetAgentGroups (537-549) duplicate the same binding lookup + ThunderAgentID empty-check block verbatim.

♻️ Proposed refactor
+func (s *agentThunderProvisioningService) resolveProvisionedBinding(ctx context.Context, ouID, projectName, agentName, envName string) (*models.AgentThunderClient, error) {
+	binding, err := s.repo.Get(ctx, ouID, projectName, agentName, envName)
+	if err != nil {
+		if errors.Is(err, repositories.ErrAgentThunderClientNotFound) {
+			return nil, fmt.Errorf("%w: %s in %s", utils.ErrAgentIdentityNotProvisioned, agentName, envName)
+		}
+		return nil, err
+	}
+	if binding.ThunderAgentID == "" {
+		return nil, fmt.Errorf("%w: %s in %s", utils.ErrAgentIdentityNotProvisioned, agentName, envName)
+	}
+	return binding, nil
+}
+
 func (s *agentThunderProvisioningService) GetAgentRoles(ctx context.Context, ouID, projectName, agentName, envName string) ([]thundersvc.ThunderRole, error) {
-	binding, err := s.repo.Get(ctx, ouID, projectName, agentName, envName)
-	if err != nil {
-		if errors.Is(err, repositories.ErrAgentThunderClientNotFound) {
-			return nil, fmt.Errorf("%w: %s in %s", utils.ErrAgentIdentityNotProvisioned, agentName, envName)
-		}
-		return nil, err
-	}
-	if binding.ThunderAgentID == "" {
-		return nil, fmt.Errorf("%w: %s in %s", utils.ErrAgentIdentityNotProvisioned, agentName, envName)
-	}
+	binding, err := s.resolveProvisionedBinding(ctx, ouID, projectName, agentName, envName)
+	if err != nil {
+		return nil, err
+	}

Apply the analogous change to GetAgentGroups.

🤖 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 `@agent-manager-service/services/agent_thunder_provisioning_service.go` around
lines 511 - 566, Extract the duplicated repository lookup and empty
ThunderAgentID validation from GetAgentRoles and GetAgentGroups into a shared
helper on agentThunderProvisioningService. Have the helper return the binding or
the existing ErrAgentIdentityNotProvisioned-wrapped error, then update both
methods to reuse it while preserving their current downstream role and group
retrieval behavior.
🤖 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 `@agent-manager-service/services/agent_manager.go`:
- Line 2192: Update both call sites of cleanupAgentMonitors in DeleteAgent to
dispatch the cleanup asynchronously with go, matching the existing non-blocking
post-delete cleanup pattern. Preserve the current arguments and ensure both
paths return without waiting for cleanupAgentMonitors or DeleteMonitorsByAgent
to complete.
- Around line 3055-3062: Update the error logging in visiblePipelineEnvironments
to include ouID alongside projectName and error, providing the organization
identifier as correlation context when GetProjectDeploymentPipeline fails.

---

Nitpick comments:
In `@agent-manager-service/docs/api_v1_openapi.yaml`:
- Around line 6297-6420: Update the tags on the new MCP proxy scope operations
to use the established display name “MCP Proxies” rather than “MCPProxyScopes”,
and update the Agent Identities endpoint near the Agent identity operations to
use the existing “Agent Identity” convention instead of “AgentIdentities”. Keep
each endpoint’s operationId and behavior unchanged.
- Around line 6297-6420: Update the error responses for listMCPProxyScopes,
createMCPProxyScope, updateMCPProxyScope, and deleteMCPProxyScope to include
application/json content whose schema references
`#/components/schemas/ErrorResponse`, matching sibling endpoints. Preserve each
existing status code and description while adding the structured error schema to
every declared 400, 404, and 409 response.

In `@agent-manager-service/services/agent_thunder_provisioning_service.go`:
- Around line 511-566: Extract the duplicated repository lookup and empty
ThunderAgentID validation from GetAgentRoles and GetAgentGroups into a shared
helper on agentThunderProvisioningService. Have the helper return the binding or
the existing ErrAgentIdentityNotProvisioned-wrapped error, then update both
methods to reuse it while preserving their current downstream role and group
retrieval behavior.
🪄 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: Pro

Run ID: afe19c95-0fa8-405a-b6e3-7fff227b9822

📥 Commits

Reviewing files that changed from the base of the PR and between c8fe6d8 and fcce9a3.

⛔ Files ignored due to path filters (1)
  • console/common/config/rush/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (67)
  • agent-manager-service/api/agent_routes.go
  • agent-manager-service/clients/clientmocks/env_identity_client_mock.go
  • agent-manager-service/clients/thundersvc/identity_client.go
  • agent-manager-service/controllers/agent_controller.go
  • agent-manager-service/docs/api_v1_openapi.yaml
  • agent-manager-service/services/agent_manager.go
  • agent-manager-service/services/agent_manager_test.go
  • agent-manager-service/services/agent_thunder_provisioning_service.go
  • agent-manager-service/services/agent_thunder_provisioning_service_test.go
  • agent-manager-service/spec/api_agent_identity.go
  • console/AGENTS.md
  • console/workspaces/libs/api-client/src/apis/agent-identity.ts
  • console/workspaces/libs/api-client/src/apis/index.ts
  • console/workspaces/libs/api-client/src/apis/mcp-proxy-scopes.ts
  • console/workspaces/libs/api-client/src/hooks/agent-identity.ts
  • console/workspaces/libs/api-client/src/hooks/index.ts
  • console/workspaces/libs/api-client/src/hooks/mcp-proxy-scopes.ts
  • console/workspaces/libs/api-client/src/hooks/react-query-notifications.ts
  • console/workspaces/libs/shared-component/src/components/BackButton.tsx
  • console/workspaces/libs/shared-component/src/components/EditFormSkeleton.tsx
  • console/workspaces/libs/shared-component/src/components/EntityHeader.tsx
  • console/workspaces/libs/shared-component/src/components/ListingSkeletonRows.tsx
  • console/workspaces/libs/shared-component/src/components/index.ts
  • console/workspaces/libs/types/src/api/agent-identity.ts
  • console/workspaces/libs/types/src/api/index.ts
  • console/workspaces/libs/types/src/api/llm-providers.ts
  • console/workspaces/libs/types/src/api/mcp-proxies.ts
  • console/workspaces/libs/types/src/api/mcp-proxy-scopes.ts
  • console/workspaces/libs/types/src/routes/generated-route.map.ts
  • console/workspaces/libs/types/src/routes/routes.map.ts
  • console/workspaces/pages/env-thunders/package.json
  • console/workspaces/pages/env-thunders/src/ThunderInstances.Organization.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstanceComingSoonTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstanceOverviewTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstancesTable.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ViewThunderInstance.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/AgentsTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupCreatePage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupEditPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupsPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleCreatePage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleEditPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RolesPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/schemas.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/scopeChoice.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/useAgentLookup.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/useAssignmentDelta.ts
  • console/workspaces/pages/identities/src/GroupsPage.tsx
  • console/workspaces/pages/identities/src/RolesPage.tsx
  • console/workspaces/pages/identities/src/UsersPage.tsx
  • console/workspaces/pages/llm-providers/src/subComponents/LLMProviderSecurityTab.tsx
  • console/workspaces/pages/mcp-proxies/package.json
  • console/workspaces/pages/mcp-proxies/src/components/MCPCapabilitiesView.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/AddEndpointDialog.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/AddMCPProxyForm.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EditMCPProxyDrawer.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointRow.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointsEditorSection.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyManageToolsTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyOverviewTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyRewriteTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxySecurityTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/ManageEndpointsDialog.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/ViewMCPProxy.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/mcpEndpoints.ts
  • console/workspaces/pages/mcp-proxies/src/subComponents/useCopyWithFeedback.ts
💤 Files with no reviewable changes (3)
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstanceComingSoonTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/ManageEndpointsDialog.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/AddEndpointDialog.tsx
🚧 Files skipped from review as they are similar to previous changes (43)
  • console/AGENTS.md
  • console/workspaces/pages/identities/src/UsersPage.tsx
  • console/workspaces/libs/api-client/src/hooks/index.ts
  • console/workspaces/libs/api-client/src/apis/index.ts
  • console/workspaces/libs/shared-component/src/components/index.ts
  • console/workspaces/libs/shared-component/src/components/BackButton.tsx
  • console/workspaces/libs/types/src/api/index.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/schemas.ts
  • console/workspaces/pages/env-thunders/package.json
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointRow.tsx
  • console/workspaces/libs/types/src/routes/routes.map.ts
  • console/workspaces/libs/shared-component/src/components/EditFormSkeleton.tsx
  • console/workspaces/pages/env-thunders/src/ThunderInstances.Organization.tsx
  • console/workspaces/libs/api-client/src/hooks/react-query-notifications.ts
  • console/workspaces/libs/shared-component/src/components/EntityHeader.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/useAssignmentDelta.ts
  • console/workspaces/libs/shared-component/src/components/ListingSkeletonRows.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/useAgentLookup.ts
  • console/workspaces/libs/types/src/routes/generated-route.map.ts
  • console/workspaces/pages/identities/src/GroupsPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupEditPage.tsx
  • console/workspaces/libs/api-client/src/apis/agent-identity.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/AgentsTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstancesTable.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyOverviewTab.tsx
  • console/workspaces/pages/mcp-proxies/src/components/MCPCapabilitiesView.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/AddMCPProxyForm.tsx
  • console/workspaces/libs/api-client/src/hooks/agent-identity.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleEditPage.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/mcpEndpoints.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleCreatePage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ThunderInstanceOverviewTab.tsx
  • console/workspaces/pages/mcp-proxies/package.json
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupsPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ViewThunderInstance.tsx
  • console/workspaces/libs/types/src/api/agent-identity.ts
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointsEditorSection.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RolesPage.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyManageToolsTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupCreatePage.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/EditMCPProxyDrawer.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyRewriteTab.tsx
🛑 Comments failed to post (2)
agent-manager-service/services/agent_manager.go (2)

2192-2192: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

cleanupAgentMonitors is called synchronously, contradicting its own doc comment and the sibling "never blocks the caller" pattern.

Both call sites (2192, 2218) invoke cleanupAgentMonitors without go, while the function's doc comment claims it "match[es] the other post-delete cleanups" — which are all dispatched as background goroutines (go s.deleteAgentLLMConfigurations(...), go s.agentThunderProvisioning.DeleteAllBindings(...)). As written, DeleteAgent's HTTP response is now blocked on DeleteMonitorsByAgent completing, adding avoidable latency for a documented best-effort operation.

🐛 Proposed fix
-			s.cleanupAgentMonitors(ctx, ouID, projectName, agentName)
+			go s.cleanupAgentMonitors(ctx, ouID, projectName, agentName)
 			return nil

and

-	// Cleanup monitors owned by this agent so they are not orphaned after deletion.
-	s.cleanupAgentMonitors(ctx, ouID, projectName, agentName)
+	// Cleanup monitors owned by this agent so they are not orphaned after deletion.
+	go s.cleanupAgentMonitors(ctx, ouID, projectName, agentName)

Also applies to: 2217-2230

🤖 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 `@agent-manager-service/services/agent_manager.go` at line 2192, Update both
call sites of cleanupAgentMonitors in DeleteAgent to dispatch the cleanup
asynchronously with go, matching the existing non-blocking post-delete cleanup
pattern. Preserve the current arguments and ensure both paths return without
waiting for cleanupAgentMonitors or DeleteMonitorsByAgent to complete.

3055-3062: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add ouID to the error log for correlation.

The log only includes projectName, omitting the organization identifier.

📝 Proposed fix
-		s.logger.Error("Failed to get deployment pipeline for agent identity visibility", "projectName", projectName, "error", err)
+		s.logger.Error("Failed to get deployment pipeline for agent identity visibility", "ouID", ouID, "projectName", projectName, "error", err)
Based on path instructions: "Log with correlation context including organization, resource ID, and request ID."
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

func (s *agentManagerService) visiblePipelineEnvironments(ctx context.Context, ouID, projectName string) (map[string]bool, error) {
	pipeline, err := s.ocClient.GetProjectDeploymentPipeline(ctx, ouID, projectName)
	if err != nil {
		s.logger.Error("Failed to get deployment pipeline for agent identity visibility", "ouID", ouID, "projectName", projectName, "error", err)
		return nil, translatePipelineError(err)
	}
	return allPipelineEnvironmentNames(pipeline.PromotionPaths), nil
}
🤖 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 `@agent-manager-service/services/agent_manager.go` around lines 3055 - 3062,
Update the error logging in visiblePipelineEnvironments to include ouID
alongside projectName and error, providing the organization identifier as
correlation context when GetProjectDeploymentPipeline fails.

Source: Path instructions

@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)
console/workspaces/libs/api-client/src/apis/agents.ts (1)

206-236: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the unreachable if (!res.ok) branches
httpGET already throws on non-OK responses, and the same dead check is repeated across the GET helpers in agents.ts. Folding these calls through a shared helper would remove the duplication as well.

🤖 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 `@console/workspaces/libs/api-client/src/apis/agents.ts` around lines 206 -
236, Remove the unreachable !res.ok checks from getAgentRoles and
getAgentGroups, relying on httpGET to throw for non-OK responses before
returning res.json(). Apply the same cleanup across the repeated GET helpers in
agents.ts, and reuse a shared helper for the common request/error/JSON flow
where appropriate.
🤖 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 `@console/workspaces/libs/api-client/src/apis/agents.ts`:
- Around line 206-236: Remove the unreachable !res.ok checks from getAgentRoles
and getAgentGroups, relying on httpGET to throw for non-OK responses before
returning res.json(). Apply the same cleanup across the repeated GET helpers in
agents.ts, and reuse a shared helper for the common request/error/JSON flow
where appropriate.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 55c10e00-397a-4257-8d67-13fc77e8031d

📥 Commits

Reviewing files that changed from the base of the PR and between fcce9a3 and 5cacaf8.

⛔ Files ignored due to path filters (1)
  • console/common/config/rush/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • console/workspaces/libs/api-client/src/apis/agents.ts
  • console/workspaces/libs/api-client/src/hooks/agents.ts
  • console/workspaces/libs/types/src/api/agents.ts
  • console/workspaces/libs/types/src/routes/generated-route.map.ts
  • console/workspaces/libs/types/src/routes/routes.map.ts
  • console/workspaces/pages/env-thunders/src/subComponents/ViewThunderInstance.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/AgentDetailPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/AgentsTab.tsx
🚧 Files skipped from review as they are similar to previous changes (4)
  • console/workspaces/libs/types/src/routes/routes.map.ts
  • console/workspaces/libs/types/src/routes/generated-route.map.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/AgentsTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/ViewThunderInstance.tsx

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