Browse Source

fix: add missing PluginConfig import; persist config in PersistedTask

- Add 'import type { PluginConfig } from ../config' to resolve merge
  conflict with master in background-manager.test.ts
- Add 'config: BackgroundTaskConfig' field to PersistedTask interface
  so restored tasks carry the real config instead of a hardcoded stub
- Update persistTask() to write config to disk
- Update loadPersistedTask() to read config from disk
Thomas Dyar 3 months ago
parent
commit
059bf47c5c
2 changed files with 9 additions and 2 deletions
  1. 1 0
      src/background/background-manager.test.ts
  2. 8 2
      src/background/background-manager.ts

+ 1 - 0
src/background/background-manager.test.ts

@@ -2,6 +2,7 @@ import * as fs from 'node:fs';
 import * as os from 'node:os';
 import * as path from 'node:path';
 import { afterEach, beforeEach, describe, expect, mock, test } from 'bun:test';
+import type { PluginConfig } from '../config';
 import { SLIM_INTERNAL_INITIATOR_MARKER } from '../utils';
 import { BackgroundTaskManager } from './background-manager';
 

+ 8 - 2
src/background/background-manager.ts

@@ -46,6 +46,7 @@ interface PersistedTask {
   description: string;
   agent: string;
   prompt: string;
+  config: BackgroundTaskConfig;
   status: BackgroundTask['status'];
   result?: string;
   error?: string;
@@ -64,13 +65,18 @@ function persistTask(task: BackgroundTask): void {
       description: task.description,
       agent: task.agent,
       prompt: task.prompt,
+      config: task.config,
       status: task.status,
       result: task.result,
       error: task.error,
       startedAt: task.startedAt.toISOString(),
       completedAt: task.completedAt?.toISOString(),
     };
-    fs.writeFileSync(path.join(dir, `${task.id}.json`), JSON.stringify(data), 'utf-8');
+    fs.writeFileSync(
+      path.join(dir, `${task.id}.json`),
+      JSON.stringify(data),
+      'utf-8',
+    );
   } catch (e) {
     log(`[background-manager] failed to persist task ${task.id}: ${e}`);
   }
@@ -92,7 +98,7 @@ function loadPersistedTask(taskId: string): BackgroundTask | null {
       startedAt: new Date(data.startedAt),
       completedAt: data.completedAt ? new Date(data.completedAt) : undefined,
       prompt: data.prompt,
-      config: { maxConcurrentStarts: 10 },
+      config: data.config,
     };
   } catch {
     return null;