Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
c28d451
migrate manager menu items
christian-byrne Apr 9, 2025
588bd99
Update locales [skip ci]
invalid-email-address Apr 9, 2025
de6ed34
switch to v2 manager API endpoints
christian-byrne Apr 9, 2025
54a0981
re-arrange menu items
christian-byrne Apr 11, 2025
eb5c49f
await promises. update settings schema
christian-byrne Apr 14, 2025
aba2e5e
move legacy option to startup arg
christian-byrne Apr 14, 2025
f8953a8
Add banner indicating how to use legacy manager UI
christian-byrne Apr 14, 2025
e780e1d
Update locales [skip ci]
invalid-email-address Apr 14, 2025
b01056e
add "Check for Updates", "Install Missing" menu items
christian-byrne Apr 14, 2025
bdd1230
Update locales [skip ci]
invalid-email-address Apr 14, 2025
1aee434
use correct response shape
christian-byrne Apr 14, 2025
f1610db
improve command names
christian-byrne Apr 14, 2025
4f94707
dont show missing nodes button in legacy manager mode
christian-byrne Apr 15, 2025
8075db4
[Update to v2 API] update WS done message
christian-byrne Apr 15, 2025
1a29fb9
migrate manager menu items
christian-byrne Apr 9, 2025
e0aa0d0
re-arrange menu items
christian-byrne Apr 11, 2025
4a518eb
await promises. update settings schema
christian-byrne Apr 14, 2025
a70d013
move legacy option to startup arg
christian-byrne Apr 14, 2025
edc61a0
Add banner indicating how to use legacy manager UI
christian-byrne Apr 14, 2025
7318ef9
add "Check for Updates", "Install Missing" menu items
christian-byrne Apr 14, 2025
5ad236e
use correct response shape
christian-byrne Apr 14, 2025
0d1da6d
improve command names
christian-byrne Apr 14, 2025
a4c0ab0
dont show missing nodes button in legacy manager mode
christian-byrne Apr 15, 2025
229c0e5
Update locales [skip ci]
invalid-email-address Apr 26, 2025
3af4f82
[manager] Update type definitions and schemas for menu items migration
christian-byrne Jun 13, 2025
9551595
[manager] Update core services for new manager API
christian-byrne Jun 13, 2025
9d58d4e
[manager] Update composables and state management
christian-byrne Jun 13, 2025
2914c67
[manager] Update UI components for new manager interface
christian-byrne Jun 13, 2025
d76702e
[manager] Update tests for new manager API
christian-byrne Jun 13, 2025
7685ca3
[manager] Fix test failures and missing type definitions
christian-byrne Jun 14, 2025
5e285db
fix rebase errors
christian-byrne Jun 21, 2025
9fceda8
[Manager] Filter task queue and history by client id (#4241)
christian-byrne Jun 21, 2025
8a920f1
fix failed task tab state binding
christian-byrne Jun 22, 2025
ea9bc11
[Manager] Fix: failed tasks logs not correctly partitioned in UI (#4242)
christian-byrne Jun 22, 2025
b7ba509
[tests] Update useServerLogs test to handle task-started events
christian-byrne Jun 22, 2025
c2f3a47
fix: logs stops listening after 1st of multiple queue tasks
christian-byrne Jun 23, 2025
88d8d14
remove the temporary check for legacy custom node version of manager
christian-byrne Jun 23, 2025
20b47ef
[tests] Update useServerLogs test after log subscription change
christian-byrne Jun 23, 2025
84542e8
[Manager] Add update all button functionality
viva-jinyi Jun 24, 2025
8e6ed32
[Manager] “Restarting” state after clicking restart button (#4269)
viva-jinyi Jun 26, 2025
ec4e672
fix rebase error
christian-byrne Jul 11, 2025
c10c151
Update locales [skip ci]
invalid-email-address Jul 11, 2025
aa5e8e5
[test] Update PackVersionBadge test to use role selector instead of B…
viva-jinyi Jul 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Manager] Fix: failed tasks logs not correctly partitioned in UI (#4242)
  • Loading branch information
christian-byrne committed Aug 27, 2025
commit ea9bc11d3c8c3dec165d92003ffe5dbb663c5feb
31 changes: 29 additions & 2 deletions src/composables/useServerLogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import { components } from '@/types/generatedManagerTypes'

const LOGS_MESSAGE_TYPE = 'logs'
const MANAGER_WS_TASK_DONE_NAME = 'cm-task-completed'
const MANAGER_WS_TASK_STARTED_NAME = 'cm-task-started'

type ManagerWsTaskDoneMsg = components['schemas']['MessageTaskDone']
type ManagerWsTaskStartedMsg = components['schemas']['MessageTaskStarted']

interface UseServerLogsOptions {
ui_id: string
Expand All @@ -23,8 +25,10 @@ export const useServerLogs = (options: UseServerLogsOptions) => {
} = options

const logs = ref<string[]>([])
const isTaskStarted = ref(false)
let stopLogs: ReturnType<typeof useEventListener> | null = null
let stopTaskDone: ReturnType<typeof useEventListener> | null = null
let stopTaskStarted: ReturnType<typeof useEventListener> | null = null

const isValidLogEvent = (event: CustomEvent<LogsWsMessage>) =>
event?.type === LOGS_MESSAGE_TYPE && event.detail?.entries?.length > 0
Expand All @@ -33,6 +37,9 @@ export const useServerLogs = (options: UseServerLogsOptions) => {
event.detail.entries.map((e) => e.m).filter(messageFilter)

const handleLogMessage = (event: CustomEvent<LogsWsMessage>) => {
// Only capture logs if this task has started
if (!isTaskStarted.value) return

if (isValidLogEvent(event)) {
const messages = parseLogMessage(event)
if (messages.length > 0) {
Expand All @@ -41,11 +48,24 @@ export const useServerLogs = (options: UseServerLogsOptions) => {
}
}

const handleTaskStarted = (event: CustomEvent<ManagerWsTaskStartedMsg>) => {
if (event?.type === MANAGER_WS_TASK_STARTED_NAME) {
// Check if this is our task starting
const isOurTask = event.detail.ui_id === options.ui_id
if (isOurTask) {
isTaskStarted.value = true
void stopTaskStarted?.()
}
}
}

const handleTaskDone = (event: CustomEvent<ManagerWsTaskDoneMsg>) => {
if (event?.type === MANAGER_WS_TASK_DONE_NAME) {
const { state } = event.detail
// Check if our task is now in the history (completed)
if (state.history[options.ui_id]) {
const isOurTaskDone = state.history[options.ui_id]
if (isOurTaskDone) {
isTaskStarted.value = false
void stopListening()
}
}
Expand All @@ -54,6 +74,11 @@ export const useServerLogs = (options: UseServerLogsOptions) => {
const startListening = async () => {
await api.subscribeLogs(true)
stopLogs = useEventListener(api, LOGS_MESSAGE_TYPE, handleLogMessage)
stopTaskStarted = useEventListener(
api,
MANAGER_WS_TASK_STARTED_NAME,
handleTaskStarted
)
stopTaskDone = useEventListener(
api,
MANAGER_WS_TASK_DONE_NAME,
Expand All @@ -62,10 +87,11 @@ export const useServerLogs = (options: UseServerLogsOptions) => {
}

const stopListening = async () => {
console.log('stopListening')
stopLogs?.()
stopTaskStarted?.()
stopTaskDone?.()
stopLogs = null
stopTaskStarted = null
stopTaskDone = null
await api.subscribeLogs(false)
}
Expand All @@ -77,6 +103,7 @@ export const useServerLogs = (options: UseServerLogsOptions) => {
const cleanup = async () => {
await stopListening()
logs.value = []
isTaskStarted.value = false
}

return {
Expand Down
19 changes: 2 additions & 17 deletions src/stores/comfyManagerStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ export const useComfyManagerStore = defineStore('comfyManager', () => {
() => {
partitionTasks()
partitionTaskLogs()
console.log('installed pack ids', installedPacksIds.value)
},
{ deep: true }
)
Expand Down Expand Up @@ -154,26 +153,12 @@ export const useComfyManagerStore = defineStore('comfyManager', () => {

const updateInstalledIds = (packs: ManagerPackInstalled[]) => {
const newIds = packsToIdSet(packs)
console.log('updateInstalledIds: creating set with:', Array.from(newIds))
installedPacksIds.value = newIds
console.log(
'updateInstalledIds: final installedPacksIds:',
Array.from(installedPacksIds.value)
)
}

const onPacksChanged = () => {
const packs = Object.values(installedPacks.value)
console.log(
'onPacksChanged called with packs:',
packs.map((p) => ({
key: Object.keys(installedPacks.value).find(
(k) => installedPacks.value[k] === p
),
cnr_id: p.cnr_id,
aux_id: p.aux_id
}))
)

updateDisabledIds(packs)
updateInstalledIds(packs)
}
Expand Down Expand Up @@ -337,7 +322,7 @@ export const useComfyManagerStore = defineStore('comfyManager', () => {
failedTasksIds,
succeededTasksLogs,
failedTasksLogs,
managerQueue, // Expose full queue composable for advanced usage
managerQueue,

// Pack actions
installPack,
Expand Down