fix(FN-2210): classify legacy verification agents as ephemeral
- Extend isEphemeralAgent to treat metadata.internal agents as internal system agents - Add legacy fallback detection for executor agents named verification-agent with no reportsTo - Update AgentsView list and org tree filtering to honor the Show system agents toggle - Add regression coverage in core and dashboard tests for default filtering and includeEphemeral visibility
This commit is contained in:
@@ -266,12 +266,17 @@ export function AgentsView({ addToast, projectId }: AgentsViewProps) {
|
||||
|
||||
// Filter agents for display. "All States" means all non-ephemeral agents,
|
||||
// including disabled/terminated agents that still carry configuration.
|
||||
// When "Show system agents" is enabled, include ephemeral/internal agents.
|
||||
const displayAgents = useMemo(() => {
|
||||
return agents.filter(a => !isEphemeralAgent(a));
|
||||
}, [agents]);
|
||||
return agents.filter((agent) => showSystemAgents || !isEphemeralAgent(agent));
|
||||
}, [agents, showSystemAgents]);
|
||||
|
||||
// Filter org tree to exclude ephemeral agents in default view.
|
||||
const displayOrgTree = useMemo(() => {
|
||||
if (showSystemAgents) {
|
||||
return orgTree;
|
||||
}
|
||||
|
||||
// Recursively filter out ephemeral agents from the org tree.
|
||||
const filterNode = (node: OrgTreeNode): OrgTreeNode | null => {
|
||||
if (isEphemeralAgent(node.agent)) return null;
|
||||
@@ -285,7 +290,7 @@ export function AgentsView({ addToast, projectId }: AgentsViewProps) {
|
||||
return orgTree
|
||||
.map(filterNode)
|
||||
.filter((n): n is OrgTreeNode => n !== null);
|
||||
}, [orgTree]);
|
||||
}, [orgTree, showSystemAgents]);
|
||||
|
||||
const loadAgents = useCallback(async () => {
|
||||
setIsLoading(true);
|
||||
|
||||
@@ -628,6 +628,7 @@ describe("AgentsView", () => {
|
||||
// Now the agents should be reloaded with system agents included
|
||||
await waitFor(() => {
|
||||
expect(mockFetchAgents).toHaveBeenCalledWith({ includeEphemeral: true }, projectId);
|
||||
expect(screen.getByText("executor-FN-TEST")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user