fix: resolve four findings from code review

- Stop silently booting user from session view on completion
  (SessionsReducer.processSessionCompletedMessage no longer deselects)
- Wrap StageToolManifest send in runCatching to survive WS disconnect
  after orchestrator launch in module scope
- Fix navigateUp dead state: wrap to last workflow instead of -1
- Consolidate event store reads in SessionEventBridge (single read
  for both recentEvents and approval state), removing
  DefaultApprovalRepository dependency
This commit is contained in:
2026-05-26 16:01:57 +04:00
parent 3d95a946a8
commit e3812330d2
5 changed files with 52 additions and 73 deletions
@@ -105,12 +105,12 @@ object SessionsReducer {
return if (wfi > 0) {
sessions.copy(selectedWorkflowIndex = wfi - 1)
} else {
// Move back to last session, or stay at first workflow if no sessions
// Move back to last session, or wrap to last workflow if no sessions
val list = filteredSessions(sessions)
if (list.isNotEmpty()) {
sessions.copy(selectedWorkflowIndex = -1, selectedId = list.last().id)
} else {
sessions.copy(selectedWorkflowIndex = -1)
sessions.copy(selectedWorkflowIndex = sessions.workflows.lastIndex)
}
}
}
@@ -487,8 +487,7 @@ object SessionsReducer {
clock: () -> Long,
): Pair<SessionsState, List<Effect>> {
val result = touchSession(sessions, msg.sessionId.value, "COMPLETED", clock)
val cleared = if (msg.sessionId.value == result.selectedId) result.copy(selectedId = null) else result
return cleared to emptyList()
return result to emptyList()
}
private fun processSessionPausedMessage(