feat(FN-2116): add start action for terminated agent cards

- Add a Start button for terminated agents in board cards alongside Delete
- Add a Start action for terminated agents in list cards with icon + label
- Reuse the existing state transition handler to move terminated agents back to active
- Extend AgentListModal tests to cover Start button visibility and start action behavior
This commit is contained in:
Fusion
2026-04-19 02:44:48 -07:00
committed by gsxdsm
parent bbeb7183e4
commit 12f1e7fa32
2 changed files with 80 additions and 14 deletions

View File

@@ -564,6 +564,54 @@ describe("AgentListModal", () => {
});
});
it("shows Start button for terminated agents", async () => {
render(
<AgentListModal
isOpen={true}
onClose={mockOnClose}
addToast={mockAddToast}
/>
);
await waitFor(() => {
expect(screen.getByText("All States")).toBeTruthy();
});
const filterSelect = screen.getByDisplayValue("All States");
fireEvent.change(filterSelect, { target: { value: "terminated" } });
await waitFor(() => {
expect(screen.getByTitle("Start")).toBeTruthy();
});
});
it("starts terminated agent", async () => {
render(
<AgentListModal
isOpen={true}
onClose={mockOnClose}
addToast={mockAddToast}
/>
);
await waitFor(() => {
expect(screen.getByText("All States")).toBeTruthy();
});
const filterSelect = screen.getByDisplayValue("All States");
fireEvent.change(filterSelect, { target: { value: "terminated" } });
await waitFor(() => {
expect(screen.getByTitle("Start")).toBeTruthy();
});
fireEvent.click(screen.getByTitle("Start"));
await waitFor(() => {
expect(mockUpdateAgentState).toHaveBeenCalledWith("agent-004", "active", undefined);
});
});
it("handles state change errors gracefully", async () => {
mockUpdateAgentState.mockRejectedValue(new Error("Invalid transition"));