salvage 2026-11-06: uncommitted work from scratch/researcher/q140 (disk cleanup #824)

This commit is contained in:
mos committed 2026-11-06 10:05:25 -06:00
1 parent df5bbfb82a
commit ffcb567003
11 files changed
+354 -5

No files matched your search

+34
View File
@@ -291,6 +291,40 @@ test("the chief of staff launches a coder through its launch tool; the coder ans
assert.ok(readSessions(f.dataRoot).some((s) => s.run === chief.run));
});
// Row 140 (#1634, REQ-COS-1): the pm asks the chief of staff for staff through request_staff, over the real
// tool socket; the request grants no launch, and the chief's launches stay inside the organization's limits.
test("a launched pm's request_staff reaches the chief of staff; no other session has the tool and the launch limits still hold", { skip, timeout: 60000 }, async (t) => {
const { f, launcher, client, cto } = await setup(t, (doc) => {
doc.roles.pm.vars = { harness: "pi", model: "claude-sonnet-5-5" };
doc.launch.instances.push("pm");
doc.launch.limits.models.zai["claude-sonnet-5-5"] = 2;
return doc;
});
const sock = launchSocketPath(f.dataRoot);
await launcher.launchPm();
const call = async (to, body) => {
const sent = await client.call("message.send", { to, class: "REQUEST", body });
return until(async () => (await client.call("message.receive")).find((m) => m.in_reply_to === sent.id));
};
// The chief launches the pm within its limits, and the pm holds request_staff.
assert.equal(JSON.parse((await call("chief", 'TOOL launch {"instance":"pm"}')).body).instance, "pm");
const ask1 = await call("pm", `TOOL request_staff ${JSON.stringify({ task_ref: "vikunja:1/2", roles: [{ role: "coder", count: 1 }, { role: "reviewer", count: 1 }], note: "build and review" })}`);
assert.equal(ask1.from_role, "pm");
assert.equal(JSON.parse(ask1.body).to, "chief");
// A refusal from the broker comes back as the tool's error, the same path any typed tool takes.
const bad = await call("pm", `TOOL request_staff ${JSON.stringify({ task_ref: "vikunja:1/2", roles: [{ role: "coder", count: 0 }] })}`);
assert.match(bad.body, /invalid-request/);
// The chief of staff has no request_staff, and a pm has no launch.
assert.equal((await call("chief", 'TOOL request_staff {"task_ref":"vikunja:1/2","roles":[{"role":"coder","count":1}]}')).body, "refused: unknown-tool");
assert.equal((await call("pm", 'TOOL launch {"instance":"coder"}')).body, "refused: unknown-tool");
// Nothing was launched by asking: the chief of staff's limits are the same, and sonnet has one place left.
assert.deepEqual(readSessions(f.dataRoot).map((s) => s.instance).sort(), ["chief", "pm"]);
const launched = await call("chief", 'TOOL launch {"instance":"coder"}');
assert.equal(JSON.parse(launched.body).instance, "coder");
assert.deepEqual(await ask(sock, `${JSON.stringify({ cap: cto.cap, instance: "reviewer" })}\n`), { ok: false, error: "capacity-full" });
assert.equal(log(f).filter((e) => e.event === "launch" && e.launchedBy === "pm").length, 0);
});
// Row 91 (#1585): the project clone in each workspace.
// Row 117 (#1611): and a dirty one is fetched, not merged, and logged.
test("each launch makes sure the workspace has a clone of the project: cloned, fast-forwarded, or fetched and logged", { skip, timeout: 60000 }, async (t) => {