refactor(core): execute Phase 3 state and delegate extractions

- Extract ChatClarifyDelegate from ChatViewModel for clarify prompt flow.
- Harden GroupChatViewModel maps with ConcurrentHashMap.
- Add failure circuit breaker to MCP OAuth polling loop.
This commit is contained in:
Hy4ri committed 2026-09-11 20:13:00 +03:00
1 parent 5f79bdee54
commit 02106c3781
4 files changed
+153 -107

No files matched your search

@@ -585,6 +585,7 @@ class McpServersViewModel :
oauthPollJob =
viewModelScope.launch {
var polling = true
var consecutiveFailures = 0
while (polling) {
kotlinx.coroutines.delay(2000)
val result =
@@ -629,7 +630,16 @@ class McpServersViewModel :
}
is NetworkResult.Failure -> {
// Keep polling or stop after too many failures? Let's just log/toast n retry a few times
consecutiveFailures++
if (consecutiveFailures >= 10) {
polling = false
_uiState.update {
it.copy(
activeOAuthFlow = null,
toastMessage = "OAuth polling timed out after repeated network failures",
)
}
}
}
}
}