Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
feat(rooms): run room jobs side by side by default
Bruno90c093d49265
diff --git a/docs/feature-flags.md b/docs/feature-flags.mdindex 4c2c1cbd32..9d03e54b86 100644--- a/docs/feature-flags.md+++ b/docs/feature-flags.md@@ -55,7 +55,7 @@ text and extra work can increase token usage.| `autoRecall` | On | Recalls matching memory passages into turns. | Recalled text uses context. Disabling this does not disable memory storage or upkeep; see [Memory](memory.md). || `skillsLibrary` | Off | Enables the shared skills store and its Skills settings. | Enables the library, not automatic conversation review. Skill use follows assignments and permissions. || `roomMemoryCapture` | Off | Lets memory upkeep also read a member bot's room turns. | Extends the material processed by memory upkeep. |-| `parallelRoomJobs` | Off | Runs jobs assigned to several room members side by side, each in its own thread. | Allows concurrent engine work rather than sequential jobs. |+| `parallelRoomJobs` | On | Runs jobs assigned to several room members side by side, each in its own thread. Set to `false` to run them one at a time in the room's thread. | Allows concurrent engine work rather than sequential jobs. || `acpPlanLines` | Off | Shows an ACP agent's plan as activity lines. | Each emitted line counts as a tool call wherever tool calls are counted; environment override below. || `agentsToolBridge` | Off, except eligible local-model turns | Lists a smaller tool catalog with `find_tool` and `use_tool`. | Tool lookup can add model calls; smaller initial context is not a guaranteed saving. See [Agents tool bridge](agents-tool-bridge.md) for eligibility and measurements. || `savedSteps` | On | Allows saving and repeating computer tasks from their steps on a supported host. | Currently requires a Mac server. Enabling it does not add host support. |diff --git a/docs/verification/room-coordination.md b/docs/verification/room-coordination.mdindex 29b91732ab..cfdda20ccf 100644--- a/docs/verification/room-coordination.md+++ b/docs/verification/room-coordination.md@@ -1,7 +1,7 @@# In-chat team coordinationIndependent bot conversations now dispatch as soon as a handoff is accepted;-speakers in the same group chat still serialize (and say so; with parallel room jobs on, several room jobs run side by side, see below). A Chief waiting for returned+speakers in the same group chat still serialize (and say so); room jobs sent to several members run side by side by default, see below. A Chief waiting for returnedresults exposes `waitingForTeammates: true`, not a fake active `busy` turn.The chat header shows **Teammates working**, leaves the composer usable andretains Stop. Explicit command-line `wait` still waits for the whole result.@@ -210,10 +210,11 @@ conversation.## Repeatable checks-### Same-room jobs take turns, and say so+### Same-room jobs take turns when parallel room jobs are off, and say so-Work handed to several members of one room runs in that room's thread one-member at a time. Nothing hides that any more:+With `features.parallelRoomJobs` set to `false`, work handed to several+members of one room runs in that room's thread one member at a time. Nothing+hides that any more:- Each `coordinate_bots` receipt that has to wait carries`queue: { position, of, waitingFor }` and a detail such as "queued 2 of 3@@ -233,17 +234,17 @@ pnpm exec vitest run server/room-queue.test.ts src/lib/room-threads.test.ts src/pnpm exec vitest run server/room-queue.e2e.test.ts -t "run in turn"```-The e2e test launches the isolated scripted fixture, has a Lead hand three-members work in one room, holds the first on a gate, and checks the Lead's-receipts and the room's `group` frames (2 of 3 and 3 of 3, both waiting on+The e2e test launches the isolated scripted fixture with the flag set to+`false`, has a Lead hand three members work in one room, holds the first on+a gate, and checks the Lead's receipts and the room's `group` frames (2 of 3 and 3 of 3, both waiting onthe first), then that the line clears once all three settle.-### Parallel room jobs (opt-in)+### Parallel room jobs (on by default)-With `features.parallelRoomJobs` on (`PATCH /api/config` with-`{"features": {"parallelRoomJobs": true}}`, or `config.json`), a-`coordinate_bots` call that sends work to two or more members of a room, or-into a room whose members already have jobs out, does not queue them in the+Unless `features.parallelRoomJobs` is `false` (`PATCH /api/config` with+`{"features": {"parallelRoomJobs": false}}`, or `config.json`), a+`coordinate_bots` call from inside a room that sends work to two or more of+its members, or more work while they already have jobs out, does not queue them in theroom's thread. Each job runs in a thread of its own on its member, opened bythe requester from the room (titled "<room> · <brief>", in the room'sworking folder), so the members work side by side:@@ -258,22 +259,27 @@ working folder), so the members work side by side:- A member who leaves the room stops its job ("no longer a member of thisroom"). Stop in the room drops the jobs that have not started; one alreadyrunning keeps its process and reports, as any teammate's thread does.+- Each job's turn carries the room's bulletin, as a turn in the room would.- Receipts say "runs in its own thread … in parallel with the other roomjobs", and the message says the results post back into the room.-A single job into a quiet room, a one-way notice, and every room with the-flag off keep running in the room's thread, in turn.+A single job into a quiet room, a one-way notice, work sent into another+room, and every room with the flag set to `false` keep running in the room's+thread, in turn, so the destination room shows them.```sh-pnpm exec vitest run server/room-queue.e2e.test.ts -t "parallel room jobs"+pnpm exec vitest run server/room-queue.e2e.test.ts -t "by default"+pnpm exec vitest run server/room-coordination.e2e.test.ts -t "another room"```-The e2e test turns the flag on in the isolated fixture, has a Lead send two-members a job and then a second job to the first, holds both first jobs on-gates and checks they are running at the same moment, each in its own thread,+The e2e test checks the flag is on by default in the isolated fixture, has a+Lead send two members a job and then a second job to the first, holds both+first jobs on gates and checks they are running at the same moment, each in its own thread,with the second job queued in the first member's thread. After release itchecks three result cards and three "Sent to" lines in the room, the-first member's two turns in one thread, and one resume of the Lead.+first member's two turns in one thread, and one resume of the Lead. Every+member turn must see the room's bulletin. The second test sends work to two+members of another room and checks both jobs ran in that room's thread.### Rooms that mix departmentsdiff --git a/server/chief-level-every-hop.e2e.test.ts b/server/chief-level-every-hop.e2e.test.tsindex 126d73c187..9bd4477cd1 100644--- a/server/chief-level-every-hop.e2e.test.ts+++ b/server/chief-level-every-hop.e2e.test.ts@@ -98,7 +98,8 @@ it("carries a Chief's level down every hop it hands out, in threads and in a rooconst roomAda = turnOf(ada.id, 2);const roomBea = turnOf(bea.id, 2);expect(roomAda.threadId).toBe(room.activeTaskId);- expect(roomBea.threadId).toBe(room.activeTaskId);+ // Ada's job is already out, so Bea's runs beside the room in a thread of her own.+ expect(roomBea.threadId).not.toBe(room.activeTaskId);expect(roomAda.permissionMode).toBe("auto");expect(roomBea.permissionMode, "the second hop in a room runs at the Chief's level too").toBe("auto");expect(await unanswered(room.activeTaskId)).toHaveLength(0);diff --git a/server/config.ts b/server/config.tsindex b6ab9b6eef..591cf898f1 100644--- a/server/config.ts+++ b/server/config.ts@@ -241,7 +241,7 @@ const featureConfigSchema = z.object({shareLearnedSkills: z.enum(["off", "ask", "auto"]).optional(),/** Memory upkeep also reads a member bot's room turns. Off unless true. */roomMemoryCapture: z.boolean().optional(),- /** Room jobs to several members run side by side, each in a thread of its own. Off unless true. */+ /** Room jobs to several members run side by side, each in a thread of its own. On unless false. */parallelRoomJobs: z.boolean().optional(),acpPlanLines: z.boolean().optional(), // An ACP agent's plan as activity lines. Off unless true.}).extend({ agentsToolBridge: z.boolean().optional(), savedSteps: z.boolean().optional(), usbPhoneTakeover: z.boolean().optional(), cloudComputerAutoReplace: z.boolean().optional(), phonePush: z.boolean().optional() }); // cloudComputerAutoReplace: delete and replace a dead cloud computer by itself, off unless true (OMB_CLOUD_COMPUTER_AUTO_REPLACE wins); agentsToolBridge: the find_tool / use_tool bridge, off unless true; savedSteps: repeat a computer task from its saved steps, on unless false; usbPhoneTakeover: watch and take over the bots' USB phone, off unless true; phonePush: wake a paired phone whose app is closed through the hosted push relay, off unless true (OMB_PHONE_PUSH wins)diff --git a/server/host/room-jobs.test.ts b/server/host/room-jobs.test.tsnew file mode 100644index 0000000000..83d590cf8f--- /dev/null+++ b/server/host/room-jobs.test.ts@@ -0,0 +1,37 @@+import { describe, expect, it } from "vitest";++import type { AppConfig } from "../config.ts";+import type { Store } from "../store.ts";+import { createRoomJobs, parallelRoomJobsEnabled } from "./room-jobs.ts";++// Room members work side by side unless the server opts out.+describe("parallelRoomJobsEnabled", () => {+ it("is on when the config leaves it out", () => {+ expect(parallelRoomJobsEnabled({} as AppConfig)).toBe(true);+ expect(parallelRoomJobsEnabled({ features: {} } as AppConfig)).toBe(true);+ });++ it("stays off when the config sets it to false", () => {+ expect(parallelRoomJobsEnabled({ features: { parallelRoomJobs: false } } as AppConfig)).toBe(false);+ });+});++describe("laneBulletin", () => {+ const rooms: Record<string, { name: string; bulletin: string }> = {+ "room-thread": { name: "Studio", bulletin: " Synthetic data only. " },+ "quiet-thread": { name: "Quiet", bulletin: "" },+ };+ const store = { groupByThread: (threadId: string) => rooms[threadId] } as unknown as Store;+ const lanes: Record<string, string> = { lane: "room-thread", "quiet-lane": "quiet-thread" };+ const { laneBulletin } = createRoomJobs({ store, coordinator: { all: () => [] }, cfg: {} as AppConfig,+ operations: () => [], speakerOf: () => undefined, laneRoomThread: n => lanes[n.threadId] });++ it("carries the room's bulletin into a job running beside it", () => {+ expect(laneBulletin({ botId: "b", threadId: "lane" })).toBe('Room bulletin of "Studio" (shared instructions for everyone):\nSynthetic data only.');+ });++ it("adds nothing for other threads or a room without a bulletin", () => {+ expect(laneBulletin({ botId: "b", threadId: "work" })).toBe("");+ expect(laneBulletin({ botId: "b", threadId: "quiet-lane" })).toBe("");+ });+});diff --git a/server/host/room-jobs.ts b/server/host/room-jobs.tsindex e100041e19..de223109e8 100644--- a/server/host/room-jobs.ts+++ b/server/host/room-jobs.ts@@ -19,7 +19,7 @@ export interface RoomJobsDeps {}export function parallelRoomJobsEnabled(cfg: AppConfig): boolean {- return cfg.features?.parallelRoomJobs === true;+ return cfg.features?.parallelRoomJobs !== false;}const live = (n: HandoffView) => n.parentId !== undefined && (n.status === "queued" || n.status === "running");@@ -54,6 +54,13 @@ export function createRoomJobs({ store, coordinator, cfg, operations, speakerOf,return jobs > 1 || coordinator.all().some(n => live(n) && (n.groupId === room.id ? n.threadId === roomThreadId : laneRoomThread(n) === roomThreadId));}+ // A job running beside its room still follows the room's shared instructions.+ function laneBulletin(n: Pick<HandoffView, "botId" | "threadId" | "groupId">): string {+ const room = store.groupByThread(laneRoomThread(n) ?? "");+ const bulletin = room?.bulletin.trim();+ return room && bulletin ? `Room bulletin of "${room.name}" (shared instructions for everyone):\n${bulletin}` : "";+ }+function openLane(room: GroupRecord, roomThreadId: string, botId: string, sender: { id: string; name: string }, brief: string) {const existing = store.workThread(botId, sender.id, roomThreadId, true);const snippet = brief.replace(/\s+/g, " ").trim().slice(0, 48);@@ -81,5 +88,5 @@ export function createRoomJobs({ store, coordinator, cfg, operations, speakerOf,return [parallel, sequential].filter(Boolean).join(" ");}- return { roomLineOf, advanceRound, useLanes, openLane, describeRoomJobs };+ return { roomLineOf, advanceRound, useLanes, laneBulletin, openLane, describeRoomJobs };}diff --git a/server/index.test.ts b/server/index.test.tsindex 7f09ba12d5..826247f314 100644--- a/server/index.test.ts+++ b/server/index.test.ts@@ -9886,7 +9886,7 @@ describe("harness HTTP API", () => {it("keeps skill authoring on by default and persists an explicit opt-out", async () => {const before = await api("GET", "/api/config");expect(before.status).toBe(200);- expect(before.body.features).toEqual({ browser: false, skillAuthoring: true, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: false, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: false, llmThreadTitles: true, savedSteps: true, savedStepsHere: process.platform === "darwin", usbPhoneTakeover: false });+ expect(before.body.features).toEqual({ browser: false, skillAuthoring: true, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: false, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, llmThreadTitles: true, savedSteps: true, savedStepsHere: process.platform === "darwin", usbPhoneTakeover: false });const untouched = JSON.parse(readFileSync(join(home, ".openmausbot", "config.json"), "utf8"));expect(untouched.features?.skillAuthoring).toBeUndefined();expect(untouched.features?.skillReview).toBeUndefined();@@ -9896,7 +9896,7 @@ describe("harness HTTP API", () => {features: { skillAuthoring: false },});expect(saved.status).toBe(200);- expect(saved.body.features).toEqual({ browser: false, skillAuthoring: false, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: false, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: false, llmThreadTitles: true, savedSteps: true, savedStepsHere: process.platform === "darwin", usbPhoneTakeover: false });+ expect(saved.body.features).toEqual({ browser: false, skillAuthoring: false, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: false, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, llmThreadTitles: true, savedSteps: true, savedStepsHere: process.platform === "darwin", usbPhoneTakeover: false });const disk = JSON.parse(readFileSync(join(home, ".openmausbot", "config.json"), "utf8"));// Earlier browser coverage may have persisted its own toggle: opting out must preserve sibling settings.@@ -9904,7 +9904,7 @@ describe("harness HTTP API", () => {const tools = await api("PATCH", "/api/config", { features: { showToolCalls: true } });expect(tools.status).toBe(200);- expect(tools.body.features).toEqual({ browser: false, skillAuthoring: false, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: true, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: false, llmThreadTitles: true, savedSteps: true, savedStepsHere: process.platform === "darwin", usbPhoneTakeover: false });+ expect(tools.body.features).toEqual({ browser: false, skillAuthoring: false, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: true, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, llmThreadTitles: true, savedSteps: true, savedStepsHere: process.platform === "darwin", usbPhoneTakeover: false });const bot = (await api("POST", "/api/bots", {})).body.bot;try {diff --git a/server/index.ts b/server/index.tsindex 952fb86125..e17486c070 100644--- a/server/index.ts+++ b/server/index.ts@@ -8391,7 +8391,7 @@ async function beginTurn(place: phones.place(threadId, !(commsDepth > 0 || opts?.automationSource !== undefined || opts?.unattended || opts?.peerAsk || opts?.coordination)),}),{ id: "coordination", label: "Team and who is speaking", text: PROVENANCE_PROMPT + (coordinationPrompt && !apiFenced ? ` ${coordinationPrompt}` : "") },- { id: "assignment", label: "Teammate task", text: coordinationNode?.parentId ? `\n${coordinationSystemInstructions()}` : "" },+ { id: "assignment", label: "Teammate task", text: coordinationNode?.parentId ? `\n${[coordinationSystemInstructions(), roomJobs.laneBulletin(coordinationNode)].filter(Boolean).join("\n")}` : "" },{ id: "outstanding", label: "Outstanding teammate work", text: teammatePrompts.outstanding(threadId) },{ id: "teammate-questions", label: "Teammates' questions to the person", text: teammatePrompts.questions(liveBot ?? bot, threadId) },{ id: "credential", label: "Credentials", text: credentialPrompt }, { id: "just-do-it", label: "Just do it", text: approvalModeForTurn(bot, commsDepth > 0, threadId) === "full" && !isUnattended(bot.id, threadId) && coordinationNode?.origin?.kind !== "outside" ? JUST_DO_IT_PROMPT : "" },@@ -13682,7 +13682,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {const mode: NonNullable<HandoffOptions["mode"]> = call.consult ? "consult" : call.reply === "none" ? "notify" : "work";const reply: NonNullable<HandoffOptions["reply"]> = call.reply === "none" ? "none" : EXTERNAL ? "poll" : "resume";const returns = reply === "none" ? "nothing comes back from it" : reply === "poll" ? "read its result with assignment_status" : "its result will resume you";- const inRoom = targets.filter(target => target.groupId).length, lanes = inRoom > 0 && roomJobs.useLanes(destination!, roomThreadId!, inRoom, mode);+ const inRoom = targets.filter(target => target.groupId).length, lanes = inRoom > 0 && Boolean(addressedRoom?.here) && roomJobs.useLanes(destination!, roomThreadId!, inRoom, mode);const receipts: PeerDeliveryReceipt[] = [];const refused: string[] = [];const answeredForPerson = new Set<PeerDeliveryReceipt>();diff --git a/server/room-coordination.e2e.test.ts b/server/room-coordination.e2e.test.tsindex 9e88e762dd..8abd8c7b76 100644--- a/server/room-coordination.e2e.test.ts+++ b/server/room-coordination.e2e.test.ts@@ -58,6 +58,12 @@ async function addSupervisingChief(f: any, section = "") {return chief;}+// These checks cover jobs taking turns in the room's own thread, so they turn+// parallel room jobs off.+async function jobsTakeTurns(f: any) {+ expect((await f.api("/api/config", { features: { parallelRoomJobs: false } }, "PATCH")).features.parallelRoomJobs).toBe(false);+}+// A result is withheld when the server revalidates the running child, so keep the child held until that has failed it.async function releaseAfterWithhold(f: any, gateFile: string) {await expect.poll(() => f.nodes().find((n: any) => n.parentId)?.status, { timeout: 30_000 }).toBe("failed");@@ -65,6 +71,7 @@ async function releaseAfterWithhold(f: any, gateFile: string) {}it.each(["", "Leadership"])("lists and coordinates with a supervising Chief and same-section peer in the same room (Chief section %j)", section => withRooms(async f => {+ await jobsTakeTurns(f);const chief = await addSupervisingChief(f, section);f.plan[f.sender.id].steps = [{ arguments: { bot_ids: [chief.id, f.target.id], message: "Review the work here" } }];f.plan[f.target.id] = { reply: "Built CSV", expectContextIncludes: ["[LIVE TEAMMATES]", `[id: ${f.sender.id}]`] };@@ -77,6 +84,7 @@ it.each(["", "Leadership"])("lists and coordinates with a supervising Chief and}), 45_000);it("coordinates in a room that mixes departments, with a Chief that manages none of them", () => withRooms(async f => {+ await jobsTakeTurns(f);const chief = await addSupervisingChief(f);await f.api(`/api/bots/${chief.id}`, { managedSections: [] }, "PATCH");const outsider = (await f.cli("new-bot", "--name", "Outsider", "--section", "Finance")).bot;@@ -292,6 +300,7 @@ it("pins a busy destination's task even when its active task changes", () => witexpect(created.success).toBe(true);}), 45_000);it("consults multiple existing members and returns once, with no discussion prerequisite or new room settings", () => withRooms(async f => {+ await jobsTakeTurns(f);const reviewer = (await f.cli("new-bot", "--name", "Reviewer", "--section", "A")).bot;await f.tool("update_channel", { channel_id: f.source.id, member_ids: [f.sender.id, f.target.id, reviewer.id] });f.plan[f.sender.id].steps = [{ arguments: { bot_ids: [f.target.id, reviewer.id], message: "Give one risk from your role" } }];@@ -395,13 +404,27 @@ it("does not repeat a shared brief or rerun recipients on an identical tool retrf.plan[f.sender.id].steps = [{ arguments: args }, { arguments: args }];f.plan[reviewer.id] = { reply: "Release checklist reviewed" };await f.start(); expect((await f.wait()).status).toBe("settled");- const requests = (await f.messages(f.source.activeTaskId)).filter((m: any) => m.roomRequest?.phase === "request");- expect(requests).toHaveLength(1);- expect(requests[0].text).toBe("@Engineer @Reviewer Review the release checklist");- expect(f.provider().map((turn: any) => turn.botId)).toEqual([f.sender.id, f.target.id, reviewer.id, f.sender.id]);+ expect(f.handoffs().map((n: any) => n.botId).sort()).toEqual([f.target.id, reviewer.id].sort());+ const turns = f.provider().map((turn: any) => turn.botId);+ expect([turns[0], turns.at(-1)]).toEqual([f.sender.id, f.sender.id]);+ expect(turns.slice(1, -1).sort()).toEqual([f.target.id, reviewer.id].sort());+ const retry = JSON.parse(f.provider()[0].evidence.filter((e: any) => e.step)[1].response.result.content[0].text);+ expect(retry.receipts.every((r: any) => r.detail.startsWith("already sent"))).toBe(true);+}), 45_000);++it("keeps work sent to several members of another room in that room's thread", () => withRooms(async f => {+ const reviewer = (await f.cli("new-bot", "--name", "Reviewer", "--section", "A")).bot;+ await f.tool("update_channel", { channel_id: f.destination.id, member_ids: [f.target.id, reviewer.id] });+ f.plan[f.sender.id].steps = [{ arguments: { group_id: f.destination.id, bot_ids: [f.target.id, reviewer.id], message: "Review the export" } }];+ f.plan[reviewer.id] = { reply: "Export reviewed" };+ await f.start(); expect((await f.wait()).status).toBe("settled");+ expect(f.handoffs().every((n: any) => n.status === "completed" && n.groupId === f.destination.id && n.threadId === f.destination.activeTaskId)).toBe(true);+ const requests = (await f.messages(f.destination.activeTaskId)).filter((m: any) => m.roomRequest?.phase === "request");+ expect(requests.map((m: any) => m.text)).toEqual(["@Engineer @Reviewer Review the export"]);}), 45_000);it("keeps genuinely different room briefs separate", () => withRooms(async f => {+ await jobsTakeTurns(f);const reviewer = (await f.cli("new-bot", "--name", "Reviewer", "--section", "A")).bot;await f.tool("update_channel", { channel_id: f.source.id, member_ids: [f.sender.id, f.target.id, reviewer.id] });f.plan[f.sender.id].steps = [diff --git a/server/room-queue.e2e.test.ts b/server/room-queue.e2e.test.tsindex 4013bd252c..34e5725f21 100644--- a/server/room-queue.e2e.test.ts+++ b/server/room-queue.e2e.test.ts@@ -1,7 +1,8 @@-// Same-room jobs take turns. A requester that sends several members work in-// one room is told they run one at a time and where each one stands, and the-// room itself shows who waits on whom ("Queued · waiting for X (2 of 3)"),-// on an isolated fixture with the real coordination proxy.+// Same-room jobs run side by side by default. With parallel room jobs turned+// off, a requester that sends several members work in one room is told they+// run one at a time and where each one stands, and the room itself shows who+// waits on whom ("Queued · waiting for X (2 of 3)"), on an isolated fixture+// with the real coordination proxy.import { existsSync, readFileSync, writeFileSync } from "node:fs";import { join } from "node:path";import { expect, it } from "vitest";@@ -10,13 +11,15 @@ import { handleToolCall, request } from "../scripts/mcp-server.ts";import { readHandoffs } from "./testing/handoff-rows.ts";import { openSse } from "./testing/sse.ts";-it("tells the requester and the room that three same-room jobs run in turn", async () => {+it("with parallel room jobs off, tells the requester and the room that three same-room jobs run in turn", async () => {const session = await launchVerificationServer(process.env, undefined, undefined, undefined, undefined, { scripted: true });const env = { OPENMAUSBOT_URL: session.info.url };const cli = (...args: string[]) => runControlOmb(args, { env }) as Promise<any>;+ const api = (path: string, body?: unknown, method = "POST") => request(path, body === undefined ? {} : { method, headers: { Origin: session.info.url }, body: JSON.stringify(body) }, session.info.url) as Promise<any>;const tool = (name: string, args: Record<string, unknown>) => handleToolCall(name, args, (path, options) => request(path, options, session.info.url)) as Promise<any>;const events = await openSse(`${session.info.url}/api/events`, { Origin: session.info.url });try {+ expect((await api("/api/config", { features: { parallelRoomJobs: false } }, "PATCH")).features.parallelRoomJobs).toBe(false);const lead = (await cli("new-bot", "--name", "Lead", "--section", "A")).bot;const workers: any[] = [];for (const name of ["First", "Second", "Third"]) workers.push((await cli("new-bot", "--name", name, "--section", "A")).bot);@@ -90,20 +93,22 @@ it("shows a round of @mentioned members waiting on the one replying", async () =}}, 90_000);-it("with parallel room jobs on, runs each member's job in its own thread at once and posts the results back into the room", async () => {+it("by default, runs each member's job in its own thread at once and posts the results back into the room", async () => {const session = await launchVerificationServer(process.env, undefined, undefined, undefined, undefined, { scripted: true });const env = { OPENMAUSBOT_URL: session.info.url };const cli = (...args: string[]) => runControlOmb(args, { env }) as Promise<any>;const api = (path: string, body?: unknown, method = "POST") => request(path, body === undefined ? {} : { method, headers: { Origin: session.info.url }, body: JSON.stringify(body) }, session.info.url) as Promise<any>;const tool = (name: string, args: Record<string, unknown>) => handleToolCall(name, args, (path, options) => request(path, options, session.info.url)) as Promise<any>;try {- expect((await api("/api/config", { features: { parallelRoomJobs: true } }, "PATCH")).features.parallelRoomJobs).toBe(true);+ expect((await api("/api/config")).features.parallelRoomJobs).toBe(true);const lead = (await cli("new-bot", "--name", "Lead", "--section", "A")).bot;const first = (await cli("new-bot", "--name", "First", "--section", "A")).bot;const second = (await cli("new-bot", "--name", "Second", "--section", "A")).bot;- const room = (await tool("create_channel", { name: "Studio", member_ids: [lead.id, first.id, second.id] })).channel;+ const room = (await tool("create_channel", { name: "Studio", member_ids: [lead.id, first.id, second.id], bulletin: "SYNTHETIC_DATA_ONLY" })).channel;const planPath = join(session.info.dataDir, "room-plan.json");const file = (name: string) => join(session.info.dataDir, name);+ // Each job runs beside the room but still gets the room's bulletin.+ const bulletin = ["SYNTHETIC_DATA_ONLY"];writeFileSync(planPath, JSON.stringify({[lead.id]: {steps: [@@ -115,10 +120,10 @@ it("with parallel room jobs on, runs each member's job in its own thread at oncereply: "Assigned", resumeReply: "All parts reviewed",},[first.id]: { turns: [- { reply: "First part cut", gateFile: file("first.gate"), readyFile: file("first.ready") },- { reply: "Trailer cut" },+ { reply: "First part cut", gateFile: file("first.gate"), readyFile: file("first.ready"), expectContextIncludes: bulletin },+ { reply: "Trailer cut", expectContextIncludes: bulletin },] },- [second.id]: { reply: "Second part cut", gateFile: file("second.gate"), readyFile: file("second.ready") },+ [second.id]: { reply: "Second part cut", gateFile: file("second.gate"), readyFile: file("second.ready"), expectContextIncludes: bulletin },}));await cli("send-channel", "--channel", room.id, "--text", "@Lead Split the work");// Both members are mid-job at the same moment: neither waits on the other.