Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 11 additions & 6 deletions apps/desktop/src/app/desktop-controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,23 +414,27 @@ export function DesktopController() {
// still resolves into the Pinned section via sessionByAnyId.
const refreshCronSessions = useCallback(async () => {
try {
const { sessions } = await listAllProfileSessions(CRON_SECTION_LIMIT, 1, 'exclude', 'recent', 'all', {
const cronProfile = profileScope === ALL_PROFILES ? 'all' : profileScope

const { sessions } = await listAllProfileSessions(CRON_SECTION_LIMIT, 1, 'exclude', 'recent', cronProfile, {
source: 'cron'
})

setCronSessions(prev => (sameCronSignature(prev, sessions) ? prev : sessions))
} catch {
// Non-fatal: the cron section just stays empty/stale.
}
}, [])
}, [profileScope])

// Messaging-platform sessions as their own slice, fetched separately from
// local recents so each platform renders a self-managed section and never
// competes with local chats for the recents page budget. One combined fetch
// seeds every platform; the sidebar splits the rows per source.
const refreshMessagingSessions = useCallback(async () => {
try {
const result = await listAllProfileSessions(MESSAGING_SECTION_LIMIT, 1, 'exclude', 'recent', 'all', {
const msgProfile = profileScope === ALL_PROFILES ? 'all' : profileScope

const result = await listAllProfileSessions(MESSAGING_SECTION_LIMIT, 1, 'exclude', 'recent', msgProfile, {
excludeSources: MESSAGING_EXCLUDED_SOURCES
})

Expand All @@ -445,16 +449,17 @@ export function DesktopController() {
} catch {
// Non-fatal: the messaging sections just stay empty/stale.
}
}, [])
}, [profileScope])

// Page a single platform's section independently (mirrors the per-profile
// pager): fetch that source's next window and merge it back in place, leaving
// every other platform's rows untouched. Resolves the platform's exact total.
const loadMoreMessagingForPlatform = useCallback(async (platform: string) => {
const inPlatform = (s: SessionInfo) => normalizeSessionSource(s.source) === platform
const loaded = $messagingSessions.get().filter(inPlatform).length
const loadProfile = profileScope === ALL_PROFILES ? 'all' : profileScope

const result = await listAllProfileSessions(loaded + SIDEBAR_SESSIONS_PAGE_SIZE, 1, 'exclude', 'recent', 'all', {
const result = await listAllProfileSessions(loaded + SIDEBAR_SESSIONS_PAGE_SIZE, 1, 'exclude', 'recent', loadProfile, {
source: platform
})

Expand All @@ -467,7 +472,7 @@ export function DesktopController() {

const total = result.total ?? incoming.length
setMessagingPlatformTotals(prev => ({ ...prev, [platform]: Math.max(total, incoming.length) }))
}, [])
}, [profileScope])

// Cron *jobs* drive the sidebar "Cron jobs" section. Jobs are created
// synchronously (agent tool call or the cron UI), so refreshing here right
Expand Down
4 changes: 3 additions & 1 deletion apps/desktop/src/hermes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,10 @@ export function testMessagingPlatform(platformId: string): Promise<MessagingPlat
}

export function getCronJobs(): Promise<CronJob[]> {
const qs = _apiProfile ? `?profile=${encodeURIComponent(_apiProfile)}` : ''

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_apiProfile follows the active gateway profile, but the sidebar may be in explicit All profiles mode ($profileScope === ALL_PROFILES). In that mode this sends one active profile rather than profile=all. Accept the sidebar scope as a getCronJobs argument and pass profileScope === ALL_PROFILES ? 'all' : profileScope from the callers.


return window.hermesDesktop.api<CronJob[]>({
path: '/api/cron/jobs'
path: `/api/cron/jobs${qs}`
})
}

Expand Down