Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(desktop): wait for channel status to settle before returning

Naiyuan Qing304c6a9bc67c
diff --git a/apps/desktop/src/main/ipc/channels.ts b/apps/desktop/src/main/ipc/channels.ts
index 4c77d0e362..c16f293b89 100644
--- a/apps/desktop/src/main/ipc/channels.ts
+++ b/apps/desktop/src/main/ipc/channels.ts
@@ -30,11 +30,22 @@ function maskToken(token: unknown): string | undefined {
export function registerChannelsIpcHandlers(): void {
/**
* List all channel account states (running / stopped / error).
+ * Waits for any "starting" status to settle before returning.
*/
ipcMain.handle('channels:listStates', async () => {
const hub = getCurrentHub()
if (!hub) return []
- return hub.channelManager.listAccountStates()
+
+ let states = hub.channelManager.listAccountStates()
+
+ // Wait for "starting" status to settle (max 3.5s, since internal timeout is 3s)
+ const start = Date.now()
+ while (states.some(s => s.status === 'starting') && Date.now() - start < 3500) {
+ await new Promise(r => setTimeout(r, 100))
+ states = hub.channelManager.listAccountStates()
+ }
+
+ return states
})
/**
diff --git a/apps/desktop/src/renderer/src/pages/agent/profile.tsx b/apps/desktop/src/renderer/src/pages/agent/profile.tsx
index 632116767d..37ac4f66db 100644
--- a/apps/desktop/src/renderer/src/pages/agent/profile.tsx
+++ b/apps/desktop/src/renderer/src/pages/agent/profile.tsx
@@ -26,7 +26,7 @@ export default function ProfilePage() {
const { providers, current, setProvider, refresh, loading: providerLoading } = useProviderStore()
const [profileLoading, setProfileLoading] = useState(true)
- const [saving, setSaving] = useState(false)
+ const [_saving, setSaving] = useState(false)
const [name, setName] = useState('')
const [userContent, setUserContent] = useState('')
const [hasChanges, setHasChanges] = useState(false)