Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

fix: pass a turn's surface name to the harness on every turn

Josh France0441d870c742
diff --git a/src/core/orchestrator.ts b/src/core/orchestrator.ts
index 4b067e6c7..fd104d30e 100644
--- a/src/core/orchestrator.ts
+++ b/src/core/orchestrator.ts
@@ -2453,15 +2453,9 @@ export function createOrchestrator(deps: OrchestratorDeps): Orchestrator {
...(input.thinkingLevel ? { thinkingLevel: input.thinkingLevel } : {}),
...(typeof effectiveFastMode === "boolean" ? { fastMode: effectiveFastMode } : {}),
...(strictReadOnly ? { readOnly: true } : {}),
- ...(input.surfaceTools && surfaceToolDeps
- ? {
- surfaceTools: true,
- surfaceName:
- input.origin.kind === "automation" && input.origin.destination
- ? "slack"
- : (input.surface ?? "slack"),
- }
- : {}),
+ surfaceName:
+ input.origin.kind === "automation" && input.origin.destination ? "slack" : (input.surface ?? "slack"),
+ ...(input.surfaceTools && surfaceToolDeps ? { surfaceTools: true } : {}),
...(isPollFire ? { pollFire: true } : {}),
...(effectiveTurnWallClockMs !== undefined ? { turnWallClockMs: effectiveTurnWallClockMs } : {}),
...(securityPolicy.inboundScreening === "external"
diff --git a/src/harness/mock-harness.ts b/src/harness/mock-harness.ts
index 49134e90c..2d22f968a 100644
--- a/src/harness/mock-harness.ts
+++ b/src/harness/mock-harness.ts
@@ -252,6 +252,8 @@ export function createMockHarness(): Harness {
reply = turn.systemPrompt;
} else if (command0 === "!wallclock") {
reply = `wallclock:${turn.turnWallClockMs ?? 0}`;
+ } else if (command0 === "!surfacename") {
+ reply = `surface:${turn.surfaceName ?? "none"}`;
} else if (command0.startsWith("!askagent ")) {
const rest = command0.slice("!askagent ".length).trim();
const sp = rest.indexOf(" ");
diff --git a/test/orchestrator.test.ts b/test/orchestrator.test.ts
index e15d9e00b..533714da9 100644
--- a/test/orchestrator.test.ts
+++ b/test/orchestrator.test.ts
@@ -3412,3 +3412,9 @@ test("denying a quarantine release upholds the block", async () => {
const rerun = await built.app.turn(dm(cmd));
assert.match(rerun.reply ?? "", /quarantined by Auto security posture/, "the payload stays out of context");
});
+
+test("a turn carries its surface name to the harness, DM or not", async () => {
+ const built = freshApp();
+ assert.equal((await built.app.turn(dm("!surfacename", { surface: "web" }))).reply, "surface:web");
+ assert.equal((await built.app.turn(dm("!surfacename", { surface: "slack" }))).reply, "surface:slack");
+});