Skip to content

[GUI] ensureDaemon race condition with config reading #61

@Vantalens

Description

@Vantalens

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingguiGUI/frontend related issueshigh-priorityHigh priority issuesjavascriptPull requests that update javascript code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions