File: packages/gui/src/daemon-client/client.ts:33
Severity: High
Description:
ensure_daemon may not finish spawning daemon before get_daemon_config reads config; race condition where config has stale/missing token if daemon writes config asynchronously.
Code:
await invoke('ensure_daemon');
return invoke<DaemonConfig>('get_daemon_config');
Failure Scenario:
- ensure_daemon spawns daemon process
- get_daemon_config immediately reads ~/.codepanion/config.json
- Daemon hasn't finished writing token to config yet
- GUI gets empty/stale token
- Subsequent API calls fail with 401 Unauthorized
Suggested Fix:
Make ensure_daemon wait for daemon health check AND config file write before returning, or return config directly from ensure_daemon instead of reading separately.
File: packages/gui/src/daemon-client/client.ts:33
Severity: High
Description:
ensure_daemon may not finish spawning daemon before get_daemon_config reads config; race condition where config has stale/missing token if daemon writes config asynchronously.
Code:
Failure Scenario:
Suggested Fix:
Make ensure_daemon wait for daemon health check AND config file write before returning, or return config directly from ensure_daemon instead of reading separately.