Skip to content

feat(ui): add agent deletion controls - #430

Closed
jayesh9747 wants to merge 3 commits into
truefoundry:mainfrom
jayesh9747:feat/agent-library-delete
Closed

feat(ui): add agent deletion controls#430
jayesh9747 wants to merge 3 commits into
truefoundry:mainfrom
jayesh9747:feat/agent-library-delete

Conversation

@jayesh9747

@jayesh9747 jayesh9747 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #429

Changes

  • Add a delete action and confirmation dialog to each Agents Library row when the server exposes deleteAgent.
  • Preserve existing chats while clearing stale active-agent and history-filter state after deletion.
  • Wire the bundled TrueForge adapter to the existing agents list and DELETE /api/v1/agents/{agent_id} SDK routes.
  • Keep custom servers capability-safe by omitting deleteAgent when no callback is provided.
  • Add the required UI package changeset and update the server-contract documentation.

How was this tested?

  • pnpm test:trueforge-ui — 130 test files / 847 tests passed, including package build and export smoke tests.
  • pnpm --filter @truefoundry/trueforge-ui typecheck
  • pnpm --filter @truefoundry/trueforge-ui lint
  • pnpm format:check

Checklist

  • Tests added for success, cancellation, failure, unsupported hosts, adapter routing, and idempotency.
  • No hand-edits to generated OpenAPI or SDK code.
  • Documentation and changeset updated.

Note

Medium Risk
Deletes are destructive and touch shell navigation state; risk is mitigated by confirmation, capability gating, and adapter idempotency, but hosts must implement deleteAgent correctly.

Overview
Adds agent deletion to the Agents Library when the host server exposes deleteAgent, shipped as a minor @truefoundry/trueforge-ui release.

Library rows now use an actions menu (Edit when composer + spec allow, Delete when typeof server.deleteAgent === 'function') with a confirmation modal, toasts or inline errors, list refresh via invalidateAgentsList, and shell cleanup (history filter, active agent → draft or library home). Row open/click behavior ignores action buttons.

Server wiring: createTrueFoundryServer only attaches deleteAgent when a callback is passed (no runtime throw). The bundled harness builder adapter implements delete by resolving the agent id from the list and calling DELETE /api/v1/agents/{id} (idempotent if missing). Docs now state that omitting deleteAgent hides delete UI instead of failing at call time.

Reviewed by Cursor Bugbot for commit de00e93. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de00e93

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@truefoundry/trueforge-ui Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread packages/trueforge-ui/src/atoms/AgentsLibrary.tsx Outdated
@chiragjn chiragjn added the ui label Aug 26, 2026

@kumarsks619 kumarsks619 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.

@jayesh9747 please add relevant screenshots/screen-recording

@jayesh9747

Copy link
Copy Markdown
Contributor Author

@kumarsks619 sure.

@jayesh9747

Copy link
Copy Markdown
Contributor Author

here it is :
image

@jayesh9747

Copy link
Copy Markdown
Contributor Author

@chiragjn please R&M whenever u get time

@govindavashishtha

govindavashishtha commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

@jayesh9747 Thanks for raising the PR, can we make the design like this

Vertical Ellipsis with menu drop containing 2 things edit and delete actions, Ignore the Manage Schedules and Clone and don't add

Screenshot 2026-09-01 at 11 09 52 AM

@jayesh9747

Copy link
Copy Markdown
Contributor Author

@govindavashishtha sure , i will update my pr , is there any channel where we discuss the issue or connect with the repository maintainers ? for example slack ?

@jayesh9747
jayesh9747 force-pushed the feat/agent-library-delete branch from 44c4a65 to de00e93 Compare September 2, 2026 05:49
@jayesh9747

Copy link
Copy Markdown
Contributor Author

Addressed the latest feedback and rebased this PR onto the current upstream main.

  • Replaced the separate row actions with a vertical-ellipsis menu containing only Edit and Delete (no Manage Schedules or Clone).
  • Kept the delete confirmation, success/error feedback, list refresh, and active-agent cleanup behavior.
  • Updated the rebased tests for the current full-page Agents Library flow.
  • Verified with UI typecheck, lint, formatting, all 146 UI test files / 969 tests, package build, and export smoke tests.

Agent actions menu

Agents Library row with vertical ellipsis menu containing Edit and Delete

Delete confirmation

Delete agent confirmation dialog

@govindavashishtha @kumarsks619 @chiragjn — please review when you get a chance. Thanks!

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit de00e93. Configure here.

window.addEventListener('keydown', onKeyDown, true);
return () => window.removeEventListener('keydown', onKeyDown, true);
}, [closeLibrary, open]);
}, [agentPendingDelete, closeLibrary, open]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Escape closes library over actions menu

Medium Severity

The library's capture-phase Escape handler still runs while the new actions menu is open. Escape therefore dismisses the whole Agents Library instead of just closing the menu. The confirmation dialog already opts out of that handler, but the dropdown does not.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit de00e93. Configure here.

} else {
shell.openLibraryHome();
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Active-agent delete dismisses the library

Medium Severity

After a successful delete, clearing the current agent via openDraft or openLibraryHome also sets libraryOpen to false. Deleting the bound agent therefore closes the Agents Library the user is standing in, instead of only unbinding that agent and refreshing the list.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit de00e93. Configure here.

Delete
</DropdownMenuItem>
) : null}
</DropdownMenu>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actions menu clipped by list overflow

Medium Severity

The new actions DropdownMenu is positioned absolutely inside the library list, which uses overflow-y-auto. For rows near the bottom of the visible list the Edit/Delete menu is clipped, so those actions can be unreachable.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit de00e93. Configure here.

@govindavashishtha

Copy link
Copy Markdown
Contributor

@jayesh9747 Please resolve comments and conflicts here

@govindavashishtha

Copy link
Copy Markdown
Contributor

Closing this in favour of #590

@jayesh9747

Copy link
Copy Markdown
Contributor Author

ok @govindavashishtha

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.

Add delete controls for saved agents in the Agents Library

4 participants