Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

feat(threads): name a thread a teammate opened from the job it was handed

AdityaUmale9ed8f0700357
diff --git a/docs/verification/room-coordination.md b/docs/verification/room-coordination.md
index b69ca2d1c0..d0476c1443 100644
--- a/docs/verification/room-coordination.md
+++ b/docs/verification/room-coordination.md
@@ -135,7 +135,9 @@ rows for every hand-off it checks (a refused call leaves no hand-off row; a
restart leaves the sender's root resumed once, never rerun).
Outside a room, a conversation has one thread with each recipient, titled
-“@Clive · work”. The first request opens it; every later request from that
+“@Clive · work” until the recipient's model names it from the first request
+(“@Clive · CSV export build”; a new thread the sender did not name gets the
+title alone). The first request opens it; every later request from that
conversation — a follow-up, a change of plan, rework — goes into it, so the
recipient has the earlier work in its own history. If the recipient is still
working there on what the sender handed it before, the request goes into that
diff --git a/server/bot-link/link.test.ts b/server/bot-link/link.test.ts
index fa5adcd12d..1a3010ca0e 100644
--- a/server/bot-link/link.test.ts
+++ b/server/bot-link/link.test.ts
@@ -42,6 +42,8 @@ const call = (botIds: string[], message: string, more: Partial<CoordinateBotsCal
function place(label: string, bots: Bot[], version?: number) {
const dir = mkdtempSync(join(tmpdir(), `bot-link-${label}-`));
const threads = new Set<string>();
+ /** Each work thread this place opened for a far bot: the job it was opened with names it. */
+ const opened: Array<{ threadId: string; title: string; from: string; brief: string }> = [];
const runs: Array<{ botId: string; threadId: string; text: string; resumed: boolean; requester: string; origin: unknown }> = [];
const sent: Array<{ recipient: string; threadId: string; roomId?: string }> = [];
const results: Array<{ thread: string; name: string; status: string; result: string }> = [];
@@ -85,7 +87,7 @@ function place(label: string, bots: Bot[], version?: number) {
patchGroup: (id: string, patch: { memberIds?: string[] }) => { const group = groups.find((one) => one.id === id); if (group && patch.memberIds) group.memberIds = patch.memberIds; return group ?? null; },
};
let coordinator!: Coordinator, link!: BotLink, dialer!: ReturnType<typeof createDialer>, ticker: NodeJS.Timeout | undefined, http: Server | undefined;
- let opened = 0, port = 0, generation = 0, skew = 0, minted = 0, directoryChanges = 0;
+ let openedCount = 0, port = 0, generation = 0, skew = 0, minted = 0, directoryChanges = 0;
const sockets = new Set<import("node:net").Socket>();
function boot(options: { limits?: { queueMs?: number; stallMs?: number } } = {}) {
@@ -96,7 +98,7 @@ function place(label: string, bots: Bot[], version?: number) {
link = createBotLink({
rooms, directoryChanged: () => { directoryChanges += 1; rooms.sync(); },
dataDir: dir, coordinator: () => coordinator, bots: () => bots, bot: (id) => bots.find((bot) => bot.id === id), level: () => "full",
- openThread: (bot) => { const id = `${bot.id}-work-${++opened}`; threads.add(id); return id; },
+ openThread: (bot, title, opener, brief) => { const id = `${bot.id}-work-${++openedCount}`; threads.add(id); opened.push({ threadId: id, title, from: opener.name, brief }); return id; },
hasThread: (_botId, threadId) => threads.has(threadId), personName: () => "Sam",
sentRow: (input) => { sent.push({ recipient: input.recipient.name, threadId: input.threadId, ...(input.roomId ? { roomId: input.roomId } : {}) }); },
resultRow: (parent, child, name) => { results.push({ thread: parent.threadId, name, status: child.status, result: child.result }); },
@@ -178,7 +180,7 @@ function place(label: string, bots: Bot[], version?: number) {
}
const api = {
- dir, bots, runs, sent, results, requests, boot, listen, unplug, shutdown, handOff, keep, ledger,
+ dir, bots, runs, sent, results, requests, opened, boot, listen, unplug, shutdown, handOff, keep, ledger,
failOnce: (match: RegExp, status = 500) => { failing.push({ match, status }); },
/** What an assignment here carries one way: who it is from and each file's name and words. */
carries: (id: string, way: "sent" | "returned") => { const batch = ledger.get(`${id}:${way}`); return batch ? { from: batch.from.name, files: batch.files.map((file) => [file.name, readFileSync(file.path, "utf8")]) } : undefined; },
@@ -380,6 +382,7 @@ describe("the link between a computer and its Cloud", () => {
await computer.handOff("local-writer", call(["Analyst"], "Now the refunds"));
await until(() => computer.results.length === 2, "the second result is back");
expect(cloud.runs.filter((run) => run.botId === "cloud-analyst").map((run) => run.threadId)).toEqual(["cloud-analyst-work-1", "cloud-analyst-work-1"]);
+ expect(cloud.opened).toEqual([{ threadId: "cloud-analyst-work-1", title: "@Writer · work", from: "Writer", brief: "Count the orders" }]);
});
it("a call that got one instruction-only local refusal and one real refusal from the other place fails, and says why", async () => {
diff --git a/server/bot-link/link.ts b/server/bot-link/link.ts
index 1cce865621..225d4bf02e 100644
--- a/server/bot-link/link.ts
+++ b/server/bot-link/link.ts
@@ -116,7 +116,7 @@ export interface BotLinkDeps {
model?(bot: LocalBot): string | undefined;
level(bot: LocalBot): Level;
/** Opens the thread another place's work runs in, and returns its id. */
- openThread(bot: LocalBot, title: string, opener: { botId: string; name: string; threadId: string }): string | undefined;
+ openThread(bot: LocalBot, title: string, opener: { botId: string; name: string; threadId: string }, brief: string): string | undefined;
hasThread(botId: string, threadId: string): boolean;
personName(threadId: string): string | undefined;
/** "Sent to …" in the requester's conversation. */
@@ -470,7 +470,7 @@ export function createBotLink(deps: BotLinkDeps) {
const key = `${peer}:${frame.thread}`;
let threadId = state.threads[key]?.threadId;
if (!threadId || !deps.hasThread(bot.id, threadId)) {
- const opened = deps.openThread(bot, `@${frame.from.name} · work`, { botId: address.botId, name: frame.from.name, threadId: address.threadId });
+ const opened = deps.openThread(bot, `@${frame.from.name} · work`, { botId: address.botId, name: frame.from.name, threadId: address.threadId }, frame.text);
if (!opened) throw new Error("That bot is no longer here.");
threadId = opened;
}
diff --git a/server/delta-context.e2e.test.ts b/server/delta-context.e2e.test.ts
index a4c9f94dc1..a74c92c00f 100644
--- a/server/delta-context.e2e.test.ts
+++ b/server/delta-context.e2e.test.ts
@@ -655,6 +655,8 @@ it.each(["SIGTERM", "SIGKILL"] as const)("runs each teammate turn a restart cut
// Only a turn's POST carries a body; the Ollama probe GETs /api/version first (ollama-context.ts).
if (req.method !== "POST") { res.writeHead(404); res.end(); return; }
for await (const chunk of req) body += chunk;
+ // Naming a work thread a hand-off opened is a one-shot of its own, not a step of any turn here: it gets no title.
+ if (body.includes("Reply with only a short title")) { res.writeHead(404); res.end(); return; }
const content = JSON.parse(body).messages.filter((m: any) => m.role === "user").at(-1)?.content;
chats.push(typeof content === "string" ? content : JSON.stringify(content));
if (chats.length === 1) return;
diff --git a/server/direct-coordination.e2e.test.ts b/server/direct-coordination.e2e.test.ts
index 03dc76a5ea..0742b9d68a 100644
--- a/server/direct-coordination.e2e.test.ts
+++ b/server/direct-coordination.e2e.test.ts
@@ -976,9 +976,12 @@ it("gives a teammate each request once, never also as a bare assistant line", ()
/** The Engineering lead on a loopback OpenAI-compatible engine where `answer` replies to every chat request. */
async function onLoopbackEngine(f: any, answer: (res: ServerResponse) => void): Promise<() => Promise<void>> {
const llm = createServer(async (req, res) => {
- for await (const _ of req) {}
+ let body = "";
+ for await (const chunk of req) body += chunk;
// The chat engine asks a local server whether it is Ollama (/api/version); this one is not, and that is no model call.
if (req.url?.endsWith("/api/version")) { res.statusCode = 404; res.end(); return; }
+ // Naming the work thread the hand-off opened is a one-shot of its own, not a step of the turn: it gets no title.
+ if (body.includes("Reply with only a short title")) { res.statusCode = 404; res.end(); return; }
if (req.url?.endsWith("/models")) { res.setHeader("content-type", "application/json"); res.end(JSON.stringify({ data: [{ id: "loop-model" }] })); return; }
answer(res);
});
@@ -1073,6 +1076,49 @@ it("tells the Chief a teammate's turn stopped because its engine's settings chan
expect(resumed.prompt.message.content).not.toContain("The coordinated turn was interrupted");
}), 45_000);
+// Each title reply is keyed to the job it names, so a thread named from the wrong message would show it.
+const titledHandoffs = () => {
+ const routes = join(mkdtempSync(join(tmpdir(), "omb-handed-title-")), "routes.json");
+ writeFileSync(routes, JSON.stringify({
+ "Message:\nImplement the CSV export": "CSV export build",
+ "Message:\nAdd the header row": "Header row follow-up",
+ "Message:\nSpec the PDF export": "PDF export spec",
+ "Message:\nRun the release QA": "Named by the model",
+ }));
+ return { FAKE_CLAUDE_TEXT_ROUTES: routes };
+};
+
+it("names a thread a teammate opened from the job it was handed, once, unless the sender named it", () => fixture(async f => {
+ f.plan[f.lead.id] = { turns: [{ reply: "Export implemented" }, { reply: "Header row added" }] };
+ f.plan[f.specialist.id] = { turns: [{ reply: "PDF spec written" }, { reply: "QA passed" }] };
+ f.plan[f.chief.id] = { turns: [
+ { steps: [{ arguments: { bot_ids: [f.lead.id], message: "Implement the CSV export" } }], reply: "Assigned the build" },
+ { reply: "The export is implemented" },
+ { steps: [{ arguments: { bot_ids: [f.lead.id], message: "Add the header row to that export" } }], reply: "Assigned the header row" },
+ { reply: "The header row is in" },
+ { steps: [
+ { arguments: { bot_ids: [f.specialist.id], message: "Spec the PDF export", thread: "new", reply: "none" } },
+ { arguments: { bot_ids: [f.specialist.id], message: "Run the release QA", thread: "new", title: "Release QA", reply: "none" } },
+ ], reply: "Sent both" },
+ ] };
+ f.save();
+ const send = async (text: string) => {
+ await f.cli("send", "--bot", f.chief.id, "--task", f.chief.activeTaskId, "--text", text);
+ expect((await f.wait()).status).toBe("settled");
+ };
+ const tasksOf = async (botId: string) => (await f.api("/api/bots")).bots.find((bot: any) => bot.id === botId).tasks;
+ await send("Ask Engineering to build the CSV export.");
+ const work = (await tasksOf(f.lead.id)).find((task: any) => task.openedBy?.kind === "work");
+ await expect.poll(async () => (await tasksOf(f.lead.id)).find((task: any) => task.threadId === work.threadId)?.title, { timeout: 15_000 })
+ .toBe("@Clive · CSV export build");
+ await send("Now ask them to add the header row.");
+ await send("Now have Reviewer spec the PDF export and run the release QA.");
+ await expect.poll(async () => (await tasksOf(f.specialist.id)).map((task: any) => task.title), { timeout: 15_000 })
+ .toEqual(expect.arrayContaining(["PDF export spec", "Release QA"]));
+ expect((await tasksOf(f.lead.id)).find((task: any) => task.threadId === work.threadId).title).toBe("@Clive · CSV export build");
+ expect((await tasksOf(f.specialist.id)).map((task: any) => task.title)).not.toContain("Named by the model");
+}, titledHandoffs()), 90_000);
+
// The small model's word is the fixture's: what matters here is what the runtime does with it.
const withStatusAnswer = (answer: string) => {
const routes = join(mkdtempSync(join(tmpdir(), "omb-status-reply-")), "routes.json");
diff --git a/server/host/bot-link-host.ts b/server/host/bot-link-host.ts
index 3f0ebaad4e..885ce74c0e 100644
--- a/server/host/bot-link-host.ts
+++ b/server/host/bot-link-host.ts
@@ -31,6 +31,8 @@ export interface BotLinkHostDeps {
coordinator(): Coordinator;
kick(): void;
level(bot: BotRecord): Level;
+ /** A work thread a far bot opened here is named from the job it handed, behind "@Sender · ". */
+ titleHanded?(botId: string, threadId: string, brief: string, prefix: string): void;
refusal(bot: BotRecord): string | null;
language(threadId: string): string | undefined;
personName(threadId: string): string | undefined;
@@ -81,7 +83,11 @@ export function createBotLinkHost(deps: BotLinkHostDeps) {
refusal: (bot) => deps.refusal(bot as BotRecord),
model: (bot) => (bot as BotRecord).modelSelection.model,
level: (bot) => deps.level(bot as BotRecord),
- openThread: (bot, title, opener) => store.createTask(bot.id, title, false, undefined, { ...opener, at: Date.now(), kind: "work" })?.threadId,
+ openThread: (bot, title, opener, brief) => {
+ const threadId = store.createTask(bot.id, title, false, undefined, { ...opener, at: Date.now(), kind: "work" })?.threadId;
+ if (threadId) deps.titleHanded?.(bot.id, threadId, brief, `@${opener.name} · `);
+ return threadId;
+ },
hasThread: (botId, threadId) => Boolean(store.taskByThread(botId, threadId)),
personName: deps.personName,
files: {
diff --git a/server/host/handed-thread-title.test.ts b/server/host/handed-thread-title.test.ts
new file mode 100644
index 0000000000..255ec8caf0
--- /dev/null
+++ b/server/host/handed-thread-title.test.ts
@@ -0,0 +1,52 @@
+import { describe, expect, it, vi } from "vitest";
+import type { BotRecord, TaskRecord } from "../store.ts";
+import { createHandedThreadTitle } from "./handed-thread-title.ts";
+
+function place(options: { gate?: boolean; answer?: string | null; renamedTo?: string } = {}) {
+ const tasks = new Map<string, { title: string }>([["work-1", { title: "@Clive · work" }]]);
+ const generate = vi.fn(async () => {
+ if (options.renamedTo) tasks.get("work-1")!.title = options.renamedTo;
+ return options.answer === undefined ? "CSV export build" : options.answer;
+ });
+ const title = createHandedThreadTitle({
+ store: {
+ bot: (id) => (id === "dana" ? ({ id } as BotRecord) : null),
+ taskByThread: (_botId, threadId) => tasks.get(threadId) as TaskRecord | undefined,
+ retitleTask: (_botId, threadId, machineTitle, next) => {
+ const task = tasks.get(threadId);
+ if (!task || task.title !== machineTitle) return null;
+ task.title = next;
+ return task as TaskRecord;
+ },
+ },
+ gate: () => (options.gate === false ? { ok: false } : { ok: true, instance: {} }),
+ generate,
+ });
+ return { title, generate, titleOf: () => tasks.get("work-1")!.title };
+}
+
+describe("a thread a teammate opened", () => {
+ it("is named from the job it was handed, behind who handed it", async () => {
+ const p = place();
+ p.title("dana", "work-1", "Implement the CSV export", "@Clive · ");
+ await vi.waitFor(() => expect(p.titleOf()).toBe("@Clive · CSV export build"));
+ expect(p.generate).toHaveBeenCalledWith({}, "Implement the CSV export");
+ });
+
+ it("keeps a rename made while the name was being thought of", async () => {
+ const p = place({ renamedTo: "Mine" });
+ p.title("dana", "work-1", "Implement the CSV export", "@Clive · ");
+ await new Promise((resolve) => setTimeout(resolve, 0));
+ expect(p.generate).toHaveBeenCalled();
+ expect(p.titleOf()).toBe("Mine");
+ });
+
+ it("keeps its first title when the model can't name it, gives no name, or there is nothing to name it from", async () => {
+ for (const [p, brief, botId] of [[place({ gate: false }), "Implement it", "dana"], [place({ answer: null }), "Implement it", "dana"],
+ [place(), " ", "dana"], [place(), "Implement it", "gone"]] as const) {
+ p.title(botId, "work-1", brief, "@Clive · ");
+ await new Promise((resolve) => setTimeout(resolve, 0));
+ expect(p.titleOf()).toBe("@Clive · work");
+ }
+ });
+});
diff --git a/server/host/handed-thread-title.ts b/server/host/handed-thread-title.ts
new file mode 100644
index 0000000000..59c4d6c2f6
--- /dev/null
+++ b/server/host/handed-thread-title.ts
@@ -0,0 +1,24 @@
+import type { BotRecord, Store } from "../store.ts";
+
+type TitleModel = { generateText?: (prompt: string, options?: { signal?: AbortSignal }) => Promise<string> };
+
+/** A thread a teammate opened is named from the job it was handed, as a person's first message names theirs. A work
+ * thread keeps "@Sender · " in front, so the sidebar still says who the work is for. The name lands only while the
+ * thread still has the title it opened with: a rename in the meantime wins. */
+export function createHandedThreadTitle<Model extends TitleModel>(deps: {
+ store: Pick<Store, "bot" | "taskByThread" | "retitleTask">;
+ gate: (bot: BotRecord) => { ok: true; instance: Model } | { ok: false };
+ generate: (model: Model, text: string) => Promise<string | null>;
+}): (botId: string, threadId: string, brief: string, prefix: string) => void {
+ return (botId, threadId, brief, prefix) => {
+ const bot = deps.store.bot(botId), machineTitle = deps.store.taskByThread(botId, threadId)?.title;
+ if (!bot || !machineTitle || !brief.trim()) return;
+ const gate = deps.gate(bot);
+ if (!gate.ok) return;
+ void deps.generate(gate.instance, brief)
+ .then((title) => {
+ if (title) deps.store.retitleTask(botId, threadId, machineTitle, `${prefix}${title}`);
+ })
+ .catch(() => undefined);
+ };
+}
diff --git a/server/index.ts b/server/index.ts
index 68d67b9f4f..c369b26462 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -332,7 +332,7 @@ import { buildRecoveryText, buildTurnContext, engineIsFresh, replaysNatively } f
import { Handoffs, handedStateUsable, isContextMessage, recordHanded, renderUnseen, sessionStart, unseenMessages, withUnseenMessages, type ContextMessage } from "./delta-context.ts"; import { isFreshStart, sinceFreshStart } from "./fresh-start.ts";
import { extractReplayImages, extractTurnImages, nativeClips, turnMedia, videoFramesWithin } from "./turn-images.ts";
import { callTitleExcerpt } from "./thread-title.ts";
-import { generateThreadTitle } from "./thread-title-generate.ts";
+import { generateThreadTitle } from "./thread-title-generate.ts"; import { createHandedThreadTitle } from "./host/handed-thread-title.ts";
import { engineCommandCpuMs, engineProcessExited, engineProcessGone, ENGINE_EXIT_STALL_MS, stallLimitMs, stallNotice, TurnWatchdog } from "./turn-watchdog.ts"; import { createIdleThreads } from "./host/idle-threads.ts"; import { createDispatchClaims } from "./host/dispatch-claims.ts";
import { TurnResources, type TurnOwner } from "./turn-resources.ts";
import { createPhoneHold } from "./phone-screen/hold.ts"; import { createPhoneGate } from "./routes/phone-gate.ts";
@@ -3839,7 +3839,7 @@ const questionRouting = createQuestionRouting({ store, handedInUnproven, active:
steer: async (threadId, text) => canSteerThread(threadId) && (await steerThread(threadId, text)) !== "refused", mayReach: outsideLineage.mayReach });
const reworkCap = createReworkCap(); const handoffFiles = createHandoffFiles({ dataDir: DATA_DIR, attachmentsDir: ATTACHMENTS_DIR, botName: (id) => store.bot(id)?.name, node: (id) => coordinator.node(id), children: (id) => coordinator.children(id), discard: deleteAttachment, threadsReferencing, changes: (listener) => store.onChange(listener), log: (line) => console.error(line),
worksInOwnFolder: (botId, threadId) => turnsRunInOwnFolder(botId, threadId, store.taskByThread(botId, threadId)?.cwd, store.bot(botId)?.cwd, Boolean(store.groupByThread(threadId))), vmHome: (botId) => localVmMode(cfg) === "per-bot" ? perBotLocalVmTarget(botId).workspaceDir : null, withheld: (child, parent) => Boolean(roomHandoffProblem(child, parent)) || keptPrivate({ child: teamHost.privateTo(child.threadId), parent: teamHost.privateTo(parent.threadId) }) });
-const botLink = createBotLinkHost({ roomLine: (threadId, key, params) => serverLine(threadLanguage(threadId), key, params), roomWindow: (threadId, reader) => roomTranscript.window(threadId, userNameFor(threadId), undefined, reader), roomOpener: (botId, threadId) => handoffOpener({ botId, threadId }, threadId), roomChanged: (groupId) => { const room = store.group(groupId); if (room) broadcast({ kind: "group", group: publicGroupState(room) }); }, roomFollow: followRoomMentions<GroupTurnOperation>({ members: (groupId) => (store.group(groupId)?.memberIds ?? []).map((id) => store.bot(id)).filter((bot): bot is BotRecord => Boolean(bot)), mentioned: (text, members) => roomResponders(text, members, { kind: "mentions" }), begin: beginGroupTurnOperation, finish: finishGroupTurnOperation, queue: groupQueues, wait: waitForChatRoomMember, run: (groupId, threadId, botId, hop, spoken, operation) => runGroupMemberTurn(groupId, threadId, botId, hop, spoken, undefined, undefined, () => operation.cancelled, undefined, undefined, undefined, undefined, operation) }), dataDir: DATA_DIR, environmentId: ENVIRONMENT_ID, store, coordinator: () => coordinator, kick: () => handoffTicks.kick(), level: (bot) => approvalModeForTurn(bot, true, bot.threadId), refusal: botMoveRefusal, language: (threadId) => threadLanguage(threadId), personName: personNameIn, sessions, power: () => cloudPower, files: handoffFiles, storeFile: (path, name, root) => saveBotAttachment({ path, name, roots: [root], byContent: true }), log: (line) => console.error(line), local: (auth) => auth.kind === "loopback" && auth.trust !== "service" && !CLOUD_HOME && !HOSTED_WORKSPACE, owner: (auth) => !sharedMembership() && !HOSTED_WORKSPACE && (ownHome.owner(auth) || (CLOUD_PERSONAL && cloudOwnerSession(auth))) }); ROUTES.push(botLink.routes); const handoffTicks = createHandoffTicks(), coordinator: Coordinator = createCoordinator({
+const titleHandedThread = createHandedThreadTitle({ store, gate: threadTitleGate, generate: generateThreadTitle }); const botLink = createBotLinkHost({ roomLine: (threadId, key, params) => serverLine(threadLanguage(threadId), key, params), roomWindow: (threadId, reader) => roomTranscript.window(threadId, userNameFor(threadId), undefined, reader), roomOpener: (botId, threadId) => handoffOpener({ botId, threadId }, threadId), roomChanged: (groupId) => { const room = store.group(groupId); if (room) broadcast({ kind: "group", group: publicGroupState(room) }); }, roomFollow: followRoomMentions<GroupTurnOperation>({ members: (groupId) => (store.group(groupId)?.memberIds ?? []).map((id) => store.bot(id)).filter((bot): bot is BotRecord => Boolean(bot)), mentioned: (text, members) => roomResponders(text, members, { kind: "mentions" }), begin: beginGroupTurnOperation, finish: finishGroupTurnOperation, queue: groupQueues, wait: waitForChatRoomMember, run: (groupId, threadId, botId, hop, spoken, operation) => runGroupMemberTurn(groupId, threadId, botId, hop, spoken, undefined, undefined, () => operation.cancelled, undefined, undefined, undefined, undefined, operation) }), dataDir: DATA_DIR, environmentId: ENVIRONMENT_ID, store, coordinator: () => coordinator, kick: () => handoffTicks.kick(), level: (bot) => approvalModeForTurn(bot, true, bot.threadId), titleHanded: titleHandedThread, refusal: botMoveRefusal, language: (threadId) => threadLanguage(threadId), personName: personNameIn, sessions, power: () => cloudPower, files: handoffFiles, storeFile: (path, name, root) => saveBotAttachment({ path, name, roots: [root], byContent: true }), log: (line) => console.error(line), local: (auth) => auth.kind === "loopback" && auth.trust !== "service" && !CLOUD_HOME && !HOSTED_WORKSPACE, owner: (auth) => !sharedMembership() && !HOSTED_WORKSPACE && (ownHome.owner(auth) || (CLOUD_PERSONAL && cloudOwnerSession(auth))) }); ROUTES.push(botLink.routes); const handoffTicks = createHandoffTicks(), coordinator: Coordinator = createCoordinator({
dataDir: DATA_DIR,
now: Date.now, wrote: () => { handoffTicks.kick(); handoffStatus.changed(); }, handoffLimit: { refusal: (botId, open, origin) => botHolds.handoff(botId) ?? starterCaps.handoffs.refusal(botId, open) ?? usageCapGate.handoff(botId, origin) },
log: line => console.error("coordinator:", line),
@@ -13598,7 +13598,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {
if (!duplicate && call.files?.length) handoffFiles.sent(node.id, { botId: internalSender.id, name: internalSender.name }, call.files);
if (duplicate && createdThread) store.deleteTask(target.botId, createdThread);
else if (createdThread) {
- threadStarters.set(createdThread, opener);
+ threadStarters.set(createdThread, opener); if (via === "direct" && !(fresh && call.title)) titleHandedThread(target.botId, createdThread, call.message, fresh ? "" : `@${internalSender.name} · `);
if (fresh && !EXTERNAL) internalCapability.openedThreads += 1;
}
createdThread = undefined;
diff --git a/server/long-running-chief.e2e.test.ts b/server/long-running-chief.e2e.test.ts
index 65dfeda1e3..3805dc495d 100644
--- a/server/long-running-chief.e2e.test.ts
+++ b/server/long-running-chief.e2e.test.ts
@@ -36,6 +36,8 @@ async function chiefJob(test: (f: any) => Promise<void>) {
// Only a turn's POST carries a body; the Ollama probe GETs /api/version first (ollama-context.ts).
if (req.method !== "POST") { res.writeHead(404); res.end(); return; }
for await (const chunk of req) body += chunk;
+ // Naming a work thread a hand-off opened is a one-shot of its own, not a step of any turn here: it gets no title.
+ if (body.includes("Reply with only a short title")) { res.writeHead(404); res.end(); return; }
const sent = JSON.parse(body) as { messages: Array<{ role: string; content?: unknown }>; tools?: Array<{ function: { name: string } }> };
const text = (message: { content?: unknown }) => typeof message.content === "string" ? message.content
: Array.isArray(message.content) ? message.content.map((part: any) => part?.text ?? "").join("\n") : "";