Skip to content

Conversation

@yashmehrotra
Copy link
Member

@yashmehrotra yashmehrotra commented Jan 23, 2026

Fixes: #2831

Summary by CodeRabbit

  • New Features
    • Group canary checks by agent for improved organization and visibility.
    • Added an agent multi-select field to the canary spec editor to configure multiple agents.
    • Added an "Agent" option in canary filters with a dedicated icon and label.
    • Tabs and filtering now support a special "local" tab for checks without an assigned agent.

✏️ Tip: You can customize this high-level summary in your review settings.

@yashmehrotra yashmehrotra requested a review from moshloop January 23, 2026 07:02
@vercel
Copy link

vercel bot commented Jan 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
aws-preview Ready Ready Preview Jan 26, 2026 7:56am
flanksource-ui Ready Ready Preview Jan 26, 2026 7:56am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

Walkthrough

Adds agent-based grouping, tabbing, and selection for canaries: a new "agent" group option and grouping logic, a FormikAgentSelector component that fetches agent names and updates form state, integration into the canary spec form, and tab filtering that supports a "local" tab for checks without an agent.

Changes

Cohort / File(s) Summary
Agent Grouping UI & Options
src/components/Canary/CanaryFilters/TopBar/ChecksGroupByDropdown.tsx
Added a new "agent" group option to the group-by dropdown, including icon import (HiOutlineServerStack) and metadata for the option.
Agent Grouping Logic
src/components/Canary/grouping.ts
Added a new branch to group checks by agent name (uses check.agents?.name or "local") before existing name-based grouping.
Agent Selector Component
src/components/Forms/Formik/FormikAgentSelector.tsx
New Formik-connected multi-select component that fetches all agent names (useAllAgentNamesQuery), maps options/values, handles loading, change, and blur.
Form Integration
src/components/Forms/SpecEditorForm.tsx
Conditionally renders FormikAgentSelector for canaries (resourceInfo.table === "canaries"), bound to spec.agentSelector with label "Agents".
Tab Filtering by Agent
src/components/Canary/CanaryTabs.tsx
When tabBy is agent_id, builds tabs keyed by agent name and optionally includes a "local" tab for checks lacking an agent; merges these with default tabs.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant User as User
participant FormikSelector as FormikAgentSelector
participant API as AgentNamesAPI
participant FormState as Formik Form State
participant Filters as Filter State
participant Grouping as grouping.ts
participant Tabs as CanaryTabs
participant Checks as ChecksList

User->>FormikSelector: Open selector / choose agents
FormikSelector->>API: fetch agent names (on mount)
API-->>FormikSelector: return names
FormikSelector->>FormState: update spec.agentSelector (on change)
FormState->>Filters: update active filters (agent_id)
Filters->>Grouping: request grouped checks by "agent"
Grouping->>Checks: produce groups (agent name or "local")
Grouping-->>Tabs: return tabs data
Tabs->>Checks: render filtered/selected checks

Suggested reviewers

  • moshloop
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding agent selector support in health check creation, matching the primary objective.
Linked Issues check ✅ Passed All code changes implement the objectives from issue #2831: agent selector UI in form [FormikAgentSelector.tsx], grouping by agent [grouping.ts], and tabbing by agent [CanaryTabs.tsx].
Out of Scope Changes check ✅ Passed All changes are directly related to agent selector support for canaries; no unrelated modifications detected beyond the scope of issue #2831.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch agent-selector

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.

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.

Add Canary - Option to select agent

2 participants