Skip to content

Commit b8ff4fe

Browse files
authored
fix: show sessions waiting for concurrency slots (#125654)
* fix: show sessions waiting for concurrency slots * test: align queued session integration fixtures * test: distinguish queued and reactivated followups * fix: preserve queued state in workboard and android * fix: project queued status through chat history * test(ui): keep queued sidebar case under line cap
1 parent 2601bcb commit b8ff4fe

56 files changed

Lines changed: 714 additions & 97 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/.i18n/native-source.json‎

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎apps/android/app/src/main/java/ai/openclaw/app/chat/ChatSwarmProgress.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ internal fun buildChatSwarmGroups(
278278

279279
private fun swarmDotStatus(row: ChatSessionEntry): ChatSwarmDotStatus? =
280280
when {
281+
row.status == "queued" -> ChatSwarmDotStatus.Queued
281282
row.status == "running" || row.hasActiveRun == true -> ChatSwarmDotStatus.Running
282283
row.status == "done" -> ChatSwarmDotStatus.Done
283284
row.status == "failed" || row.status == "killed" || row.status == "timeout" -> ChatSwarmDotStatus.Failed

‎apps/android/app/src/main/java/ai/openclaw/app/ui/SessionsScreen.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,8 @@ internal fun sessionListSubtitle(
949949
(digest.health == "done" || digest.health == "failed") &&
950950
(session.lastReadAt ?: 0L) < digest.updatedAt
951951
val observer = digest?.headline?.takeIf { (running && digestMatchesActiveRun) || (!running && finalDigestUnread) }
952-
return declaredAttention ?: failedAttention ?: agentStatus?.note ?: observer ?: fallback
952+
val queued = nativeString("Waiting for a concurrency slot").takeIf { runStatus == "queued" }
953+
return declaredAttention ?: failedAttention ?: agentStatus?.note ?: queued ?: observer ?: fallback
953954
}
954955

955956
internal data class SessionSection(

‎apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarComponents.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ internal fun SidebarSessionRow(
225225
) {
226226
val sessionStateDescription =
227227
when {
228+
session.status == "queued" -> nativeString("Queued")
228229
session.hasActiveRun == true -> nativeString("Working")
229230
session.unread == true -> nativeString("Needs attention")
230231
selected -> nativeString("Selected")

‎apps/android/app/src/test/java/ai/openclaw/app/chat/ChatSwarmProgressTest.kt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class ChatSwarmProgressTest {
9898
buildChatSwarmGroups(
9999
sessions =
100100
listOf(
101-
session("queued", null, active, subagentRunState = "active"),
101+
session("queued", "queued", active, hasActiveRun = true),
102102
session("running", "running", active),
103103
session("done", "done", active),
104104
session("failed", "timeout", active),
@@ -252,6 +252,7 @@ class ChatSwarmProgressTest {
252252
status: String?,
253253
groupId: String,
254254
subagentRunState: String? = null,
255+
hasActiveRun: Boolean? = null,
255256
): ChatSessionEntry =
256257
ChatSessionEntry(
257258
key = key,
@@ -261,5 +262,6 @@ class ChatSwarmProgressTest {
261262
subagentRunState = subagentRunState,
262263
swarmGroupId = groupId,
263264
status = status,
265+
hasActiveRun = hasActiveRun,
264266
)
265267
}

‎apps/android/app/src/test/java/ai/openclaw/app/ui/SessionObserverDigestTest.kt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,14 @@ class SessionObserverDigestTest {
315315
"Agent note",
316316
sessionListSubtitle(failed.copy(status = "running", lastRunError = null), fallback = "Work", nowMs = 1_000),
317317
)
318+
assertEquals(
319+
"Waiting for a concurrency slot",
320+
sessionListSubtitle(
321+
failed.copy(agentStatus = null, status = "queued", lastRunError = null),
322+
fallback = "Work",
323+
nowMs = 1_000,
324+
),
325+
)
318326

319327
val finalDigest = digest(runId = null, revision = 2, updatedAt = 2_000, headline = "Finished", health = "done")
320328
val idle = ChatSessionEntry(key = "work", updatedAtMs = 2_000, lastReadAt = 1_999, observerDigest = finalDigest)

‎apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatSessionManagementViews.swift‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ struct ChatSessionInspectorDetails: Equatable {
137137
}
138138

139139
private static func runState(for session: OpenClawChatSessionEntry) -> String? {
140+
if self.normalized(session.status)?.lowercased() == "queued" {
141+
return String(localized: "Queued")
142+
}
140143
if session.hasActiveRun == true || session.hasActiveSubagentRun == true {
141144
return String(localized: "Running")
142145
}

‎apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatSessionSidebar.swift‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ struct ChatSessionSidebar: View {
220220

221221
@ViewBuilder
222222
private func badges(for node: ChatSessionSidebarModel.Node) -> some View {
223+
if node.badges.queuedCount > 0 {
224+
Image(systemName: "hourglass")
225+
.foregroundStyle(OpenClawChatTheme.warning)
226+
.accessibilityLabel(String(localized: "Thread queued"))
227+
}
223228
if node.badges.runningCount > 0 {
224229
ProgressView()
225230
.controlSize(.small)

‎apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatSessionSidebarModel.swift‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import OpenClawProtocol
55
/// so pin/search/ordering rules stay unit-testable across macOS and iOS.
66
public enum ChatSessionSidebarModel {
77
public struct Badges: Equatable, Sendable {
8+
public let queuedCount: Int
89
public let runningCount: Int
910
public let failedCount: Int
1011
public let hasUnread: Bool
@@ -159,12 +160,15 @@ public enum ChatSessionSidebarModel {
159160

160161
private static func node(session: OpenClawChatSessionEntry, children: [Node]) -> Node {
161162
let status = session.status?.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
162-
let isRunning = session.hasActiveRun == true || session.hasActiveSubagentRun == true || status == "running"
163+
let isQueued = status == "queued"
164+
let isRunning = !isQueued &&
165+
(session.hasActiveRun == true || session.hasActiveSubagentRun == true || status == "running")
163166
let hasFailed = status == "failed" || status == "timeout"
164167
return Node(
165168
session: session,
166169
children: children,
167170
badges: Badges(
171+
queuedCount: (isQueued ? 1 : 0) + children.reduce(0) { $0 + $1.badges.queuedCount },
168172
runningCount: (isRunning ? 1 : 0) + children.reduce(0) { $0 + $1.badges.runningCount },
169173
failedCount: (hasFailed ? 1 : 0) + children.reduce(0) { $0 + $1.badges.failedCount },
170174
hasUnread: session.unread == true || children.contains { $0.badges.hasUnread }))
@@ -209,8 +213,11 @@ public enum ChatSessionSidebarModel {
209213
let declaredAttention = agentStatus?.attention == nil ? nil : agentStatus?.note
210214
let failedAttention = self.unreadFailureReason(for: session)
211215
let statusNote = agentStatus?.note
216+
let queued = self.normalized(session.status)?.lowercased() == "queued"
217+
? String(localized: "Waiting for a concurrency slot")
218+
: nil
212219
let observer = self.visibleObserverDigest(for: session)?.headline
213-
return declaredAttention ?? failedAttention ?? statusNote ?? observer ?? workSubtitle
220+
return declaredAttention ?? failedAttention ?? statusNote ?? queued ?? observer ?? workSubtitle
214221
}
215222

216223
/// Live observer events are useful only after a server row names the

‎apps/shared/OpenClawKit/Sources/OpenClawChatUI/Swarm.swift‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ func buildOpenClawChatSwarmGroups(
223223

224224
enum SelfContainedSwarmHelpers {
225225
static func status(_ row: OpenClawChatSessionEntry) -> OpenClawChatSwarmDotStatus? {
226+
if row.status == "queued" {
227+
return .queued
228+
}
226229
if row.status == "running" || row.hasActiveRun == true {
227230
return .running
228231
}

0 commit comments

Comments
 (0)