Skip to content

Refactor agent identity components for UI consistency and improved display#1342

Open
rasika2012 wants to merge 5 commits into
wso2:mainfrom
rasika2012:improve-agentid
Open

Refactor agent identity components for UI consistency and improved display#1342
rasika2012 wants to merge 5 commits into
wso2:mainfrom
rasika2012:improve-agentid

Conversation

@rasika2012

@rasika2012 rasika2012 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Purpose

Issue: #1324

image image

This pull request refactors the agent identity UI in several areas to improve clarity, consistency, and usability. The most notable changes are the replacement of chip-based lists with tables for displaying roles, groups, scopes, and permissions, as well as updating terminology from "Thunder Agent ID" to "Agent ID" throughout the UI. Additional improvements include code cleanup and enhanced memoization for performance.

UI and Terminology Updates:

  • Replaced chip-based lists with ListingTable tables for displaying agent roles, group memberships, assigned scopes, and permissions in AgentDetailPage.tsx and RoleEditPage.tsx, providing clearer and more consistent data presentation. [1] [2] [3] [4]
  • Updated all references of "Thunder Agent ID" to "Agent ID" in table headers and comments across the agent identity UI for clarity and consistency. [1] [2] [3] [4] [5]

Component and Code Improvements:

  • Refactored the reusable read-only tab component to display items in a table format (ReadOnlyItemsTable) and updated its usage in AgentDetailPage.tsx. [1] [2] [3] [4]
  • Improved memoization for catalog lookups in RoleEditPage.tsx by moving catalogByScope to a useMemo and adjusting dependencies for better performance. [1] [2]
  • Removed unused code and components, such as the monospace input styling and the SecretRevealAlert component, simplifying EnvAgentIdentitySection.tsx. [1] [2]

Minor Enhancements:

  • Updated the regenerate button to show a spinner while regenerating, improving user feedback in EnvAgentIdentitySection.tsx.

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 a “Manage AgentID” drawer in the Configure Agent page, deep-linked from agent overviews for quick per-environment credential management.
    • Updated roles/groups/permissions/scope displays to table-based layouts (with descriptions and per-item removal where applicable).
    • Standardized section headers for environment agent performance/observability and enhanced agent roles/groups rendering on environment cards.
  • Improvements
    • Renamed “Thunder Agent ID” to “Agent ID” across relevant tables.
    • Refined the API key “Generate” button to use a lighter text style with improved icon/loading behavior.
  • Changes
    • Removed the previous external agent identity reveal/regeneration UI from the agent overview.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Agent identity management moved to a URL-driven Configure Agent drawer with credential, role, group, and endpoint views. Identity-related overview controls were removed or redirected, configuration tabs gained deep-link state, MCP tools gained grouped ACL-aware tables, and overview headers were standardized.

Changes

Agent identity tables

Layer / File(s) Summary
Roles, groups, scopes, and permissions tables
console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/*, console/workspaces/pages/identities/src/RoleEditPage.tsx
Read-only roles and groups, selected scopes, and selected permissions now render in ListingTable views with descriptions and conditional removal actions. Agent identifier labels now use “Agent ID”.
Manage AgentID drawer
console/workspaces/libs/api-client/src/hooks/agents.ts, console/workspaces/pages/configure-agent/src/Configure*
Configure Agent opens a URL-driven drawer that selects an environment and displays identity binding status, credentials, roles, groups, endpoints, and management actions.
Configure navigation and MCP tools
console/workspaces/pages/configure-agent/src/*, console/workspaces/pages/mcp-proxies/src/*
Tab and back-link query parameters are standardized; MCP tools are grouped by environment endpoint with ACL status and scope information, while endpoint resolution is included in tab loading state.
Overview composition and shared presentation
console/workspaces/pages/overview/src/AgentOverview/*, console/workspaces/libs/shared-component/src/components/*
Overview identity regeneration controls are removed, role/group display is shared and linked to Manage AgentID, section headers are standardized, monitor ordering and drawer spacing change, and API key generation uses a text button with a key icon.

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

Possibly related PRs

Suggested reviewers: jhivandb

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only partially fills the template; most required sections like Goals, Approach, tests, and security checks are missing. Add the missing template sections, including goals, approach, user stories, release note, tests, security, and documentation details.
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main UI refactor and terminology cleanup in this PR.
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: 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/overview/src/AgentOverview/EnvAgentIdentitySection.tsx`:
- Around line 137-152: Use a shared credential-mutation pending state in the
EnvAgentIdentitySection handlers, covering both claimSecret in handleClaim and
regenerate in handleRegenerate. Set it for the full duration of either async
operation, disable both controls while it is active, and clear it in a finally
path so failures do not leave the actions permanently disabled.

In
`@console/workspaces/pages/overview/src/AgentOverview/InstrumentationDrawer.tsx`:
- Around line 183-190: Key the EnvAgentIdentitySection render by the complete
identity tuple—orgName, projName, agentName, and environment—so React remounts
it whenever the selected environment or any identity component changes,
resetting displayed credentials while preserving the existing conditional
rendering.
🪄 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: d888bd3d-1fd6-404f-a74d-9bf4d0382f1b

📥 Commits

Reviewing files that changed from the base of the PR and between 222f6b8 and c2fc655.

📒 Files selected for processing (12)
  • console/workspaces/libs/types/src/api/agent-identity.ts
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/AgentDetailPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/AgentsTab.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/GroupEditPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/RoleEditPage.tsx
  • console/workspaces/pages/env-thunders/src/subComponents/agentIdentity/useAgentLookup.ts
  • console/workspaces/pages/identities/src/RoleEditPage.tsx
  • console/workspaces/pages/overview/src/AgentOverview/EnvAgentIdentitySection.tsx
  • console/workspaces/pages/overview/src/AgentOverview/ExternalAgentOverview.tsx
  • console/workspaces/pages/overview/src/AgentOverview/InstrumentationDrawer.tsx
  • console/workspaces/pages/overview/src/AgentOverview/InternalAgentOverview.tsx
  • console/workspaces/pages/overview/src/AgentOverview/TokenGenerationStep.tsx

Comment thread console/workspaces/pages/overview/src/AgentOverview/EnvAgentIdentitySection.tsx Outdated
Comment on lines +183 to +190
{orgName && projName && agentName && environment && (
<EnvAgentIdentitySection
orgId={orgName}
projectId={projName}
agentId={agentName}
envId={environment}
/>
)}

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Reset revealed credentials when the selected environment changes.

React preserves EnvAgentIdentitySection state at this position. Switching environments can therefore display the previous environment’s client ID and secret. Key the component by the full identity tuple to force state isolation.

Proposed fix
 <EnvAgentIdentitySection
+  key={`${orgName}/${projName}/${agentName}/${environment}`}
   orgId={orgName}
   projectId={projName}
   agentId={agentName}
   envId={environment}
 />
📝 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.

Suggested change
{orgName && projName && agentName && environment && (
<EnvAgentIdentitySection
orgId={orgName}
projectId={projName}
agentId={agentName}
envId={environment}
/>
)}
{orgName && projName && agentName && environment && (
<EnvAgentIdentitySection
key={`${orgName}/${projName}/${agentName}/${environment}`}
orgId={orgName}
projectId={projName}
agentId={agentName}
envId={environment}
/>
)}
🤖 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/overview/src/AgentOverview/InstrumentationDrawer.tsx`
around lines 183 - 190, Key the EnvAgentIdentitySection render by the complete
identity tuple—orgName, projName, agentName, and environment—so React remounts
it whenever the selected environment or any identity component changes,
resetting displayed credentials while preserving the existing conditional
rendering.

@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: 5

🤖 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/hooks/agents.ts`:
- Around line 241-252: Preserve query error state throughout the affected UI
instead of treating failures as empty data: in
console/workspaces/libs/api-client/src/hooks/agents.ts:241-252, update
useAgentIdentityBinding to return isError and error; in
console/workspaces/pages/configure-agent/src/Configure.Component.tsx:156-160,
retain pipeline/environment loading and error states for the drawer; in
console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx:92-96,
capture Thunder instance errors, at 130-145 render identity-query failures
before absent-binding handling, and at 314-324 show the query error instead of
“No identity provider”; in
console/workspaces/pages/configure-agent/src/ViewMCPServer.Component.tsx:178-180
distinguish environment lookup errors from an empty list, and at 238-260 surface
proxy and scope query failures instead of empty tools or metadata.

In `@console/workspaces/pages/configure-agent/src/Configure.Component.tsx`:
- Around line 137-144: Update closeManageIdentity to call setSearchParams with
the replace option enabled when removing MANAGE_IDENTITY_PARAM and
IDENTITY_ENV_PARAM, so closing the drawer replaces the current history entry
instead of adding one. Preserve the existing parameter-removal behavior.

In
`@console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx`:
- Around line 255-277: Update the Reveal Secret condition around handleClaim so
it also requires the binding to represent an external agent, reusing the
existing external-agent indicator from the component. Serialize handleClaim and
handleRegenerate per credential key by disabling both buttons whenever either
isClaiming or isRegenerating, while preserving their existing loading labels and
actions.
- Around line 424-430: Update the AgentIdentitySection usage in
ManageIdentityDrawer so it remounts whenever envName changes by providing a key
derived from envName. Preserve the existing props and rendering condition while
ensuring revealed local state is reset for each environment.

In `@console/workspaces/pages/configure-agent/src/ViewMCPServer.Component.tsx`:
- Around line 309-318: Update the tool-group selection logic around
selectedToolGroupKey and the Tools section to fall back to toolGroups[0] when
the selection is initially empty, preventing the empty-state flash. Use the same
first-group fallback for the Select value so the displayed selection and active
group remain synchronized, while preserving the effect-driven selection after it
runs.
🪄 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: 38a69266-9ace-4d97-981e-55f500e033c4

📥 Commits

Reviewing files that changed from the base of the PR and between c2fc655 and 427898f.

📒 Files selected for processing (21)
  • console/workspaces/libs/api-client/src/hooks/agents.ts
  • console/workspaces/libs/shared-component/src/components/AgentRolesGroups/AgentRolesGroups.tsx
  • console/workspaces/libs/shared-component/src/components/index.ts
  • console/workspaces/libs/types/src/routes/index.ts
  • console/workspaces/libs/types/src/routes/manageIdentityParams.ts
  • console/workspaces/pages/configure-agent/src/Configure.Component.tsx
  • console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx
  • console/workspaces/pages/configure-agent/src/ViewLLMProvider.Component.tsx
  • console/workspaces/pages/configure-agent/src/ViewMCPServer.Component.tsx
  • console/workspaces/pages/configure-agent/src/configureTabs.ts
  • console/workspaces/pages/mcp-proxies/src/index.ts
  • console/workspaces/pages/mcp-proxies/src/subComponents/ViewMCPProxy.tsx
  • console/workspaces/pages/overview/src/AgentOverview/EnvAgentIdentitySection.tsx
  • console/workspaces/pages/overview/src/AgentOverview/EnvAgentRolesGroupsSection.tsx
  • console/workspaces/pages/overview/src/AgentOverview/EnvMonitorsSection.tsx
  • console/workspaces/pages/overview/src/AgentOverview/EnvObservabilitySection.tsx
  • console/workspaces/pages/overview/src/AgentOverview/InstrumentationDrawer.tsx
  • console/workspaces/pages/overview/src/AgentOverview/InternalAgentOverview.tsx
  • console/workspaces/pages/overview/src/AgentOverview/SectionHeader.tsx
  • console/workspaces/pages/overview/src/AgentOverview/manageIdentityLink.ts
  • console/workspaces/pages/overview/src/AgentOverview/useAgentIdentityBinding.ts
💤 Files with no reviewable changes (4)
  • console/workspaces/pages/overview/src/AgentOverview/InstrumentationDrawer.tsx
  • console/workspaces/pages/overview/src/AgentOverview/useAgentIdentityBinding.ts
  • console/workspaces/pages/overview/src/AgentOverview/EnvAgentIdentitySection.tsx
  • console/workspaces/pages/overview/src/AgentOverview/InternalAgentOverview.tsx

Comment on lines +241 to +252
const { data: identityViews, isLoading } = useGetAgentIdentity(
{ orgName: orgId, projName: projectId, agentName: agentId },
{ environment: envId },
);
const binding = identityViews?.[0];

return {
binding,
provisioned: binding?.status === "completed",
isLoading,
};
}

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.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Preserve query errors instead of presenting them as empty identity or tool data.

These queries discard error state, causing outages and authorization-metadata failures to appear as legitimate “not found,” empty tools, or missing scopes.

  • console/workspaces/libs/api-client/src/hooks/agents.ts#L241-L252: return isError and error from useAgentIdentityBinding.
  • console/workspaces/pages/configure-agent/src/Configure.Component.tsx#L156-L160: retain pipeline/environment loading and error states for the drawer.
  • console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx#L92-L96: capture Thunder instance query errors.
  • console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx#L130-L145: render identity-query failures before the absent-binding state.
  • console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx#L314-L324: show a query error instead of “No identity provider.”
  • console/workspaces/pages/configure-agent/src/ViewMCPServer.Component.tsx#L178-L180: distinguish environment lookup failure from an empty environment list.
  • console/workspaces/pages/configure-agent/src/ViewMCPServer.Component.tsx#L238-L260: surface proxy/scope failures instead of displaying empty tools or scope metadata.

As per coding guidelines, “Distinguish not-found conditions from real errors; never convert unexpected errors into not-found responses or silently fall back to defaults after real errors.”

📍 Affects 4 files
  • console/workspaces/libs/api-client/src/hooks/agents.ts#L241-L252 (this comment)
  • console/workspaces/pages/configure-agent/src/Configure.Component.tsx#L156-L160
  • console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx#L92-L96
  • console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx#L130-L145
  • console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx#L314-L324
  • console/workspaces/pages/configure-agent/src/ViewMCPServer.Component.tsx#L178-L180
  • console/workspaces/pages/configure-agent/src/ViewMCPServer.Component.tsx#L238-L260
🤖 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/hooks/agents.ts` around lines 241 -
252, Preserve query error state throughout the affected UI instead of treating
failures as empty data: in
console/workspaces/libs/api-client/src/hooks/agents.ts:241-252, update
useAgentIdentityBinding to return isError and error; in
console/workspaces/pages/configure-agent/src/Configure.Component.tsx:156-160,
retain pipeline/environment loading and error states for the drawer; in
console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx:92-96,
capture Thunder instance errors, at 130-145 render identity-query failures
before absent-binding handling, and at 314-324 show the query error instead of
“No identity provider”; in
console/workspaces/pages/configure-agent/src/ViewMCPServer.Component.tsx:178-180
distinguish environment lookup errors from an empty list, and at 238-260 surface
proxy and scope query failures instead of empty tools or metadata.

Source: Coding guidelines

Comment on lines +137 to +144
const closeManageIdentity = () => {
setSearchParams((prev) => {
const next = new URLSearchParams(prev);
next.delete(MANAGE_IDENTITY_PARAM);
next.delete(IDENTITY_ENV_PARAM);
return next;
});
};

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the relevant file around the reported lines and nearby open/close logic.
file='console/workspaces/pages/configure-agent/src/Configure.Component.tsx'
wc -l "$file"
sed -n '1,260p' "$file"

Repository: wso2/agent-manager

Length of output: 9271


Replace the close action with replace: true.

Both opening and closing the drawer currently add history entries, so Back reopens the drawer after it’s closed.

🤖 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/configure-agent/src/Configure.Component.tsx` around
lines 137 - 144, Update closeManageIdentity to call setSearchParams with the
replace option enabled when removing MANAGE_IDENTITY_PARAM and
IDENTITY_ENV_PARAM, so closing the drawer replaces the current history entry
instead of adding one. Preserve the existing parameter-removal behavior.

Comment on lines +255 to +277
{!revealed && binding.hasUnclaimedSecret && (
<Button
variant="text"
size="small"
onClick={() => void handleClaim()}
disabled={isClaiming}
startIcon={isClaiming ? <CircularProgress size={16} /> : <Eye size={16} />}
>
{isClaiming ? "Claiming..." : "Reveal Secret"}
</Button>
)}
{provisioned && (
<Button
variant="text"
size="small"
onClick={() => void handleRegenerate()}
disabled={isRegenerating}
startIcon={
isRegenerating ? <CircularProgress size={16} /> : <RotateCcwKey size={16} />
}
>
{isRegenerating ? "Regenerating..." : "Regenerate Secret"}
</Button>

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Restrict secret reveal to external agents and serialize credential mutations.

hasUnclaimedSecret alone exposes Reveal for internal agents, contrary to Lines 75-78. Also, each button only disables itself, allowing claim and regeneration to race and potentially display a revoked secret.

Proposed fix
+  const isSecretMutationPending = isClaiming || isRegenerating;

-            {!revealed && binding.hasUnclaimedSecret && (
+            {isExternal && !revealed && binding.hasUnclaimedSecret && (
               <Button
-                disabled={isClaiming}
+                disabled={isSecretMutationPending}
                 ...
               >
...
             {provisioned && (
               <Button
-                disabled={isRegenerating}
+                disabled={isSecretMutationPending}

As per coding guidelines, “serialize expensive per-key side effects rather than serializing globally.”

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

Suggested change
{!revealed && binding.hasUnclaimedSecret && (
<Button
variant="text"
size="small"
onClick={() => void handleClaim()}
disabled={isClaiming}
startIcon={isClaiming ? <CircularProgress size={16} /> : <Eye size={16} />}
>
{isClaiming ? "Claiming..." : "Reveal Secret"}
</Button>
)}
{provisioned && (
<Button
variant="text"
size="small"
onClick={() => void handleRegenerate()}
disabled={isRegenerating}
startIcon={
isRegenerating ? <CircularProgress size={16} /> : <RotateCcwKey size={16} />
}
>
{isRegenerating ? "Regenerating..." : "Regenerate Secret"}
</Button>
const isSecretMutationPending = isClaiming || isRegenerating;
{isExternal && !revealed && binding.hasUnclaimedSecret && (
<Button
variant="text"
size="small"
onClick={() => void handleClaim()}
disabled={isSecretMutationPending}
startIcon={isClaiming ? <CircularProgress size={16} /> : <Eye size={16} />}
>
{isClaiming ? "Claiming..." : "Reveal Secret"}
</Button>
)}
{provisioned && (
<Button
variant="text"
size="small"
onClick={() => void handleRegenerate()}
disabled={isSecretMutationPending}
startIcon={
isRegenerating ? <CircularProgress size={16} /> : <RotateCcwKey size={16} />
}
>
{isRegenerating ? "Regenerating..." : "Regenerate Secret"}
</Button>
🤖 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/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx`
around lines 255 - 277, Update the Reveal Secret condition around handleClaim so
it also requires the binding to represent an external agent, reusing the
existing external-agent indicator from the component. Serialize handleClaim and
handleRegenerate per credential key by disabling both buttons whenever either
isClaiming or isRegenerating, while preserving their existing loading labels and
actions.

Source: Coding guidelines

Comment on lines +424 to +430
{envName && (
<AgentIdentitySection
orgId={orgId}
projectId={projectId}
agentId={agentId}
envId={envName}
/>

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the relevant file and the child component usage
ast-grep outline console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx --view expanded || true
printf '\n---\n'
rg -n "AgentIdentitySection|revealed|envName|open" console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx console/workspaces/pages/configure-agent/src/Configure -S

Repository: wso2/agent-manager

Length of output: 12496


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the child component and its props/state.
child=$(git ls-files 'console/workspaces/pages/configure-agent/src/**/AgentIdentitySection.tsx' 'console/workspaces/pages/configure-agent/src/**/AgentIdentitySection.ts' | head -n 1)
printf 'Child file: %s\n' "${child:-<not found>}"
if [ -n "${child:-}" ]; then
  ast-grep outline "$child" --view expanded || true
  printf '\n---\n'
  wc -l "$child"
  printf '\n---\n'
  cat -n "$child" | sed -n '1,260p'
fi

Repository: wso2/agent-manager

Length of output: 180


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file='console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx'

printf '--- AgentIdentitySection (lines 80-190) ---\n'
sed -n '80,190p' "$file" | cat -n

printf '\n--- ManageIdentityDrawer render (lines 398-435) ---\n'
sed -n '398,435p' "$file" | cat -n

Repository: wso2/agent-manager

Length of output: 247


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file='console/workspaces/pages/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx'

echo '--- AgentIdentitySection (lines 80-190) ---'
sed -n '80,190p' "$file" | cat -n

echo
echo '--- ManageIdentityDrawer render (lines 398-435) ---'
sed -n '398,435p' "$file" | cat -n

Repository: wso2/agent-manager

Length of output: 6344


Remount AgentIdentitySection on envName changes. Its local revealed state survives prop updates, so switching environments can show the previous environment’s client ID/secret under the new selection.

🤖 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/configure-agent/src/Configure/subComponents/ManageIdentityDrawer.tsx`
around lines 424 - 430, Update the AgentIdentitySection usage in
ManageIdentityDrawer so it remounts whenever envName changes by providing a key
derived from envName. Preserve the existing props and rendering condition while
ensuring revealed local state is reset for each environment.

Comment on lines +309 to +318
const [selectedToolGroupKey, setSelectedToolGroupKey] = useState("");
useDefaultSelection(
toolGroups.map((group) => group.key),
selectedToolGroupKey,
setSelectedToolGroupKey,
);

const selectedToolGroup = toolGroups.find(
(group) => group.key === selectedToolGroupKey,
);

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE='console/workspaces/pages/configure-agent/src/ViewMCPServer.Component.tsx'
echo '--- file lines 250-380 ---'
sed -n '250,380p' "$FILE"

echo
echo '--- search useDefaultSelection ---'
rg -n "useDefaultSelection" -S console/workspaces/pages/configure-agent/src

echo
echo '--- search empty state text in file ---'
rg -n "No tools available|tools available|No .*available|empty state" -S "$FILE"

Repository: wso2/agent-manager

Length of output: 5161


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE='console/workspaces/pages/configure-agent/src/ViewMCPServer.Component.tsx'
nl -ba "$FILE" | sed -n '290,360p'

echo
echo '--- useDefaultSelection definition ---'
rg -n "function useDefaultSelection|const useDefaultSelection|export .*useDefaultSelection" -S console/workspaces/pages/configure-agent/src

echo
echo '--- likely hook file candidates ---'
fd -a "useDefaultSelection*" console/workspaces/pages/configure-agent/src

Repository: wso2/agent-manager

Length of output: 196


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE='console/workspaces/pages/configure-agent/src/ViewMCPServer.Component.tsx'

echo '--- useDefaultSelection definition (100-145) ---'
sed -n '100,145p' "$FILE"

echo
echo '--- render around empty-state (630-690) ---'
sed -n '630,690p' "$FILE"

Repository: wso2/agent-manager

Length of output: 4434


Avoid the empty-state flash on first render
Lines 309-318 and 661-670: derive the active tool group from toolGroups[0] until the default-selection effect runs, otherwise the Tools section briefly shows No tools available even when data is already present. Keep the Select value on the same fallback so the UI stays in sync.

🤖 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/configure-agent/src/ViewMCPServer.Component.tsx`
around lines 309 - 318, Update the tool-group selection logic around
selectedToolGroupKey and the Tools section to fall back to toolGroups[0] when
the selection is initially empty, preventing the empty-state flash. Use the same
first-group fallback for the Select value so the displayed selection and active
group remain synchronized, while preserving the effect-driven selection after it
runs.

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