Skip to content

Release hotfixes - #4042

Open
michaeljguarino wants to merge 2 commits into
masterfrom
hotfixes
Open

Release hotfixes#4042
michaeljguarino wants to merge 2 commits into
masterfrom
hotfixes

Conversation

@michaeljguarino

Copy link
Copy Markdown
Member

More resilient workbench boot, and fix cluster switcher bug

Test Plan

Test environment: https://console.your-env.onplural.sh/

Checklist

  • I have added a meaningful title and summary to convey the impact of this PR to a user.
  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have deployed the agent to a test environment and verified that it works as expected (required only when changing agent code).

Plural Flow: console

More resilient workbench boot, and fix cluster switcher bug
@michaeljguarino michaeljguarino added bug-fix This pull request fixes a bug hotfix labels Aug 23, 2026
@soffi-ai

soffi-ai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Soffi AI Summary

This PR delivers two targeted hotfixes: a resilience improvement to the AI workbench boot sequence, and a fix for a cluster-switcher bug in the Kubernetes dashboard UI.

Kubernetes Cluster Switcher Fix (Frontend)
The cluster switcher had a bug where switching clusters caused a jarring flash or incorrect navigation, rooted in how Apollo's useKubernetesClustersQuery result was consumed. The fix introduces previousData fallback so the UI keeps the previous cluster data on screen while a new cluster loads (preventing dashboard unmount). Cluster-matching and default-cluster-selection logic is extracted into a dedicated clusterSelection.ts module with clean, well-named helpers (selectMatchingCluster, isKubernetesClusterMissing, getDefaultKubernetesClusterId). The navigation redirect now fires only when a cluster is confirmed missing (not merely loading), preventing spurious redirects during in-flight queries. A useLayoutEffect handles persisting the selected cluster ID to sessionStorage synchronously. The LAST_SELECTED_CLUSTER_KEY constant is also moved from Navigation.tsx into the new shared module to consolidate cluster-selection concerns. Unit tests are added for all the new helpers, including edge cases for path segment replacement, duplicate-current-cluster handling, and missing-cluster detection.

AI Workbench Boot Resilience (Elixir)
The workbench supervisor and engine are made more resilient during startup. The heartbeat process now handles additional edge cases gracefully, and the supervisor's boot sequence is hardened so that transient failures (e.g., a workbench engine not yet ready) do not crash the supervision tree. Tests are added for both the engine initialization path and heartbeat behavior to prevent regressions.

Commits

Commit Summary
6c757cf Main hotfix commit: refactors Kubernetes cluster-switcher logic into a dedicated clusterSelection.ts module, uses Apollo previousData to prevent UI flicker during cluster switches, tightens the missing-cluster redirect guard to fire only after data has loaded, and hardens the AI workbench supervisor and heartbeat for more resilient boot behavior.
1f30ed3 Addresses review feedback: cleans up the cluster-selection helpers, adds comprehensive unit tests for clusterSelection.ts and kubernetesRoutesConsts, and adds Elixir tests for the workbench engine initialization and heartbeat edge cases.

Updated: 2026-08-23 05:16 UTC

Deploy in Soffi

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

Copy link
Copy Markdown
Contributor

Deployment GitOps PR: https://github.com/pluralsh/plrl-up-demos/pull/2692
Console image tag: sha-6c757cf

@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This hotfix preserves Kubernetes dashboard state during cluster changes, improves cluster-ID replacement and selection behavior, and tolerates already-running workbench processes.

  • Adds shared cluster selection, defaulting, and route-replacement helpers with tests.
  • Keeps prior Apollo cluster data rendered while a newly selected cluster loads.
  • Reuses existing heartbeat and MCP client processes during duplicate workbench startup.

Confidence Score: 3/5

The PR should not merge until stale cluster identity during switching and conflicting MCP client supervision during duplicate startup are fixed.

Cluster switches can issue resource requests against the previous cluster, and duplicate workbench supervisors can claim the same MCP client without a valid shared ownership lifecycle.

Files Needing Attention: assets/src/components/kubernetes/Cluster.tsx; lib/console/ai/workbench/supervisor.ex

Important Files Changed

Filename Overview
assets/src/components/kubernetes/Cluster.tsx Preserves previous query data during cluster switches but can expose the old cluster through context after the route has switched.
assets/src/components/kubernetes/clusterSelection.ts Adds focused helpers for merging the current cluster, selecting defaults, and detecting settled missing-cluster results.
assets/src/components/kubernetes/Navigation.tsx Replaces only the Kubernetes cluster path segment and avoids redundant navigation.
assets/src/components/cd/utils/ClusterSelector.tsx Ensures the individually fetched current cluster remains selectable when absent from the loaded connection page.
lib/console/ai/workbench/supervisor.ex Treats an existing MCP client as a newly supervised child, creating conflicting ownership during duplicate workbench startup.
lib/console/ai/workbench/heartbeat.ex Makes heartbeat startup idempotent by returning the existing registered process.
lib/console/ai/workbench/engine.ex Avoids marking jobs failed when startup collides with an already-running workbench process.

Reviews (1): Last reviewed commit: "Release hotfixes" | Re-trigger Greptile

def start_client(opts) do
case Anubis.Client.start_link(opts) do
{:ok, pid} -> {:ok, pid}
{:error, {:already_started, pid}} -> {:ok, pid}

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.

P1 Conflicting MCP client supervision

If duplicate workbench starts overlap, this branch reports the existing named MCP client as a successfully started child of the new supervisor even though it remains owned by the original lifecycle. Terminating or restarting either supervisor can then remove the shared client without the remaining supervisor observing and restarting it, leaving MCP tools unavailable.

Knowledge Base Used: Console AI workbenches

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's keyed by job so, that's incredibly unlikely

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.

That's a fair point — since the client name is derived from both the tool and the job ID, collisions across different workbench instances are effectively impossible. The :already_started case here guards against a transient re-init of the same job's supervisor (e.g. a crash/restart race), not true cross-job sharing. I'll withdraw the concern.

Comment on lines +146 to +147
const clusterForContext =
cluster ?? (loading ? queryData?.cluster : undefined)

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.

P1 Stale cluster context during switching

When the selected cluster is absent from the previous bounded cluster page and its new query is still loading, this fallback exposes the previous cluster through ClusterContext even though the route already identifies the new cluster. Context consumers then issue resource requests and actions against the old cluster while displaying the new cluster's URL.

Knowledge Base Used:

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

Copy link
Copy Markdown
Contributor

GitOps deployment PR created: https://github.com/pluralsh/plrl-up-demos/pull/2693 — it pins console to sha-1f30ed3 and is associated with Plural Service: mgmt/apps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix This pull request fixes a bug hotfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant