Preserve worker binding through the existing solo transition

This commit is contained in:
wassname2
2026-09-15 17:37:57 +08:00
parent ed050658e3
commit 8ca35bce33
2 changed files with 4 additions and 4 deletions
+1 -3
View File
@@ -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
View File
@@ -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");