fix(FN-3724): exempt internal coordination tools from action gate

- Expand action-gate exempt tool list to include internal heartbeat, task/agent coordination, messaging, evaluation, identity, and memory bookkeeping calls
- Prioritize exempt-tool classification in gate evaluation to ensure permanent-agent sessions cannot deadlock on internal runtime operations
- Add targeted engine tests covering exempt internal tool behavior and permanent-agent gating interactions
- Document the internal tool exemption policy in docs/agents.md
- Add a patch changeset for @runfusion/fusion describing the exemption behavior

Fusion-Task-Id: FN-3724
This commit is contained in:
Fusion
2026-05-08 01:37:27 -07:00
committed by gsxdsm
parent 2ba9b00704
commit ae2fe35483
5 changed files with 106 additions and 6 deletions

View File

@@ -29,6 +29,8 @@ export interface AgentActionGateContext {
findPendingApprovalByDedupeKey: (dedupeKey: string) => Promise<unknown | null>;
}
// FN-3724: Internal Fusion runtime/coordinator tools never perform external mutations.
// They must bypass user-configurable approval/block policies so permanent-agent heartbeats cannot deadlock.
const EXEMPT_TOOLS = new Set([
"read",
"find",
@@ -42,6 +44,17 @@ const EXEMPT_TOOLS = new Set([
"fn_memory_search",
"fn_memory_get",
"fn_read_messages",
"fn_heartbeat_done",
"fn_task_create",
"fn_delegate_task",
"fn_list_agents",
"fn_agent_show",
"fn_agent_org_chart",
"fn_send_message",
"fn_memory_append",
"fn_read_evaluations",
"fn_update_identity",
"fn_reflect_on_performance",
]);
const TASK_AGENT_MANAGEMENT_TOOLS = new Set([
@@ -196,6 +209,9 @@ export function evaluateAgentActionGate(params: {
operation = params.toolName;
resourceType = "file";
resourceId = typeof args.path === "string" ? args.path : undefined;
} else if (EXEMPT_TOOLS.has(params.toolName)) {
category = "exempt";
operation = params.toolName;
} else if (TASK_AGENT_MANAGEMENT_TOOLS.has(params.toolName)) {
category = "task_agent_mutation";
operation = params.toolName;
@@ -204,9 +220,6 @@ export function evaluateAgentActionGate(params: {
category = "network_api";
operation = params.toolName;
resourceType = "research";
} else if (EXEMPT_TOOLS.has(params.toolName)) {
category = "exempt";
operation = params.toolName;
}
const disposition: AgentPermissionPolicyDisposition | "allow" = category === "exempt"