Skip to content

feat(studio): bulk delete agents from the table#320

Merged
marcusds merged 1 commit into
mainfrom
astd-246-bulk-delete-agents/mschwab
Jun 12, 2026
Merged

feat(studio): bulk delete agents from the table#320
marcusds merged 1 commit into
mainfrom
astd-246-bulk-delete-agents/mschwab

Conversation

@marcusds

@marcusds marcusds commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds bulk delete of agents from the agents table.

  • Row-selection checkboxes (+ select-all) on the agents table.
  • A selection bar appears when rows are selected: "N rows selected" + a tertiary Delete button + a Cancel (matching the shared BulkActions UX).
  • Delete opens the existing DeleteConfirmationModal ("Delete N Agents"), then tears down each selected agent the same way single-delete does — delete the agent's deployments first, then the agent — running all selected agents via Promise.allSettled. One summary toast ("N agents deleted." or "Failed to delete X of N agents."), selection cleared, list refetched once. Single-row delete uses the same unified path.

Why a custom selection bar (not the DataView toolbar slot)

The DataView's built-in renderBulkActions only renders inside StudioDataViewToolbar, which returns null unless the table has a search field or a filterable column. AgentsListAgentsParams supports neither (no filter/search on the agents list API), so that toolbar can't appear for agents. The selection bar is therefore rendered directly in AgentsDataView (the checkboxes are columns, so they're unaffected), styled to match the canonical BulkActions component.

Testing

  • AgentsDataView spec: existing 17 + new bulk-delete test (select all → Delete → both agents' deployments + agents deleted, summary toast) → 18 pass.
  • Typecheck / eslint clean.

Resolves ASTD-246.

Summary by CodeRabbit

  • New Features
    • Agents table: multi-row selection with checkbox toolbar showing count, Delete and Cancel actions.
    • Bulk delete: deletes agents and their associated deployments in parallel, refreshes views, and shows aggregated success/error toasts with correct pluralized messaging.
  • Tests
    • Added tests for bulk-delete happy path and partial-failure scenarios verifying selection, confirmation, deletion outcomes, and success/error toasts.

@marcusds marcusds requested review from a team as code owners June 12, 2026 21:27
@github-actions github-actions Bot added the feat label Jun 12, 2026
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d576e837-5a23-44fb-9989-6a8cd6074db8

📥 Commits

Reviewing files that changed from the base of the PR and between bcdfe53 and 8458707.

📒 Files selected for processing (2)
  • web/packages/studio/src/components/dataViews/AgentsDataView/index.spec.tsx
  • web/packages/studio/src/components/dataViews/AgentsDataView/index.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/packages/studio/src/components/dataViews/AgentsDataView/index.tsx

📝 Walkthrough

Walkthrough

AgentsDataView adds multi-row selection and a bulk-action toolbar. Deletion now removes each agent’s deployments (parallel, ignoring 404s) then deletes agents, aggregates outcomes with Promise.allSettled, refreshes queries, conditionally clears selection, and shows pluralized modal/toast. Tests cover success and partial-failure bulk flows.

Changes

Bulk Agent Deletion

Layer / File(s) Summary
Layout and UI imports
web/packages/studio/src/components/dataViews/AgentsDataView/index.tsx
Adds ROW_SELECTION_COLUMN_SIZE and new toolbar/icon imports required for bulk selection UI.
State and DeleteState types
web/packages/studio/src/components/dataViews/AgentsDataView/index.tsx
DeleteState becomes a union (single vs bulk); selectedAgents derived from dataViewState.rowSelection; deletion mutations and refresh helper added.
Unified deletion logic for single and bulk agents
web/packages/studio/src/components/dataViews/AgentsDataView/index.tsx
deleteAgentWithDeployments deletes deployments in parallel (ignoring 404s) then deletes the agent; handleDelete aggregates per-agent results with Promise.allSettled, refreshes agents/deployments queries, clears selection when appropriate, and emits aggregated success/error toasts.
Bulk-action toolbar and modal text
web/packages/studio/src/components/dataViews/AgentsDataView/index.tsx
Conditional toolbar shows selected count with Delete and Cancel; Delete sets bulk deleteState; modal copy pluralizes and reflects bulk deletion.
Bulk deletion end-to-end tests
web/packages/studio/src/components/dataViews/AgentsDataView/index.spec.tsx
Tests stub two agents and deployments, select both via checkboxes, confirm bulk-delete; covers full success (both deleted, "2 agents deleted.") and partial failure (one delete returns 500, error toast "Failed to delete 1 of 2 agents.").

Possibly related PRs

Suggested reviewers

  • nakolean
  • steramae-nvidia
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: adding bulk delete functionality for agents in the table UI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch astd-246-bulk-delete-agents/mschwab

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
web/packages/studio/src/components/dataViews/AgentsDataView/index.spec.tsx (1)

621-622: 📐 Maintainability & Code Quality | 💤 Low value

Consider adding partial failure test coverage.

The bulk delete logic handles partial failures ("Failed to delete X of Y agents."), but this path isn't tested. Adding a test where one agent delete succeeds and another fails would validate the aggregation logic and error toast.

🤖 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 `@web/packages/studio/src/components/dataViews/AgentsDataView/index.spec.tsx`
around lines 621 - 622, Add a unit test in AgentsDataView's index.spec.tsx that
simulates a partial failure for the bulk delete path: mock the API used by the
component (the same mock used elsewhere in the file) so one agent delete
resolves and the other rejects, render the AgentsDataView, select both agents,
trigger the bulk delete action (the same UI interaction used in existing
bulk-delete tests), then assert that the error toast contains the
partial-failure message (e.g., "Failed to delete 1 of 2 agents.") and that the
success/refresh flow for the succeeded delete still ran; reference the
AgentsDataView component and the bulk delete handler (e.g.,
bulkDeleteAgents/handleBulkDelete) to locate the code to mock and the toast
assertion to add.
🤖 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 `@web/packages/studio/src/components/dataViews/AgentsDataView/index.tsx`:
- Around line 314-316: Remove the unsupported variant prop from the lucide-react
X icon usage in AgentsDataView: locate the JSX element <X variant="line" /> in
the component (index.tsx) and delete the variant="line" attribute; if you
intended a thinner stroke, replace it with a supported prop such as
strokeWidth={1} or absoluteStrokeWidth as needed.

---

Nitpick comments:
In `@web/packages/studio/src/components/dataViews/AgentsDataView/index.spec.tsx`:
- Around line 621-622: Add a unit test in AgentsDataView's index.spec.tsx that
simulates a partial failure for the bulk delete path: mock the API used by the
component (the same mock used elsewhere in the file) so one agent delete
resolves and the other rejects, render the AgentsDataView, select both agents,
trigger the bulk delete action (the same UI interaction used in existing
bulk-delete tests), then assert that the error toast contains the
partial-failure message (e.g., "Failed to delete 1 of 2 agents.") and that the
success/refresh flow for the succeeded delete still ran; reference the
AgentsDataView component and the bulk delete handler (e.g.,
bulkDeleteAgents/handleBulkDelete) to locate the code to mock and the toast
assertion to add.
🪄 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: Enterprise

Run ID: 51177801-a746-4fc5-9cca-58054965b2c8

📥 Commits

Reviewing files that changed from the base of the PR and between 0aa9bdb and 4ccce8a.

📒 Files selected for processing (2)
  • web/packages/studio/src/components/dataViews/AgentsDataView/index.spec.tsx
  • web/packages/studio/src/components/dataViews/AgentsDataView/index.tsx

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 19033/25227 75.4% 61.4%
Integration Tests 11028/23999 46.0% 20.4%

@marcusds marcusds force-pushed the astd-246-bulk-delete-agents/mschwab branch from 5a83c75 to bcdfe53 Compare June 12, 2026 21:51
Add row selection (checkboxes + select-all) to the agents table and a selection
action bar (N selected / Delete / Clear) shown when rows are selected. Delete
opens the existing confirmation modal and tears down each selected agent
(deployments first, then the agent) via Promise.allSettled, with a single
summary toast.

The DataView's built-in bulk-action toolbar only renders when a search field or
filterable column exists, and the agents list API supports neither, so the
selection bar is rendered directly in AgentsDataView.

ASTD-246

Signed-off-by: mschwab <mschwab@nvidia.com>
@marcusds marcusds force-pushed the astd-246-bulk-delete-agents/mschwab branch from bcdfe53 to 8458707 Compare June 12, 2026 21:57
@marcusds

Copy link
Copy Markdown
Contributor Author

@coderabbitai Claude says: "Added a partial-failure test in 8458707 — one of two selected agents fails to delete; it asserts the Failed to delete 1 of 2 agents. toast and that the succeeded agent is still deleted."

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
gh api repos/NVIDIA-NeMo/nemo-platform/commits/8458707d6e --jq '.commit.message' 2>&1 || echo "Commit not found or inaccessible"
gh api "repos/NVIDIA-NeMo/nemo-platform/pulls/320/commits" --jq '.[].sha' 2>&1 | head -20

Length of output: 950


🏁 Script executed:

#!/bin/bash
gh api "repos/NVIDIA-NeMo/nemo-platform/pulls/320/commits" --jq '.[] | {sha: .sha, message: .commit.message}' 2>&1

Length of output: 892


🏁 Script executed:

#!/bin/bash
gh api "repos/NVIDIA-NeMo/nemo-platform/contents/web/packages/studio/src/components/dataViews/AgentsDataView/index.spec.tsx?ref=8458707d6e260ccc391735162a177ccdacdf035d" --jq '.content' | base64 -d | grep -n "partial\|Failed to delete\|fail\|1 of 2\|allSettled\|reject\|error" 2>&1 | head -40

Length of output: 1131



@marcusds Confirmed — the partial-failure test is present at line 623 of the spec. It asserts the "Failed to delete 1 of 2 agents." error toast and that the succeeded agent is still deleted. Looks good.

@marcusds marcusds enabled auto-merge June 12, 2026 22:12
@marcusds marcusds added this pull request to the merge queue Jun 12, 2026
Merged via the queue into main with commit a8a0283 Jun 12, 2026
48 of 49 checks passed
@marcusds marcusds deleted the astd-246-bulk-delete-agents/mschwab branch June 12, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants