Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
366c550
migrate manager menu items
christian-byrne Apr 9, 2025
2aed31a
Update locales [skip ci]
invalid-email-address Apr 9, 2025
1f41367
switch to v2 manager API endpoints
christian-byrne Apr 9, 2025
363a46b
re-arrange menu items
christian-byrne Apr 11, 2025
5867103
await promises. update settings schema
christian-byrne Apr 14, 2025
7c14b26
move legacy option to startup arg
christian-byrne Apr 14, 2025
d3a629c
Add banner indicating how to use legacy manager UI
christian-byrne Apr 14, 2025
3c8adf4
Update locales [skip ci]
invalid-email-address Apr 14, 2025
eee3b74
add "Check for Updates", "Install Missing" menu items
christian-byrne Apr 14, 2025
dc2a470
Update locales [skip ci]
invalid-email-address Apr 14, 2025
05ec65f
use correct response shape
christian-byrne Apr 14, 2025
3862d78
improve command names
christian-byrne Apr 14, 2025
4a67a83
dont show missing nodes button in legacy manager mode
christian-byrne Apr 15, 2025
ced03ce
[Update to v2 API] update WS done message
christian-byrne Apr 15, 2025
7725b87
Update locales [skip ci]
invalid-email-address Apr 26, 2025
b348669
[manager] Update type definitions and schemas for menu items migration
christian-byrne Jun 13, 2025
f241b7f
[manager] Update core services for new manager API
christian-byrne Jun 13, 2025
ba1d067
[manager] Update composables and state management
christian-byrne Jun 13, 2025
b683a81
[manager] Update UI components for new manager interface
christian-byrne Jun 13, 2025
39ad018
[manager] Update tests for new manager API
christian-byrne Jun 13, 2025
5e43715
[manager] Fix test failures and missing type definitions
christian-byrne Jun 14, 2025
4249fe7
fix rebase errors
christian-byrne Jun 21, 2025
0f9d1f8
Update locales [skip ci]
invalid-email-address Jun 21, 2025
60e2f14
[Manager] Filter task queue and history by client id (#4241)
christian-byrne Jun 21, 2025
096e0c9
fix failed task tab state binding
christian-byrne Jun 22, 2025
8fbd076
[Manager] Fix: failed tasks logs not correctly partitioned in UI (#4242)
christian-byrne Jun 22, 2025
0f7e3f7
[tests] Update useServerLogs test to handle task-started events
christian-byrne Jun 22, 2025
dc85896
fix: logs stops listening after 1st of multiple queue tasks
christian-byrne Jun 23, 2025
a83a7fa
remove the temporary check for legacy custom node version of manager
christian-byrne Jun 23, 2025
babe324
[tests] Update useServerLogs test after log subscription change
christian-byrne Jun 23, 2025
558cfcc
[Manager] Add update all button functionality
viva-jinyi Jun 24, 2025
1cb94ca
[Manager] “Restarting” state after clicking restart button (#4269)
viva-jinyi Jun 26, 2025
7073c9d
fix rebase error
christian-byrne Jul 11, 2025
2e2647d
Update locales [skip ci]
invalid-email-address Jul 11, 2025
730b278
[test] Update PackVersionBadge test to use role selector instead of B…
viva-jinyi Jul 11, 2025
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
3fdbc28
Restore lost work from manager/menu-items-migration feature branch
christian-byrne Aug 27, 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 Jul 11, 2025
commit 8fbd076b9cc83d45c0f1a3877acd46d5be583a06
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