mirror of
https://github.com/wassname/pi-plan.git
synced 2026-09-26 14:10:23 +08:00
Preserve worker binding through the existing solo transition
This commit is contained in:
+1
-3
@@ -697,9 +697,7 @@ export default function mainSupervisor(pi: ExtensionAPI) {
|
||||
}
|
||||
const noted = /^-\s*worker session:\s*(\S+)/im.exec(foldPlan(text))?.[1];
|
||||
if (!(await confirmOwnership(ctx, target, text))) return;
|
||||
const worker = noted ? { sessionFile: resolve(ctx.cwd, noted) } : state.workerStopped ? state.worker : undefined;
|
||||
state = { mode: "solo", plan: target, worker, workerStopped: true };
|
||||
generation++; notice = true; fullPlanContextDue = true; save(); refresh(ctx); watchPlan(ctx);
|
||||
if (noted && !state.worker) state.worker = { sessionFile: resolve(ctx.cwd, noted) };
|
||||
enterSolo(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
+3
-1
@@ -665,7 +665,9 @@ it("external attach solo cannot turn a noted worker or stop checkbox into owners
|
||||
it("retains current solo authority and stopped-session reference when external adoption is blocked", async () => {
|
||||
const f = fixture(); await f.draft(); await f.command("ready");
|
||||
await f.launch({ id: "child", sessionFile: "/tmp/prior.jsonl" });
|
||||
f.ctx.ui.select.mockResolvedValueOnce("Worker confirmed stopped"); await f.command("solo");
|
||||
const binding = f.entries.at(-1).data.worker;
|
||||
f.ctx.ui.select.mockResolvedValueOnce("Worker confirmed stopped"); await f.command(`attach ${f.path} solo`);
|
||||
expect(f.entries.at(-1).data.worker).toEqual(binding);
|
||||
const other = join(f.ctx.cwd, "another.md"); writeFileSync(other, "- [ ] goal: next\n## Log\n");
|
||||
const before = f.entries.at(-1), messageCount = f.messages.length;
|
||||
f.ctx.ui.select.mockResolvedValueOnce("Previous supervisor confirmed stopped");
|
||||
|
||||
Reference in New Issue
Block a user