feat(FN-3335): fix worktree project root resolution in createFnAgent and ad

Merges FN-3335 (worktree project resolution) and FN-3333 (spurious version reloads). The engine's `createFnAgent` now resolves project root from the worktree's cwd rather than the parent process, with `resolveProjectRoot` added to skill-resolver for consistency. The dashboard's `versionCheck` was up

Fusion-Task-Id: FN-3335
This commit is contained in:
Fusion
2026-05-03 16:01:17 -07:00
committed by gsxdsm
parent 85d02c8291
commit a1a8d0398f
6 changed files with 195 additions and 9 deletions

View File

@@ -401,6 +401,26 @@ describe("createFnAgent skills parameter", () => {
);
});
it("resolves project root via resolvePiExtensionProjectRoot for non-worktree paths", async () => {
// When cwd is a regular directory (not a .worktrees/ path),
// resolvePiExtensionProjectRoot is used to walk up to .fusion.
// Since no .fusion exists in test filesystem, it returns cwd as-is.
const options: AgentOptions = {
cwd: "/project/subdirectory",
systemPrompt: "Test",
skills: ["fusion"],
};
await createFnAgent(options);
// resolvePiExtensionProjectRoot walks up from /project/subdirectory.
// No .fusion is found in the test filesystem, so it returns /project/subdirectory.
expect(mockResolveSessionSkills).toHaveBeenCalledTimes(1);
const callArgs = mockResolveSessionSkills.mock.calls[0]![0];
expect(callArgs.projectRootDir).toBe("/project/subdirectory");
expect(callArgs.requestedSkillNames).toEqual(["fusion"]);
});
it("skills without corresponding discovered skills produces diagnostics", async () => {
// Mock to return diagnostics for missing skill
mockResolveSessionSkills.mockReturnValue({