feat(FN-4064): keep interview sessions visible when resuming missions

Added interview session visibility on task resume in MissionManager, with comprehensive test coverage for the resume-session interview behavior.

Fusion-Task-Id: FN-4064
This commit is contained in:
Fusion
2026-05-11 21:29:59 -07:00
committed by gsxdsm
parent 709467d63f
commit ce0e5f4ce6
2 changed files with 77 additions and 2 deletions

View File

@@ -602,7 +602,7 @@ export function MissionManager({ isOpen, isInline = false, onClose, addToast, pr
// Detect pending mission interview sessions for resume prompt
useEffect(() => {
if (!isActive || effectiveResumeSessionId) return;
if (!isActive) return;
let cancelled = false;
fetchAiSessions(projectId).then((sessions) => {
if (cancelled) return;

View File

@@ -1653,6 +1653,81 @@ describe("MissionManager", () => {
});
});
it("keeps interview-pending rows visible while opened from a resume session", async () => {
mockFetchAiSession.mockResolvedValueOnce({
id: "session-bg-1",
type: "mission_interview",
status: "generating",
title: "Mission interview",
currentQuestion: null,
result: null,
thinkingOutput: "",
error: null,
projectId: "project-a",
createdAt: "2026-01-01T00:00:00.000Z",
updatedAt: "2026-01-01T00:00:00.000Z",
});
mockFetchAiSessions.mockResolvedValue([
{
id: "session-bg-1",
type: "mission_interview",
status: "awaiting_input",
title: "Project A transient interview",
projectId: "project-a",
lockedByTab: null,
updatedAt: "2026-01-03T00:00:00.000Z",
},
]);
const missionsWithPersistedInterview = [
{
id: "M-PERSISTED-INTERVIEW",
title: "Persisted mission interview",
description: "Mission should stay discoverable while interview waits for input",
status: "planning",
interviewState: "in_progress",
milestones: [],
createdAt: "2026-01-05T00:00:00.000Z",
updatedAt: "2026-01-05T00:00:00.000Z",
},
...mockMissions,
];
globalThis.fetch = createFetchMockWithHealth(missionsWithPersistedInterview as Array<Record<string, unknown>>, {
...mockMissionHealthById,
"M-PERSISTED-INTERVIEW": {
missionId: "M-PERSISTED-INTERVIEW",
status: "planning",
tasksCompleted: 0,
tasksFailed: 0,
tasksInFlight: 0,
totalTasks: 0,
estimatedCompletionPercent: 0,
autopilotState: "inactive",
autopilotEnabled: false,
},
});
render(
<MissionManager
isOpen={true}
onClose={vi.fn()}
addToast={vi.fn()}
projectId="project-a"
resumeSessionId="session-bg-1"
/>,
);
await waitFor(() => {
expect(screen.getByText("Plan Mission with AI")).toBeInTheDocument();
expect(screen.getByText("Project A transient interview")).toBeInTheDocument();
expect(screen.getByText("Persisted mission interview")).toBeInTheDocument();
});
expect(screen.getByLabelText("Resume interview")).toBeInTheDocument();
});
it("re-shows project-scoped transient interview rows after banner resume is backgrounded on mobile", async () => {
mockViewport("mobile");
@@ -1686,7 +1761,7 @@ describe("MissionManager", () => {
updatedAt: "2026-01-01T00:00:00.000Z",
});
mockFetchAiSessions.mockResolvedValueOnce([
mockFetchAiSessions.mockResolvedValue([
{
id: "session-bg-1",
type: "mission_interview",