From c4a4ba5d4c496f8cd34626bd6364d6ca53395864 Mon Sep 17 00:00:00 2001 From: KoheiYamashita Date: Fri, 20 Feb 2026 15:09:22 +0900 Subject: [PATCH] fix: clear status indicator on message processing completion Send status_end from Run() goroutine defer to ensure the Android status indicator is cleared on all exit paths (normal, error, cancel). Co-Authored-By: Claude Opus 4.6 --- .../android/core/data/repository/ChatRepositoryImpl.kt | 1 + pkg/agent/loop.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/android/core/data/src/main/java/io/picoclaw/android/core/data/repository/ChatRepositoryImpl.kt b/android/core/data/src/main/java/io/picoclaw/android/core/data/repository/ChatRepositoryImpl.kt index 4b9355a4a..f96de6c6a 100644 --- a/android/core/data/src/main/java/io/picoclaw/android/core/data/repository/ChatRepositoryImpl.kt +++ b/android/core/data/src/main/java/io/picoclaw/android/core/data/repository/ChatRepositoryImpl.kt @@ -47,6 +47,7 @@ class ChatRepositoryImpl( webSocketClient.incomingMessages.collect { dto -> when (dto.type) { "status" -> _statusLabel.value = dto.content + "status_end" -> _statusLabel.value = null else -> { _statusLabel.value = null val entity = MessageMapper.toEntity(dto) diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index 54bc47d8f..fbc4713d6 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -233,6 +233,13 @@ func (al *AgentLoop) Run(ctx context.Context) error { go func(m bus.InboundMessage, sk string) { defer func() { + // Clear status indicator on completion (normal, error, or cancel) + if !constants.IsInternalChannel(m.Channel) { + al.bus.PublishOutbound(bus.OutboundMessage{ + Channel: m.Channel, ChatID: m.ChatID, + Type: "status_end", + }) + } close(done) al.procsMu.Lock() if cur, ok := al.activeProcs[sk]; ok && cur.done == done {