fix(mission): reconnect SSE stream after submitting interview response

After handleSubmitResponse posted an answer, the stream connection was
never re-established, so the next question from the server was never
received. The modal would stay on the loading spinner until the user
closed and reopened it (which triggered the resume-session reconnect).

Fix: call connectToMissionInterviewStream(sessionId) before the API
call, matching the pattern used by handleRetryFromError. Also close
the stream on API error to match the error-recovery path, and add
connectToMissionInterviewStream to the useCallback dependency array.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-13 09:53:07 -07:00
parent 36d5373a6e
commit 86202b74cf

View File

@@ -569,14 +569,17 @@ export function MissionInterviewModal({
setStreamingOutput("");
try {
connectToMissionInterviewStream(sessionId);
await respondToMissionInterview(sessionId, responses, projectId, sessionTabId);
setHasProgress(true);
} catch (err: any) {
streamConnectionRef.current?.close();
streamConnectionRef.current = null;
setError(err.message || "Failed to submit response");
setView({ type: "question", sessionId, question: view.question });
}
},
[view, projectId, sessionTabId]
[view, projectId, sessionTabId, connectToMissionInterviewStream]
);
const handleRetryFromError = useCallback(async () => {