Skip to content

Improve Agent Overview Page#963

Open
rasika2012 wants to merge 3 commits into
wso2:mainfrom
rasika2012:Agent-Class
Open

Improve Agent Overview Page#963
rasika2012 wants to merge 3 commits into
wso2:mainfrom
rasika2012:Agent-Class

Conversation

@rasika2012
Copy link
Copy Markdown
Contributor

@rasika2012 rasika2012 commented May 26, 2026

Purpose

image image image

Issue: #737

This pull request introduces several improvements and updates across the codebase, focusing on enhanced metrics handling, UI component flexibility, environment configuration, and dependency updates. The most significant changes are grouped below:

Metrics Handling and API Hooks:

  • The useGetAgentMetrics hook now supports time range presets and disables metrics fetching when an environment is suspended, improving query accuracy and efficiency. It also updates its query key and request logic to reflect these changes. [1] [2] [3]
  • The useTraceList hook now accepts an options parameter for more granular control, including an explicit enabled flag. [1] [2]

UI Component Enhancements (Environment Cards):

  • The EnvironmentCard component now accepts a bottomContent prop for extensibility and uses the new palette variable access pattern for consistent theming. It also improves conditional rendering for actions and status displays, especially for deployment states. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

Configuration and Environment:

  • The .env.example file is updated with realistic local development defaults and additional guardrail configuration options, making setup easier for new developers.

UI/UX Improvements:

  • The monitor table's empty state illustration is updated from Activity to Monitor for better clarity. [1] [2] [3]
  • The metrics page now disables metrics fetching and auto-refresh when the environment is suspended, and uses improved iconography for status indication.

Dependency Updates:

  • Adds @wso2/oxygen-ui-charts-react as a dependency and upgrades reselect to version 5.2.0 in the lockfile. [1] [2]

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

    • Observability section on agent overview: metrics, recent traces, and suspended-environment messaging.
    • Evaluation monitors card with visual score donuts.
    • Agent info cards showing repository/build details and a new donut progress icon.
    • New observability/metrics drawer flow with optional token support.
  • Improvements

    • Better time-range controls and auto-refresh gating for metrics and traces (including a 10-minute quick range).
    • Expanded default environment/configuration values including instrumentation and guardrails.
    • UI refinements: updated empty-state icons, status coloring, error banners, and layout/composition updates.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

📝 Walkthrough

Walkthrough

This PR refactors the agent overview pages to add environment observability (metrics and recent traces), evaluation monitors, new agent/build cards, hook enhancements for time-range presets and query gating, shared component extensions for bottom-content panels, and concrete environment/docker defaults.

Changes

Agent Overview Redesign with Observability and Monitoring

Layer / File(s) Summary
Configuration, Dependency & Hooks Foundation
console/env.example, deployments/docker-compose.yml, console/workspaces/pages/overview/package.json, console/workspaces/libs/api-client/src/hooks/metrics.ts, console/workspaces/libs/api-client/src/hooks/traces.ts, console/workspaces/pages/deploy/src/subComponent/DeployCard.tsx
Environment and docker defaults set (auth, gateway, instrumentation, guardrails); added chart dependency; useGetAgentMetrics accepts an optional timeRange preset and uses it for start/end derivation and queryKey; useTraceList gains options to control enabled/auto-refresh gating; DeployCard uses TEN_MINUTES preset.
Shared Component Extensions & Empty-state Icons
console/workspaces/libs/shared-component/src/components/EnvironmentCard/EnvironmentCard.tsx, console/workspaces/pages/eval/src/subComponents/MonitorTable.tsx
EnvironmentCard adds a bottomContent slot, moves icon colors to theme.vars?.palette, reorganizes header/status UI and error state; MonitorTable swaps empty-state illustration to Monitor.
Metrics Page: Suspension Handling
console/workspaces/pages/metrics/src/Metrics.Component.tsx
Metrics page fetches deployments to determine suspension, disables metrics fetching when suspended, refactors metrics request shape to include start/end only for custom ranges, and renders a suspension empty-state.
Observability UI (Charts, Donut, Traces)
console/workspaces/pages/overview/src/AgentOverview/DonutIcon.tsx, console/workspaces/pages/overview/src/AgentOverview/EnvObservabilitySection.tsx
DonutIcon renders themed circular progress; EnvObservabilitySection provides CPU/memory metric cards with small charts, recent-traces table with formatted fields and click-to-trace navigation, and suspension gating.
Evaluation Monitors Card
console/workspaces/pages/overview/src/AgentOverview/EvalMonitorsCard.tsx
EvalMonitorsCard lists monitors and visualizes aggregated evaluator mean scores as colored donuts; MonitorTile loads scores and builds evaluation routes.
Agent Info & Overview Page Refactor
console/workspaces/pages/overview/src/AgentOverview/AgentInfoCard.tsx, console/workspaces/pages/overview/src/AgentOverview/AgentOverview.tsx, console/workspaces/pages/overview/src/AgentOverview/KindInfoCard.tsx, console/workspaces/pages/overview/src/AgentOverview/ExternalAgentOverview.tsx, console/workspaces/pages/overview/src/AgentOverview/InternalAgentOverview.tsx, console/workspaces/pages/overview/src/AgentOverview/InstrumentationDrawer.tsx
AgentInfoCard shows repository and latest-build details; AgentOverview adds AgentDescription and moves edit action; KindInfoCard redesigned; Internal/External overviews now compose the new cards and embed EnvObservabilitySection per environment; InstrumentationDrawer.apiKey made optional.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

Suggested reviewers

  • hanzjk
  • RAVEENSR

Poem

🐰 Hopping through envs with charts aglow,
Donut rings spin where metrics flow,
Monitors hum and traces light the way,
Cards assemble — observability day! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description provides a Purpose section with UI screenshots and issue reference, but leaves all other template sections (Goals, Approach, User stories, Release note, Documentation, Training, Certification, Marketing, Tests, Security, Samples, Related PRs, Migrations, Test environment, Learning) either empty or unfilled. Complete the remaining template sections: add Goals describing solutions, Approach with implementation details, User stories, Release note, Documentation impact, and other required fields (or mark as N/A where applicable) per the template requirements.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 'Improve Agent Overview Page' directly aligns with the main focus of the changeset, which extensively refactors and enhances the Agent Overview page UI with new components, metrics integration, and improved layout.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 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/traces.ts`:
- Line 106: The auto-refresh interval in the useTraces hook calls refetch()
regardless of options.enabled, so polling continues even when the query is
disabled; update the logic around the interval (the code that sets/clears the
30s timer and the function that calls refetch()) to check options?.enabled
(and/or the returned query enabled flag) before invoking refetch, and avoid
starting the interval when options.enableAutoRefresh is true but options.enabled
is false (or clear the interval when options.enabled flips to false). Reference
the useTraces hook, the refetch() call inside the auto-refresh/interval handler,
and the options?.enabled / enableAutoRefresh flags to locate where to add the
guard and where to clear the timer.

In
`@console/workspaces/libs/shared-component/src/components/EnvironmentCard/EnvironmentCard.tsx`:
- Around line 290-293: The body rendering in EnvironmentCard currently only
treats DeploymentStatus.ERROR as a failed case while the header now includes
DeploymentStatus.FAILED; update the body condition(s) that check
currentDiployment?.status (in EnvironmentCard) so they also treat
DeploymentStatus.FAILED the same as DeploymentStatus.ERROR (e.g., change any
`status === DeploymentStatus.ERROR` checks to `status === DeploymentStatus.ERROR
|| status === DeploymentStatus.FAILED` or a shared helper) so EnvStatus and the
empty-state "Deployment Failed" message render for both statuses.

In `@console/workspaces/pages/metrics/src/Metrics.Component.tsx`:
- Around line 65-68: The current isSuspended calculation assumes unresolved
deployments are not suspended, allowing metrics to enable prematurely; change
the logic in useListAgentDeployments handling so unresolved deployment state is
treated as indeterminate and only allow metrics when we know deployment exists
and is explicitly not suspended. Specifically, update the isSuspended
computation (referencing useListAgentDeployments, deployments, envId,
isSuspended) to return undefined/null when deployments or deployments[envId] is
missing, and change the metrics gating check to require isSuspended === false
(i.e., only enable metrics when the deployment status is present and explicitly
not "suspended").

In `@console/workspaces/pages/overview/src/AgentOverview/DonutIcon.tsx`:
- Line 36: Clamp and sanitize percent before computing offset in DonutIcon:
ensure percent is a finite number and bounded between 0 and 100 (e.g. compute a
safePercent using Number.isFinite(percent) ? Math.min(Math.max(percent, 0), 100)
: 0) and then calculate offset with circumference * (1 - safePercent / 100) so
negative, NaN or infinite values cannot produce invalid SVG dash offsets; update
any usage of percent in the offset calculation to use safePercent.

In `@console/workspaces/pages/overview/src/AgentOverview/EvalMonitorsCard.tsx`:
- Around line 145-155: The generated monitor URLs (allMonitorsHref and
createMonitorHref) omit the required envId param, causing invalid evaluation
routes; update the generatePath calls used for allMonitorsHref and
createMonitorHref to include envId in the params object (e.g., { orgId,
projectId, agentId, envId }) and ensure envId is sourced in this component
(prop, hook, or derived) before calling generatePath so the evaluation routes
match the contract used in EvalMonitors.Component.

In
`@console/workspaces/pages/overview/src/AgentOverview/ExternalAgentOverview.tsx`:
- Around line 120-133: The ExternalAgentOverview currently passes a hardcoded
apiKey="ey***" into InstrumentationDrawer which causes placeholder secrets to
appear in export commands; remove the hardcoded apiKey prop (or pass
undefined/null) from ExternalAgentOverview so InstrumentationDrawer cannot
default to a fake key, and instead rely on generatedApiKey or delay rendering
the export commands until generatedApiKey is available; update usage around the
apiKey prop and the effectiveApiKey logic in InstrumentationDrawer
(effectiveApiKey = generatedApiKey || apiKey) to ensure no placeholder is
presented to users.
🪄 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: 80472095-f410-4e34-bfa6-d4067d9ca50b

📥 Commits

Reviewing files that changed from the base of the PR and between 2ef083b and d3a761b.

⛔ Files ignored due to path filters (1)
  • console/common/config/rush/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • console/env.example
  • console/workspaces/libs/api-client/src/hooks/metrics.ts
  • console/workspaces/libs/api-client/src/hooks/traces.ts
  • console/workspaces/libs/shared-component/src/components/EnvironmentCard/EnvironmentCard.tsx
  • console/workspaces/pages/eval/src/subComponents/MonitorTable.tsx
  • console/workspaces/pages/metrics/src/Metrics.Component.tsx
  • console/workspaces/pages/overview/package.json
  • console/workspaces/pages/overview/src/AgentOverview/AgentInfoCard.tsx
  • console/workspaces/pages/overview/src/AgentOverview/AgentOverview.tsx
  • console/workspaces/pages/overview/src/AgentOverview/DonutIcon.tsx
  • console/workspaces/pages/overview/src/AgentOverview/EnvObservabilitySection.tsx
  • console/workspaces/pages/overview/src/AgentOverview/EvalMonitorsCard.tsx
  • console/workspaces/pages/overview/src/AgentOverview/ExternalAgentOverview.tsx
  • console/workspaces/pages/overview/src/AgentOverview/InternalAgentOverview.tsx
  • console/workspaces/pages/overview/src/AgentOverview/KindInfoCard.tsx
  • deployments/docker-compose.yml

Comment thread console/workspaces/libs/api-client/src/hooks/traces.ts
Comment thread console/workspaces/pages/metrics/src/Metrics.Component.tsx Outdated
Comment thread console/workspaces/pages/overview/src/AgentOverview/DonutIcon.tsx Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
console/workspaces/libs/api-client/src/hooks/traces.ts (1)

383-383: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Restore backward-compatible auto-refresh default behavior.

At Line 383, omitting options disables polling because !options?.enableAutoRefresh becomes true. Existing call sites that don’t pass options will stop auto-refreshing.

💡 Suggested minimal fix
   useEffect(() => {
-    if (hasCustomRange || !scopeParams || options?.enabled === false || !options?.enableAutoRefresh) return;
+    const isQueryEnabled = options?.enabled ?? true;
+    const isAutoRefreshEnabled = options?.enableAutoRefresh ?? true;
+    if (hasCustomRange || !scopeParams || !isQueryEnabled || !isAutoRefreshEnabled) return;
     const timer = setInterval(() => {
       if (traceListRef.current?.traces?.length) {
         loadNewerRef.current();
       } else {
         refetchRef.current();
       }
     }, 30000);
     return () => clearInterval(timer);
   }, [hasCustomRange, scopeParams, options?.enabled, options?.enableAutoRefresh]);

Also applies to: 392-392

🤖 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/traces.ts` at line 383, The
early-return condition treats a missing options object as disabling polling;
change the checks so only an explicit false disables auto-refresh. In the guard
that currently uses "!options?.enableAutoRefresh" (and the similar check at the
other occurrence), replace the falsy check with an explicit comparison to false
(e.g., options?.enableAutoRefresh === false) so that undefined/missing options
leave auto-refresh enabled; update both occurrences near the checks involving
hasCustomRange, scopeParams, options?.enabled and options?.enableAutoRefresh.
🤖 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/InstrumentationDrawer.tsx`:
- Line 41: effectiveApiKey can become the literal "undefined" when apiKey is
optional and omitted; change code that derives effectiveApiKey to provide a
clear placeholder (e.g. "<YOUR_API_KEY>" or empty string) when apiKey is
undefined so template strings like export AMP_AGENT_API_KEY="${effectiveApiKey}"
do not render "undefined". Update the place where effectiveApiKey is computed
(the variable derived from apiKey) to use a fallback value and ensure both
snippets that interpolate effectiveApiKey use that fallback.

---

Duplicate comments:
In `@console/workspaces/libs/api-client/src/hooks/traces.ts`:
- Line 383: The early-return condition treats a missing options object as
disabling polling; change the checks so only an explicit false disables
auto-refresh. In the guard that currently uses "!options?.enableAutoRefresh"
(and the similar check at the other occurrence), replace the falsy check with an
explicit comparison to false (e.g., options?.enableAutoRefresh === false) so
that undefined/missing options leave auto-refresh enabled; update both
occurrences near the checks involving hasCustomRange, scopeParams,
options?.enabled and options?.enableAutoRefresh.
🪄 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: c35c5955-6c1f-4e85-a077-ce25db292016

📥 Commits

Reviewing files that changed from the base of the PR and between d3a761b and 0faaf84.

📒 Files selected for processing (6)
  • console/workspaces/libs/api-client/src/hooks/traces.ts
  • console/workspaces/libs/shared-component/src/components/EnvironmentCard/EnvironmentCard.tsx
  • console/workspaces/pages/metrics/src/Metrics.Component.tsx
  • console/workspaces/pages/overview/src/AgentOverview/DonutIcon.tsx
  • console/workspaces/pages/overview/src/AgentOverview/ExternalAgentOverview.tsx
  • console/workspaces/pages/overview/src/AgentOverview/InstrumentationDrawer.tsx
💤 Files with no reviewable changes (1)
  • console/workspaces/pages/overview/src/AgentOverview/ExternalAgentOverview.tsx

@rasika2012 rasika2012 force-pushed the Agent-Class branch 2 times, most recently from fcb06c6 to 15521b1 Compare May 26, 2026 06:11
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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/metrics/src/Metrics.Component.tsx (1)

95-97: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Refresh button can still fetch metrics for suspended environments.

Even with query enabled gating, Line 96 calls refetch() manually. In suspended state this allows requests that the page intends to block.

💡 Suggested fix
-  const handleRefresh = useCallback(() => {
-    refetch();
-  }, [refetch]);
+  const handleRefresh = useCallback(() => {
+    if (isSuspended !== false) return;
+    refetch();
+  }, [isSuspended, refetch]);
...
           <IconButton
             size="small"
-            disabled={isRefetching}
+            disabled={isRefetching || isSuspended !== false}
             onClick={handleRefresh}
             aria-label="Refresh"
           >

Also applies to: 126-130

🤖 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/metrics/src/Metrics.Component.tsx` around lines 95 -
97, The manual refetch calls in handleRefresh (calling refetch()) allow metrics
to be fetched for suspended environments; update handleRefresh to check the
suspended state before calling refetch (e.g., if (isSuspended ||
environment.suspended) return) and do the same guard for the other refresh
handler around lines 126-130 so both handlers only call refetch when the
environment is not suspended.
🤖 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/traces.ts`:
- Around line 383-384: The auto-refresh guard currently treats a missing
enableAutoRefresh as false; update the conditional in the hook (look for the
check containing hasCustomRange, scopeParams and options?.enableAutoRefresh in
traces.ts) to only disable polling when options?.enabled === false OR
options?.enableAutoRefresh === false (i.e. do not negate
options?.enableAutoRefresh with !); make the same change at the other occurrence
around the second guard (the check at ~393) so that an omitted enableAutoRefresh
defaults to enabled and polling behavior is preserved.

---

Outside diff comments:
In `@console/workspaces/pages/metrics/src/Metrics.Component.tsx`:
- Around line 95-97: The manual refetch calls in handleRefresh (calling
refetch()) allow metrics to be fetched for suspended environments; update
handleRefresh to check the suspended state before calling refetch (e.g., if
(isSuspended || environment.suspended) return) and do the same guard for the
other refresh handler around lines 126-130 so both handlers only call refetch
when the environment is not suspended.
🪄 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: 389de06a-6a2f-4927-b5e0-c1f7a67efa4e

📥 Commits

Reviewing files that changed from the base of the PR and between 0faaf84 and 26cf4f2.

📒 Files selected for processing (8)
  • console/workspaces/libs/api-client/src/hooks/traces.ts
  • console/workspaces/libs/shared-component/src/components/EnvironmentCard/EnvironmentCard.tsx
  • console/workspaces/pages/deploy/src/subComponent/DeployCard.tsx
  • console/workspaces/pages/metrics/src/Metrics.Component.tsx
  • console/workspaces/pages/overview/src/AgentOverview/DonutIcon.tsx
  • console/workspaces/pages/overview/src/AgentOverview/EvalMonitorsCard.tsx
  • console/workspaces/pages/overview/src/AgentOverview/ExternalAgentOverview.tsx
  • console/workspaces/pages/overview/src/AgentOverview/InstrumentationDrawer.tsx
💤 Files with no reviewable changes (1)
  • console/workspaces/pages/overview/src/AgentOverview/ExternalAgentOverview.tsx

Comment on lines +383 to +384
if (hasCustomRange || !scopeParams || options?.enabled === false
|| !options?.enableAutoRefresh) return;
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Default auto-refresh behavior regressed to “off”.

Line 384 treats an omitted enableAutoRefresh as disabled (!options?.enableAutoRefresh), so polling never starts unless callers explicitly pass true. This silently changes existing behavior for current hook consumers.

💡 Suggested fix
+  const isAutoRefreshEnabled = options?.enableAutoRefresh ?? true;
   useEffect(() => {
-    if (hasCustomRange || !scopeParams || options?.enabled === false
-      || !options?.enableAutoRefresh) return;
+    if (
+      hasCustomRange ||
+      !scopeParams ||
+      options?.enabled === false ||
+      !isAutoRefreshEnabled
+    ) {
+      return;
+    }
     const timer = setInterval(() => {
       if (traceListRef.current?.traces?.length) {
         loadNewerRef.current();
       } else {
         refetchRef.current();
       }
     }, 30000);
     return () => clearInterval(timer);
-  }, [hasCustomRange, scopeParams, options?.enabled, options?.enableAutoRefresh]);
+  }, [hasCustomRange, scopeParams, options?.enabled, isAutoRefreshEnabled]);

Also applies to: 393-393

🤖 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/traces.ts` around lines 383 -
384, The auto-refresh guard currently treats a missing enableAutoRefresh as
false; update the conditional in the hook (look for the check containing
hasCustomRange, scopeParams and options?.enableAutoRefresh in traces.ts) to only
disable polling when options?.enabled === false OR options?.enableAutoRefresh
=== false (i.e. do not negate options?.enableAutoRefresh with !); make the same
change at the other occurrence around the second guard (the check at ~393) so
that an omitted enableAutoRefresh defaults to enabled and polling behavior is
preserved.

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