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

@@ -619,6 +619,33 @@ describe("wrapToolsWithActionGate", () => {
expect(createApprovalRequest).toHaveBeenCalledTimes(1);
expect(tool.execute).not.toHaveBeenCalled();
});
it("passes through exempt internal tools under locked-down policy", async () => {
const execute = vi.fn().mockResolvedValue({ ok: true });
const tool = { name: "fn_heartbeat_done", label: "Heartbeat Done", description: "", parameters: {}, execute };
const { wrapToolsWithActionGate } = await import("../pi.js");
const wrapped = wrapToolsWithActionGate([tool as any], {
agentId: "agent-1",
agentName: "Agent",
isEphemeral: false,
taskId: "FN-1",
permissionPolicy: {
presetId: "locked-down",
rules: {
"git_write": "block",
"file_write_delete": "block",
"command_execution": "block",
"network_api": "block",
"task_agent_mutation": "block",
},
},
createApprovalRequest: vi.fn(),
findPendingApprovalByDedupeKey: vi.fn(),
});
await (wrapped[0] as any).execute("t1", {});
expect(execute).toHaveBeenCalledTimes(1);
});
});
describe("createFnAgent", () => {