Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Clarify no-computer subagent delegation (#1699)

Joshua Francefb282788fb36
diff --git a/docs/persistent-subagent-sessions.md b/docs/persistent-subagent-sessions.md
index 87df1bb72..65f610759 100644
--- a/docs/persistent-subagent-sessions.md
+++ b/docs/persistent-subagent-sessions.md
@@ -4,7 +4,9 @@ A delegated task runs in a durable session with its own transcript and a mutable
## Lifecycle
-`sessions.open` accepts a task, title, model, harness, thinking level, and read-only preference. Reusing its request key recovers the same child and initial run after a lost receipt; using that key for different work is rejected. Children inherit the caller's scope and audience. Read-only delegation cannot be upgraded to writable execution. The session tree admits at most ten pending or running qm runs, including direct turns and explicit follow-up tasks.
+`sessions.open` accepts a task, title, model, harness, thinking level, and optional `noComputer` flag. `noComputer: true` removes computer access entirely: no shell, filesystem, browser, or computer-backed integrations. Only memory/history, session coordination, runtime inspection, and permitted read-only connectors remain. Leave it unset for tasks that need a computer to read email, files, or code; express any no-write constraint in the task.
+
+Reusing a request key recovers the same child and initial run after a lost receipt; using that key for different work is rejected. Children inherit the caller's scope and audience. The existing internal `readOnly` restriction remains durable: `noComputer: false` cannot lift a caller's restriction or an existing child's restriction. The session tree admits at most ten pending or running qm runs, including direct turns and explicit follow-up tasks.
`sessions.send_message` adds attributed data to a durable recipient inbox without starting a turn. Parents, children, siblings, and other accessible sessions can exchange messages. Targets accept IDs, child/sibling titles, or `parent`. Messages arrive at tool boundaries; `sessions.wait` waits up to 60 seconds for mail. Idle recipients see messages when they next use a tool. Agents should continue independent work and wait for required results before giving one combined answer.
diff --git a/src/harness/agent-tools.ts b/src/harness/agent-tools.ts
index 76f1372e3..535c9d246 100644
--- a/src/harness/agent-tools.ts
+++ b/src/harness/agent-tools.ts
@@ -1513,7 +1513,12 @@ export function createAgentTools(ref: ToolContextRef, opts?: AgentToolsOptions):
}),
),
name: Type.Optional(Type.String({ description: "open: short title for the subagent (default: from task)." })),
- readOnly: Type.Optional(Type.Boolean({ description: "open: subagent may not change anything." })),
+ noComputer: Type.Optional(
+ Type.Boolean({
+ description:
+ "open: disable computer access entirely: no shell, filesystem, browser, or computer-backed integrations. Only memory/history, session coordination, runtime inspection, and permitted read-only connectors remain. Omit for tasks that need a computer to read email, files, or code; put 'do not modify anything' in task instead. Default false; cannot override an inherited restriction.",
+ }),
+ ),
model: Type.Optional(Type.String({ description: "open: model override; fails closed if unavailable." })),
harness: Type.Optional(Type.String({ description: "open: harness override." })),
thinkingLevel: Type.Optional(Type.String({ description: "open: reasoning effort override." })),
@@ -1542,7 +1547,7 @@ export function createAgentTools(ref: ToolContextRef, opts?: AgentToolsOptions):
fastMode?: boolean;
task?: string;
name?: string;
- readOnly?: boolean;
+ noComputer?: boolean;
model?: string;
target?: string;
text?: string;
@@ -1554,6 +1559,7 @@ export function createAgentTools(ref: ToolContextRef, opts?: AgentToolsOptions):
action: p.action,
...(p.task ? { task: p.task } : {}),
...(p.name ? { name: p.name } : {}),
+ ...(p.noComputer !== undefined ? { noComputer: p.noComputer } : {}),
...(p.target ? { target: p.target } : {}),
...(p.text ? { text: p.text } : {}),
...(p.interrupt ? { interrupt: true } : {}),
@@ -1586,7 +1592,7 @@ export function createAgentTools(ref: ToolContextRef, opts?: AgentToolsOptions):
...(p.thinkingLevel ? { thinkingLevel: p.thinkingLevel } : {}),
...(p.fastMode !== undefined ? { fastMode: p.fastMode } : {}),
...(p.name ? { name: p.name } : {}),
- ...(p.readOnly !== undefined ? { readOnly: p.readOnly } : {}),
+ ...(p.noComputer !== undefined ? { readOnly: p.noComputer } : {}),
...(p.model ? { model: p.model } : {}),
});
if (!result.ok) {
diff --git a/test/agent-tools.test.ts b/test/agent-tools.test.ts
index 2fbfa9c2e..2aa978205 100644
--- a/test/agent-tools.test.ts
+++ b/test/agent-tools.test.ts
@@ -2,6 +2,7 @@ import { test } from "node:test";
import { createGoalRecord } from "../src/harness/goal.ts";
import assert from "node:assert/strict";
import { Check } from "typebox/value";
+import { fromJSONSchema, z, type ZodObject } from "zod";
import { createAgentTools, pauseStampAfterToolCall, type ToolContextRef } from "../src/harness/agent-tools.ts";
import { createMemoryRunSignalStore, waitForClientResult } from "../src/runs/run-signal-store.ts";
import { filterHistoryForAudience } from "../src/resolution/context-filter.ts";
@@ -3413,6 +3414,33 @@ test("conversation coordinators cannot execute commands through any command tool
);
});
+test("sessions open exposes noComputer and preserves the internal restriction", async () => {
+ const opened: Array<{ readOnly?: boolean }> = [];
+ const tc = fakeToolContext();
+ tc.sessionSyscalls = {
+ open: async (input) => {
+ opened.push(input);
+ return { ok: true, sessionId: "child", title: "child", liveRunsRemaining: 9 };
+ },
+ write: async () => ({ ok: false, message: "unused" }),
+ read: async () => ({ ok: false, message: "unused" }),
+ };
+ const session = createAgentTools({ current: tc }).find((tool) => tool.name === "sessions")!;
+ const properties = (session.parameters as { properties: Record<string, { description?: string }> }).properties;
+ assert.ok(properties.noComputer);
+ assert.equal(properties.readOnly, undefined);
+ assert.match(properties.noComputer.description!, /no shell, filesystem, browser/);
+ const shape = (fromJSONSchema(session.parameters as Parameters<typeof fromJSONSchema>[0]) as ZodObject).shape;
+ assert.ok(!Check(session.parameters, { action: "open", task: "test", noComputer: "true" }));
+ for (const noComputer of [undefined, false, true]) {
+ const params = { action: "open", task: "test", ...(noComputer === undefined ? {} : { noComputer }) };
+ assert.ok(Check(session.parameters, params));
+ await call(session, z.object(shape).parse(params));
+ assert.equal(opened.at(-1)!.readOnly, noComputer);
+ }
+ assert.equal(opened.length, 3);
+});
+
test("sessions open schema and dispatch preserve an explicit false fast mode", async () => {
const tc = fakeToolContext();
tc.sessionSyscalls = {