Skip to content

Tasks not persisted across app restarts — TaskManager::load() never called #32

@mrchopme

Description

@mrchopme

Bug Description

Tasks created via the task board UI are written to disk as JSON files in the .codirigent/tasks/ directory, but they are not loaded back when Codirigent restarts. The task board starts empty every time.

Root Cause

In crates/codirigent-ui/src/workspace/gpui.rs, the init_task_manager() function creates a new TaskManager with TaskManager::new() but never calls TaskManager::load() to read existing task files from disk.

The load() method exists and works correctly — it reads all task-*.json files from the storage directory and enqueues them. It's just never invoked during app initialization.

Relevant code (gpui.rs:695-722):

fn init_task_manager(
    event_bus: Arc<DefaultEventBus>,
) -> (Arc<dyn codirigent_core::StorageService>, Arc<Mutex<TaskManager>>) {
    let data_dir = dirs::data_dir()
        .map(|d| d.join("Codirigent"))
        .unwrap_or_else(|| std::env::temp_dir().join("codirigent-fallback"));
    let storage = Arc::new(FileStorageService::new(&data_dir).unwrap_or_else(|e| {
        // ...
    }));

    let task_manager = Arc::new(Mutex::new(TaskManager::new(
        TaskManagerConfig::default(),
        storage.clone(),
        event_bus as Arc<dyn codirigent_core::EventBus>,
    )));
    // ← load() is never called here

    (storage, task_manager)
}

Steps to Reproduce

  1. Open Codirigent
  2. Create a task via the task board UI
  3. Quit Codirigent
  4. Reopen Codirigent
  5. Task board is empty

Expected Behavior

Tasks should persist across restarts. The task files exist on disk (~/Library/Application Support/Codirigent/.codirigent/tasks/task-*.json) and are intact — they're just never read back.

Suggested Fix

Call load() on the task manager after initialization. Since load() is marked async but contains no .await calls (it uses synchronous std::fs I/O), it can be called in a block_on context or spawned as a background task during startup.

Environment

  • macOS (Apple Silicon)
  • Codirigent v0.1.5 (installed via DMG)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions