Skip to content

Bug: Preview Changes fails with 'Failed to get API session' error #2

Description

@jms830

Description

When clicking the "Preview Changes" button in the Sync tab, the operation fails immediately with an error message: "Sync failed: Failed to get API session"

Steps to Reproduce

  1. Open the Eidolon dashboard
  2. Navigate to the Sync tab
  3. Configure workspace (if not already done)
  4. Click the "Preview Changes" button
  5. Observe the error popup

Expected Behavior

The preview should show what changes would be synced (dry-run mode), displaying:

  • Which projects would be created/updated
  • Which files would be modified
  • Summary statistics

Actual Behavior

Error popup appears: "Sync failed: Failed to get API session"

Technical Details

  • File: entrypoints/dashboard/main.ts (line 1931-2027, syncNow() function)
  • The function requests API session via: browser.runtime.sendMessage({ action: 'get-api-client-session' })
  • Background service worker may not be properly initialized or session may be expired

Root Cause

The dashboard is running in a different context than the background service worker and may need to validate/refresh the session before attempting sync operations.

Suggested Fix

  1. Add session validation check before sync operations
  2. Implement session refresh mechanism
  3. Better error handling with user-friendly messages
  4. Consider caching session info in dashboard state after initial validation

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions