Multiplayer agent harness for work.
fix(ci): pin memorable-cli for the e2e and surface CLI stderr on refusal
Josh France1eae5dd9650d
diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.ymlindex d1ea21502..9c3575b6b 100644--- a/.github/workflows/cicd.yml+++ b/.github/workflows/cicd.yml@@ -179,7 +179,8 @@ jobs:MEMORABLE_E2E_DB_URL: postgres://postgres:postgres@localhost:5432/qmMEMORABLE_E2E_BIN: node node_modules/memorable-cli/dist/cli.jsrun: |- npm i --no-save --no-audit --no-fund memorable-cli+ # Pinned vendor CLI under test; not shipped, so the repo's release-age guard is bypassed for this install only.+ npm i --no-save --no-audit --no-fund --min-release-age=0 [email protected]node --test test/e2e/memorable-cli.e2e.test.tsadmin-plugin:diff --git a/src/memory/memorable/relay.ts b/src/memory/memorable/relay.tsindex 3b9613361..5bea2d067 100644--- a/src/memory/memorable/relay.ts+++ b/src/memory/memorable/relay.ts@@ -3,6 +3,7 @@ import { worthOffering, type MemorableCapture } from "./capture.ts";const RELAY_TIMEOUT_MS = 120_000;const MAX_RELAY_STDOUT = 8_192;+const MAX_RELAY_STDERR = 2_048;function refusalReason(stdout: string): string | null {for (const line of stdout.split("\n")) {@@ -36,12 +37,13 @@ export function relayRecord(}const [cmd = "memorable", ...preArgs] = bin.split(" ").filter(Boolean);const child = spawn(cmd, [...preArgs, "record", "--scope", capture.scope_id, "-"], {- stdio: ["pipe", "pipe", "ignore"],+ stdio: ["pipe", "pipe", "pipe"],...(opts ? { env: { ...opts.env, ...(opts.apiKey ? { MEMORABLE_API_KEY: opts.apiKey } : {}) } } : {}),});child.unref();let settled = false;let out = "";+ let err = "";const finish = (outcome: RelayOutcome) => {if (settled) return;settled = true;@@ -56,10 +58,15 @@ export function relayRecord(child.stdout.on("data", (c: Buffer) => {if (out.length < MAX_RELAY_STDOUT) out += c.toString("utf8");});+ child.stderr?.on("data", (c: Buffer) => {+ if (err.length < MAX_RELAY_STDERR) err += c.toString("utf8");+ });child.on("error", (e) => finish({ ok: false, reason: e.message.slice(0, 200) }));- child.on("exit", (code) =>- finish(code === 0 ? { ok: true } : { ok: false, reason: refusalReason(out) ?? `exit ${code}` }),- );+ child.on("exit", (code) => {+ if (code === 0) return finish({ ok: true });+ const detail = err.replace(/\s+/g, " ").trim().slice(0, 300);+ finish({ ok: false, reason: refusalReason(out) ?? (detail ? `exit ${code}: ${detail}` : `exit ${code}`) });+ });child.stdin.on("error", () => {});child.stdin.end(JSON.stringify({ ...capture, workflows }));});diff --git a/test/e2e/memorable-cli.e2e.test.ts b/test/e2e/memorable-cli.e2e.test.tsindex d6df731e2..2508efd6b 100644--- a/test/e2e/memorable-cli.e2e.test.ts+++ b/test/e2e/memorable-cli.e2e.test.ts@@ -17,7 +17,7 @@ const CLI = process.env.MEMORABLE_E2E_BIN;function skipReason(): string | false {if (!DB) return "set MEMORABLE_E2E_DB_URL";- if (!CLI) return "set MEMORABLE_E2E_BIN (e.g. `node node_modules/memorable-cli/dist/cli.js`)";+ if (!CLI) return "set MEMORABLE_E2E_BIN (e.g. `node node_modules/memorable-cli/dist/cli.js`, memorable-cli >= 0.5)";return false;}