Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Live e2e: report what a failed provider execute returned (#2439)

Regan Bell66a2ecd9e428
diff --git a/test/live-slack-sandbox-providers.test.ts b/test/live-slack-sandbox-providers.test.ts
index 0b5fd52df..4661c7c19 100644
--- a/test/live-slack-sandbox-providers.test.ts
+++ b/test/live-slack-sandbox-providers.test.ts
@@ -68,6 +68,27 @@ test("projected sandbox results require exact successful execution evidence", ()
assert.throws(() => assertSandboxExecution(entries.toReversed(), "box", "nonce\n"));
});
+test("a failed provider execution reports what the execute call returned", () => {
+ const token = "eyJhbGciOiJIUzI1NiIsImtpZCI6ImsxIn0.eyJvcmdJZCI6InFhIn0.c2lnbmF0dXJlMTIzNDU2Nzg5MGFiY2RlZmdoaWprbG1u";
+ const entries = evidence() as Array<{ type: string; payload: Record<string, unknown> }>;
+ Object.assign(entries[1]!.payload, {
+ code: 1,
+ result: `${"x".repeat(500)}\n[stderr]\nproxy https://x:${token}@proxy.example.com refused\nProxy-Authorization: Basic eDpzZWNyZXQ=\n[exit 1]`,
+ });
+ assert.throws(
+ () => assertSandboxExecution(entries, "box", "nonce\n"),
+ (error: Error) =>
+ error.message.includes('"code":1') &&
+ error.message.includes("@proxy.example.com refused") &&
+ error.message.includes("[exit 1]") &&
+ !error.message.includes("x".repeat(151)) &&
+ !error.message.includes("eyJvcmdJZCI6InFhIn0") &&
+ !error.message.includes("c2lnbmF0dXJl") &&
+ !error.message.includes("eDpzZWNyZXQ"),
+ );
+ assert.throws(() => assertSandboxExecution(evidence().slice(0, 1), "box", "nonce\n"), /no result recorded/);
+});
+
test("every provider has its own parallel execution scenario", () => {
assert.deepEqual(sandboxProviders.toSorted(), [
"agent37",
diff --git a/test/live-slack/scenarios-sandbox-providers.ts b/test/live-slack/scenarios-sandbox-providers.ts
index 415b050c1..29360774f 100644
--- a/test/live-slack/scenarios-sandbox-providers.ts
+++ b/test/live-slack/scenarios-sandbox-providers.ts
@@ -1,7 +1,9 @@
import assert from "node:assert/strict";
import { randomUUID } from "node:crypto";
import type { SandboxBackendName } from "../../src/sandbox/sandbox-routing.ts";
+import { redactSecrets } from "../../src/harness/redact-secrets.ts";
import { isObj } from "../../src/util/objects.ts";
+import { headSlice, tailSlice } from "../../src/util/text.ts";
import type { Scenario } from "./harness.ts";
const providerCoverage: Record<SandboxBackendName, true> = {
@@ -26,8 +28,16 @@ export function succeededWithStdout(p: Record<string, unknown>, stdout: string):
);
}
+function describeExecuteResult(p: Record<string, unknown>): string {
+ const result = typeof p.result === "string" ? redactSecrets(p.result) : p.result;
+ const shown =
+ typeof result === "string" && result.length > 400 ? `${headSlice(result, 150)}…${tailSlice(result, 250)}` : result;
+ return JSON.stringify({ isError: p.isError, code: p.code, timedOut: p.timedOut, result: shown });
+}
+
export function assertSandboxExecution(entries: readonly unknown[], sandboxId: string, stdout: string): void {
const calls = new Set<string>();
+ const unmatched: string[] = [];
let executed = false;
for (const entry of entries) {
if (!isObj(entry) || !isObj(entry.payload)) continue;
@@ -37,10 +47,13 @@ export function assertSandboxExecution(entries: readonly unknown[], sandboxId: s
calls.add(p.callId);
continue;
}
- if (entry.type === "tool_result" && calls.has(p.callId) && succeededWithStdout(p, stdout)) executed = true;
+ if (entry.type !== "tool_result" || !calls.has(p.callId)) continue;
+ if (succeededWithStdout(p, stdout)) executed = true;
+ else unmatched.push(describeExecuteResult(p));
}
assert.ok(calls.size, `no execute call targeted ${sandboxId}`);
- assert.ok(executed, `no successful execute result with exact stdout on ${sandboxId}`);
+ const seen = unmatched.length ? `; results: ${unmatched.join(" | ")}` : "; no result recorded";
+ assert.ok(executed, `no successful execute result with exact stdout on ${sandboxId}${seen}`);
}
export const sandboxProviderScenarios: Scenario[] = sandboxProviders.map((backend) => ({