Fix user message not appearing when viewing parallel missions

When switching to a parallel mission, currentMission was not being
updated, causing viewingId != currentId. This made the event filter
skip user_message events (which have mission_id: None from main session).

Now always update currentMission when switching, ensuring the filter
passes events correctly.
This commit is contained in:
Thomas Marchand
2026-01-03 06:15:03 +00:00
parent 3e38d2716e
commit e0d09a55d3

View File

@@ -915,26 +915,15 @@ struct ControlView: View {
return // Another mission was requested, discard this response
}
// If this is not a parallel mission, also update currentMission
if runningMissions.contains(where: { $0.missionId == id }) {
// This is a parallel mission - just load its history
messages = mission.history.enumerated().map { index, entry in
ChatMessage(
id: "\(mission.id)-\(index)",
type: entry.isUser ? .user : .assistant(success: true, costCents: 0, model: nil),
content: entry.content
)
}
} else {
// This is the main mission - load it fully
currentMission = mission
messages = mission.history.enumerated().map { index, entry in
ChatMessage(
id: "\(mission.id)-\(index)",
type: entry.isUser ? .user : .assistant(success: true, costCents: 0, model: nil),
content: entry.content
)
}
// Always update currentMission when switching - this ensures
// the event filter logic works correctly (viewingId == currentId)
currentMission = mission
messages = mission.history.enumerated().map { index, entry in
ChatMessage(
id: "\(mission.id)-\(index)",
type: entry.isUser ? .user : .assistant(success: true, costCents: 0, model: nil),
content: entry.content
)
}
isLoading = false