From ecd7a2a2dcabd0d19731ad733d3c130bca2ac67a Mon Sep 17 00:00:00 2001 From: hailin Date: Thu, 1 Jan 2026 21:11:24 -0800 Subject: [PATCH] fix(android): clear pendingSessionId in resetSessionStatus to fix stale session matching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The resetSessionStatus() function was not clearing pendingSessionId, causing events from new sessions to be ignored because pendingSessionId still held the old session ID. Added: - Clear pendingSessionId = null in resetSessionStatus() - Clear _currentSession.value = null in resetSessionStatus() - Added debug logging for session state clearing šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .claude/settings.local.json | 3 ++- .../com/durian/tssparty/data/repository/TssRepository.kt | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index f7559712..790823bd 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -555,7 +555,8 @@ "Bash(adb devices:*)", "Bash(adb logcat:*)", "Bash(git commit -m \"$\\(cat <<''EOF''\nfeat\\(android\\): add 5-minute polling timeout mechanism for keygen/sign\n\nImplements Electron''s checkAndTriggerKeygen\\(\\) polling fallback:\n- Adds polling every 2 seconds with 5-minute timeout\n- Triggers keygen/sign via synthetic session_started event on in_progress status\n- Handles gRPC stream disconnection when app goes to background\n- Shows timeout error in UI via existing error mechanism\n\nšŸ¤– Generated with [Claude Code]\\(https://claude.com/claude-code\\)\n\nCo-Authored-By: Claude Opus 4.5 \nEOF\n\\)\")", - "Bash(go list:*)" + "Bash(go list:*)", + "Bash(adb install:*)" ], "deny": [], "ask": [] diff --git a/backend/mpc-system/services/service-party-android/app/src/main/java/com/durian/tssparty/data/repository/TssRepository.kt b/backend/mpc-system/services/service-party-android/app/src/main/java/com/durian/tssparty/data/repository/TssRepository.kt index c0ecff0c..3a15aac2 100644 --- a/backend/mpc-system/services/service-party-android/app/src/main/java/com/durian/tssparty/data/repository/TssRepository.kt +++ b/backend/mpc-system/services/service-party-android/app/src/main/java/com/durian/tssparty/data/repository/TssRepository.kt @@ -1832,8 +1832,17 @@ class TssRepository @Inject constructor( * Called when navigating away from session screens to ensure fresh state */ fun resetSessionStatus() { + android.util.Log.d("TssRepository", "resetSessionStatus called - clearing session state") _sessionStatus.value = SessionStatus.WAITING stopSessionStatusPolling() // Stop polling when resetting session state + + // CRITICAL: Clear pending session ID to avoid stale session matching + // Without this, events from new sessions would be ignored because + // pendingSessionId still holds the old session ID + pendingSessionId = null + _currentSession.value = null + + android.util.Log.d("TssRepository", "Session state cleared: pendingSessionId=null, currentSession=null") } /**