@tickernelz/wardmote-adapter-utils 2026.1108.2 → 2026.1111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/acpx-engine/composed-run-characterization.test.js +13 -16
- package/dist/acpx-engine/composed-run-characterization.test.js.map +1 -1
- package/dist/acpx-engine/ephemeral-session-environment.test.js +6 -6
- package/dist/acpx-engine/ephemeral-session-environment.test.js.map +1 -1
- package/dist/acpx-engine/execute-identity.test.js +12 -12
- package/dist/acpx-engine/execute-identity.test.js.map +1 -1
- package/dist/acpx-engine/execute.d.ts +2 -28
- package/dist/acpx-engine/execute.d.ts.map +1 -1
- package/dist/acpx-engine/execute.js +162 -224
- package/dist/acpx-engine/execute.js.map +1 -1
- package/dist/acpx-engine/execute.test.js +234 -250
- package/dist/acpx-engine/execute.test.js.map +1 -1
- package/dist/acpx-engine/filesystem-protocol.test.js +2 -2
- package/dist/acpx-engine/filesystem-protocol.test.js.map +1 -1
- package/dist/acpx-engine/managed-codex-skills-manifest.d.ts +3 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.d.ts.map +1 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.js +30 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.js.map +1 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.test.d.ts +2 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.test.d.ts.map +1 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.test.js +29 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.test.js.map +1 -0
- package/dist/acpx-engine/operator-stop.test.js +3 -3
- package/dist/acpx-engine/operator-stop.test.js.map +1 -1
- package/dist/acpx-engine/remote-spawn-smoke.test.js +5 -5
- package/dist/acpx-engine/remote-spawn-smoke.test.js.map +1 -1
- package/dist/acpx-engine/run-contracts.d.ts +5 -15
- package/dist/acpx-engine/run-contracts.d.ts.map +1 -1
- package/dist/acpx-engine/run-contracts.js.map +1 -1
- package/dist/acpx-engine/run-fault-matrix.test.js +7 -7
- package/dist/acpx-engine/run-fault-matrix.test.js.map +1 -1
- package/dist/acpx-engine/run-site-sandbox.d.ts +5 -12
- package/dist/acpx-engine/run-site-sandbox.d.ts.map +1 -1
- package/dist/acpx-engine/run-site-sandbox.js +4 -16
- package/dist/acpx-engine/run-site-sandbox.js.map +1 -1
- package/dist/acpx-engine/run-site-sandbox.test.js +13 -16
- package/dist/acpx-engine/run-site-sandbox.test.js.map +1 -1
- package/dist/acpx-engine/settlement-characterization.test.js +20 -20
- package/dist/acpx-engine/settlement-characterization.test.js.map +1 -1
- package/dist/acpx-engine/spawn-smoke.test.js +12 -12
- package/dist/acpx-engine/spawn-smoke.test.js.map +1 -1
- package/dist/acpx-engine/startup-characterization.test.js +27 -31
- package/dist/acpx-engine/startup-characterization.test.js.map +1 -1
- package/dist/acpx-engine/startup-timing.d.ts +27 -45
- package/dist/acpx-engine/startup-timing.d.ts.map +1 -1
- package/dist/acpx-engine/startup-timing.js +1 -19
- package/dist/acpx-engine/startup-timing.js.map +1 -1
- package/dist/acpx-engine/startup-timing.test.js +2 -2
- package/dist/acpx-engine/startup-timing.test.js.map +1 -1
- package/dist/acpx-engine/terminal-session-failure.js +1 -1
- package/dist/acpx-engine/terminal-session-failure.js.map +1 -1
- package/dist/acpx-engine/turn-characterization.test.js +3 -3
- package/dist/acpx-engine/turn-characterization.test.js.map +1 -1
- package/dist/acpx-engine/turn-sequence.js +1 -1
- package/dist/acpx-engine/turn-sequence.js.map +1 -1
- package/dist/chat-file-delivery.d.ts +2 -2
- package/dist/chat-file-delivery.d.ts.map +1 -1
- package/dist/chat-file-delivery.js +4 -4
- package/dist/chat-file-delivery.js.map +1 -1
- package/dist/chat-file-delivery.test.js +9 -9
- package/dist/chat-file-delivery.test.js.map +1 -1
- package/dist/command-managed-runtime.js +5 -5
- package/dist/command-managed-runtime.js.map +1 -1
- package/dist/command-managed-runtime.test.js +38 -40
- package/dist/command-managed-runtime.test.js.map +1 -1
- package/dist/directory-merge-lock.test.js +3 -3
- package/dist/directory-merge-lock.test.js.map +1 -1
- package/dist/execution-target-sandbox.test.js +361 -369
- package/dist/execution-target-sandbox.test.js.map +1 -1
- package/dist/execution-target-stdin-race.test.js +80 -90
- package/dist/execution-target-stdin-race.test.js.map +1 -1
- package/dist/execution-target.d.ts +6 -36
- package/dist/execution-target.d.ts.map +1 -1
- package/dist/execution-target.js +92 -144
- package/dist/execution-target.js.map +1 -1
- package/dist/execution-target.test.js +3 -3
- package/dist/execution-target.test.js.map +1 -1
- package/dist/forbidden-config-env.test.d.ts +2 -0
- package/dist/forbidden-config-env.test.d.ts.map +1 -0
- package/dist/forbidden-config-env.test.js +35 -0
- package/dist/forbidden-config-env.test.js.map +1 -0
- package/dist/git-workspace-sync.d.ts +2 -2
- package/dist/git-workspace-sync.d.ts.map +1 -1
- package/dist/git-workspace-sync.js +8 -8
- package/dist/git-workspace-sync.js.map +1 -1
- package/dist/git-workspace-sync.test.js +61 -61
- package/dist/git-workspace-sync.test.js.map +1 -1
- package/dist/github-launcher-environment.test.js +36 -36
- package/dist/github-launcher-environment.test.js.map +1 -1
- package/dist/github-launcher.js +16 -16
- package/dist/github-launcher.js.map +1 -1
- package/dist/github-launcher.test.js +5 -5
- package/dist/github-launcher.test.js.map +1 -1
- package/dist/http2-bridge-server.test.js +1 -1
- package/dist/http2-bridge-server.test.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/local-process-sandbox.js +7 -7
- package/dist/local-process-sandbox.js.map +1 -1
- package/dist/local-process-sandbox.test.js +24 -24
- package/dist/local-process-sandbox.test.js.map +1 -1
- package/dist/mcp-isolation.integration.test.js +4 -4
- package/dist/mcp-isolation.integration.test.js.map +1 -1
- package/dist/prompt-sections.test.js +11 -11
- package/dist/prompt-sections.test.js.map +1 -1
- package/dist/provider-models/claude.d.ts +0 -1
- package/dist/provider-models/claude.d.ts.map +1 -1
- package/dist/provider-models/claude.js +0 -1
- package/dist/provider-models/claude.js.map +1 -1
- package/dist/provider-models/codex.d.ts.map +1 -1
- package/dist/provider-models/codex.js +2 -2
- package/dist/provider-models/codex.js.map +1 -1
- package/dist/remote-managed-runtime.js +6 -6
- package/dist/remote-managed-runtime.js.map +1 -1
- package/dist/remote-managed-runtime.test.js +14 -14
- package/dist/remote-managed-runtime.test.js.map +1 -1
- package/dist/retired-marker-names.d.ts +2 -0
- package/dist/retired-marker-names.d.ts.map +1 -0
- package/dist/retired-marker-names.js +2 -0
- package/dist/retired-marker-names.js.map +1 -0
- package/dist/retired-skill-names.d.ts +3 -0
- package/dist/retired-skill-names.d.ts.map +1 -0
- package/dist/retired-skill-names.js +8 -0
- package/dist/retired-skill-names.js.map +1 -0
- package/dist/run-oom-score.d.ts +1 -1
- package/dist/run-oom-score.d.ts.map +1 -1
- package/dist/run-oom-score.js +1 -1
- package/dist/run-oom-score.js.map +1 -1
- package/dist/runner-connectivity.d.ts +7 -7
- package/dist/runner-connectivity.d.ts.map +1 -1
- package/dist/runner-connectivity.js +16 -16
- package/dist/runner-connectivity.js.map +1 -1
- package/dist/runner-connectivity.test.js +21 -21
- package/dist/runner-connectivity.test.js.map +1 -1
- package/dist/runtime-progress.d.ts.map +1 -1
- package/dist/runtime-progress.js +1 -4
- package/dist/runtime-progress.js.map +1 -1
- package/dist/runtime-progress.test.js +13 -13
- package/dist/runtime-progress.test.js.map +1 -1
- package/dist/sandbox-callback-bridge.d.ts +1 -16
- package/dist/sandbox-callback-bridge.d.ts.map +1 -1
- package/dist/sandbox-callback-bridge.js +55 -88
- package/dist/sandbox-callback-bridge.js.map +1 -1
- package/dist/sandbox-callback-bridge.test.js +94 -115
- package/dist/sandbox-callback-bridge.test.js.map +1 -1
- package/dist/sandbox-file-sync.test.js +9 -9
- package/dist/sandbox-file-sync.test.js.map +1 -1
- package/dist/sandbox-install-command.js +4 -4
- package/dist/sandbox-install-command.js.map +1 -1
- package/dist/sandbox-managed-runtime.d.ts +0 -30
- package/dist/sandbox-managed-runtime.d.ts.map +1 -1
- package/dist/sandbox-managed-runtime.js +12 -34
- package/dist/sandbox-managed-runtime.js.map +1 -1
- package/dist/sandbox-managed-runtime.test.js +134 -144
- package/dist/sandbox-managed-runtime.test.js.map +1 -1
- package/dist/sandbox-run-log-stream.js +5 -5
- package/dist/sandbox-run-log-stream.js.map +1 -1
- package/dist/server-utils-env.test.js +10 -9
- package/dist/server-utils-env.test.js.map +1 -1
- package/dist/server-utils.d.ts +121 -147
- package/dist/server-utils.d.ts.map +1 -1
- package/dist/server-utils.js +319 -346
- package/dist/server-utils.js.map +1 -1
- package/dist/server-utils.test.js +339 -322
- package/dist/server-utils.test.js.map +1 -1
- package/dist/skill-library-manifest.d.ts +2 -2
- package/dist/skill-library-manifest.d.ts.map +1 -1
- package/dist/skill-library-manifest.test.js +4 -4
- package/dist/skill-library-manifest.test.js.map +1 -1
- package/dist/ssh-fixture.test.js +57 -57
- package/dist/ssh-fixture.test.js.map +1 -1
- package/dist/ssh.d.ts.map +1 -1
- package/dist/ssh.js +18 -40
- package/dist/ssh.js.map +1 -1
- package/dist/test-fixtures/prompt-context.d.ts +5 -5
- package/dist/test-fixtures/prompt-context.js +5 -5
- package/dist/test-fixtures/prompt-context.js.map +1 -1
- package/dist/test-support/mcp-isolation-harness.js +1 -1
- package/dist/test-support/mcp-isolation-harness.js.map +1 -1
- package/dist/tool-profile.d.ts +1 -1
- package/dist/tool-profile.d.ts.map +1 -1
- package/dist/tool-profile.js +1 -1
- package/dist/tool-profile.js.map +1 -1
- package/dist/types.d.ts +13 -31
- package/dist/types.d.ts.map +1 -1
- package/dist/{paperclip-mcp-mount.d.ts → wardmote-mcp-mount.d.ts} +10 -10
- package/dist/wardmote-mcp-mount.d.ts.map +1 -0
- package/dist/{paperclip-mcp-mount.js → wardmote-mcp-mount.js} +17 -17
- package/dist/wardmote-mcp-mount.js.map +1 -0
- package/dist/wardmote-mcp.d.ts +51 -0
- package/dist/wardmote-mcp.d.ts.map +1 -0
- package/dist/wardmote-mcp.js +148 -0
- package/dist/wardmote-mcp.js.map +1 -0
- package/dist/wardmote-mcp.test.d.ts +2 -0
- package/dist/wardmote-mcp.test.d.ts.map +1 -0
- package/dist/wardmote-mcp.test.js +133 -0
- package/dist/wardmote-mcp.test.js.map +1 -0
- package/dist/{paperclip-runner-permissions.d.ts → wardmote-runner-permissions.d.ts} +31 -36
- package/dist/wardmote-runner-permissions.d.ts.map +1 -0
- package/dist/{paperclip-runner-permissions.js → wardmote-runner-permissions.js} +30 -35
- package/dist/wardmote-runner-permissions.js.map +1 -0
- package/dist/wardmote-runner-permissions.test.d.ts +2 -0
- package/dist/wardmote-runner-permissions.test.d.ts.map +1 -0
- package/dist/wardmote-runner-permissions.test.js +80 -0
- package/dist/wardmote-runner-permissions.test.js.map +1 -0
- package/dist/workspace-git-stream.test.js +1 -1
- package/dist/workspace-git-stream.test.js.map +1 -1
- package/dist/workspace-manifest.js +1 -1
- package/dist/workspace-manifest.js.map +1 -1
- package/dist/workspace-manifest.test.js +5 -5
- package/dist/workspace-manifest.test.js.map +1 -1
- package/dist/workspace-restore-diagnostics.js +1 -1
- package/dist/workspace-restore-diagnostics.js.map +1 -1
- package/dist/workspace-restore-diagnostics.test.js +5 -5
- package/dist/workspace-restore-diagnostics.test.js.map +1 -1
- package/dist/workspace-restore-merge.js +8 -8
- package/dist/workspace-restore-merge.js.map +1 -1
- package/dist/workspace-restore-merge.test.js +76 -82
- package/dist/workspace-restore-merge.test.js.map +1 -1
- package/dist/workspace-restore-result.test.js +2 -2
- package/dist/workspace-restore-result.test.js.map +1 -1
- package/dist/workspace-restore-teardown.test.js +6 -6
- package/dist/workspace-restore-teardown.test.js.map +1 -1
- package/node_modules/@clack/core/dist/index.d.mts +5 -3
- package/node_modules/@clack/core/dist/index.mjs +70 -67
- package/node_modules/@clack/core/package.json +3 -2
- package/node_modules/@clack/prompts/dist/index.d.mts +5 -4
- package/node_modules/@clack/prompts/dist/index.mjs +212 -187
- package/node_modules/@clack/prompts/package.json +3 -3
- package/node_modules/sisteransi/dist/index.d.ts +33 -0
- package/node_modules/sisteransi/dist/index.js +57 -0
- package/node_modules/sisteransi/package.json +18 -7
- package/node_modules/sisteransi/readme.md +19 -6
- package/package.json +2 -2
- package/dist/env-aliases-run.test.d.ts +0 -2
- package/dist/env-aliases-run.test.d.ts.map +0 -1
- package/dist/env-aliases-run.test.js +0 -49
- package/dist/env-aliases-run.test.js.map +0 -1
- package/dist/paperclip-mcp-mount.d.ts.map +0 -1
- package/dist/paperclip-mcp-mount.js.map +0 -1
- package/dist/paperclip-mcp.d.ts +0 -53
- package/dist/paperclip-mcp.d.ts.map +0 -1
- package/dist/paperclip-mcp.js +0 -149
- package/dist/paperclip-mcp.js.map +0 -1
- package/dist/paperclip-mcp.test.d.ts +0 -2
- package/dist/paperclip-mcp.test.d.ts.map +0 -1
- package/dist/paperclip-mcp.test.js +0 -133
- package/dist/paperclip-mcp.test.js.map +0 -1
- package/dist/paperclip-runner-permissions.d.ts.map +0 -1
- package/dist/paperclip-runner-permissions.js.map +0 -1
- package/dist/paperclip-runner-permissions.test.d.ts +0 -2
- package/dist/paperclip-runner-permissions.test.d.ts.map +0 -1
- package/dist/paperclip-runner-permissions.test.js +0 -80
- package/dist/paperclip-runner-permissions.test.js.map +0 -1
- package/node_modules/sisteransi/src/index.js +0 -58
- package/node_modules/sisteransi/src/sisteransi.d.ts +0 -35
|
@@ -12,7 +12,7 @@ import { promisify } from "node:util";
|
|
|
12
12
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
13
13
|
import { getSandboxDuplexGatewayCodecSource } from "./sandbox-callback-bridge.js";
|
|
14
14
|
import { createBridgeBodyReservation, getBridgeBodyReservedBytesForTest, resetBridgeBodyReservationsForTest, HTTP2_BRIDGE_MAX_CONCURRENT_STREAMS, HTTP2_BRIDGE_MAX_PROCESS_BODY_BYTES, } from "./http2-bridge-server.js";
|
|
15
|
-
import { __duplexReadinessTesting, __http2PrefaceScanTesting, DEFAULT_REMOTE_SANDBOX_ADAPTER_TIMEOUT_SEC, adapterExecutionTargetDuplexObservabilityRecorder, adapterExecutionTargetEnablesSandboxDuplexBridge, adapterExecutionTargetSessionIdentity, adapterExecutionTargetToRemoteSpec,
|
|
15
|
+
import { __duplexReadinessTesting, __http2PrefaceScanTesting, DEFAULT_REMOTE_SANDBOX_ADAPTER_TIMEOUT_SEC, adapterExecutionTargetDuplexObservabilityRecorder, adapterExecutionTargetEnablesSandboxDuplexBridge, adapterExecutionTargetSessionIdentity, adapterExecutionTargetToRemoteSpec, adapterExecutionTargetUsesWardmoteBridge, ensureAdapterExecutionTargetCommandResolvable, formatAdapterExecutionTimeoutErrorMessage, formatAdapterExecutionTimeoutStartLogLine, parseAdapterExecutionTarget, postedIssueCommentLogMarker, resolveAdapterExecutionTargetTimeout, resolveAdapterExecutionTargetTimeoutSec, runAdapterExecutionTargetProcess, runAdapterExecutionTargetShellCommand, startAdapterExecutionTargetProcessSessionBridge, startAdapterExecutionTargetWardmoteBridge, } from "./execution-target.js";
|
|
16
16
|
import { createRuntimeSpanRunner, getActiveStepContext, } from "./acpx-engine/startup-timing.js";
|
|
17
17
|
import { createSandboxRunLogTailFactory } from "./sandbox-run-log-stream.js";
|
|
18
18
|
import { runChildProcess } from "./server-utils.js";
|
|
@@ -104,11 +104,11 @@ describe("sandbox adapter execution targets", () => {
|
|
|
104
104
|
}
|
|
105
105
|
function encodeTailTick(stdout, stderr) {
|
|
106
106
|
return [
|
|
107
|
-
"
|
|
107
|
+
"__WARDMOTE_RUN_LOG_STDOUT__",
|
|
108
108
|
stdout.toString("base64"),
|
|
109
|
-
"
|
|
109
|
+
"__WARDMOTE_RUN_LOG_STDERR__",
|
|
110
110
|
stderr.toString("base64"),
|
|
111
|
-
"
|
|
111
|
+
"__WARDMOTE_RUN_LOG_END__",
|
|
112
112
|
"",
|
|
113
113
|
].join("\n");
|
|
114
114
|
}
|
|
@@ -231,7 +231,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
231
231
|
timeoutMs: 30_000, runner: createLocalSandboxRunner(),
|
|
232
232
|
};
|
|
233
233
|
const challenge = randomBytes(32);
|
|
234
|
-
const result = await runAdapterExecutionTargetProcess("identity-remote", target, process.execPath, ["-e", `const {sign}=require('node:crypto');process.stdout.write(sign(null,Buffer.from(process.argv[1],'hex'),process.env.
|
|
234
|
+
const result = await runAdapterExecutionTargetProcess("identity-remote", target, process.execPath, ["-e", `const {sign}=require('node:crypto');process.stdout.write(sign(null,Buffer.from(process.argv[1],'hex'),process.env.WARDMOTE_AGENT_PRIVATE_KEY).toString('base64'));`, challenge.toString("hex")], {
|
|
235
235
|
cwd: rootDir, env: buildAgentIdentityEnv(identity), timeoutSec: 5, graceSec: 1, onLog: async () => { },
|
|
236
236
|
});
|
|
237
237
|
expect(result.exitCode).toBe(0);
|
|
@@ -287,7 +287,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
287
287
|
});
|
|
288
288
|
});
|
|
289
289
|
it("preserves stdin when wrapping sandbox adapter commands for run-log streaming", async () => {
|
|
290
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
290
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-run-log-stdin-"));
|
|
291
291
|
cleanupDirs.push(rootDir);
|
|
292
292
|
const target = {
|
|
293
293
|
kind: "remote",
|
|
@@ -298,7 +298,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
298
298
|
streamRunLogs: true,
|
|
299
299
|
runner: createLocalSandboxRunner(),
|
|
300
300
|
};
|
|
301
|
-
const logsDir = path.posix.join(rootDir, ".
|
|
301
|
+
const logsDir = path.posix.join(rootDir, ".wardmote-runtime", "bridge", "logs");
|
|
302
302
|
const runLogTail = createSandboxRunLogTailFactory({
|
|
303
303
|
runner: target.runner,
|
|
304
304
|
remoteCwd: rootDir,
|
|
@@ -320,7 +320,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
320
320
|
expect(combinedStream(events, "stdout")).toContain("stdin=hello-through-wrapper");
|
|
321
321
|
});
|
|
322
322
|
it("creates the process session directories only in the launch exec, not in upfront makeDir execs", async () => {
|
|
323
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
323
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-makedir-"));
|
|
324
324
|
cleanupDirs.push(rootDir);
|
|
325
325
|
const childPath = path.join(rootDir, "noop-acp-child.mjs");
|
|
326
326
|
await writeFile(childPath, "process.stdin.on('data', () => {});\n", "utf8");
|
|
@@ -343,7 +343,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
343
343
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
344
344
|
runId: "run-process-session-makedir",
|
|
345
345
|
target,
|
|
346
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
346
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
347
347
|
adapterKey: "acpx",
|
|
348
348
|
command: process.execPath,
|
|
349
349
|
args: [childPath],
|
|
@@ -369,7 +369,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
369
369
|
{ outputMode: "polled", streamOutputViaSession: false },
|
|
370
370
|
{ outputMode: "streamed", streamOutputViaSession: true },
|
|
371
371
|
])("preserves an explicit remote PATH equal to host PATH in $outputMode mode", async ({ outputMode, streamOutputViaSession }) => {
|
|
372
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), `
|
|
372
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), `wardmote-process-session-${outputMode}-path-`));
|
|
373
373
|
cleanupDirs.push(rootDir);
|
|
374
374
|
const childPath = path.join(rootDir, "print-path-child.mjs");
|
|
375
375
|
await writeFile(childPath, 'process.stdout.write(process.env.PATH ?? "<missing>");\n', "utf8");
|
|
@@ -398,7 +398,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
398
398
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
399
399
|
runId: `run-process-session-${outputMode}-path`,
|
|
400
400
|
target,
|
|
401
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
401
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
402
402
|
adapterKey: "acpx",
|
|
403
403
|
command: process.execPath,
|
|
404
404
|
args: [childPath],
|
|
@@ -419,7 +419,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
419
419
|
}
|
|
420
420
|
});
|
|
421
421
|
it.each([false, true])("launches a large environment without oversized exec arguments (streamed=%s)", async (streamOutputViaSession) => {
|
|
422
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
422
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-large-process-env-"));
|
|
423
423
|
cleanupDirs.push(rootDir);
|
|
424
424
|
const value = "x".repeat(110_000);
|
|
425
425
|
const childPath = path.join(rootDir, "child.mjs");
|
|
@@ -434,7 +434,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
434
434
|
if (strings.some((text) => Buffer.byteLength(text) >= 131_072)) {
|
|
435
435
|
return { exitCode: 127, stdout: "", stderr: "argument list too long: env\n", timedOut: false, signal: null, pid: null, startedAt: null };
|
|
436
436
|
}
|
|
437
|
-
if (input.env?.
|
|
437
|
+
if (input.env?.WARDMOTE_PROCESS_SESSION_DIR || input.args?.[1]?.includes("nohup node")) {
|
|
438
438
|
const sessionRoot = path.join(runtimeRootDir, "process-sessions");
|
|
439
439
|
const entries = await readdir(sessionRoot, { withFileTypes: true });
|
|
440
440
|
const sessionDir = path.join(sessionRoot, entries.find((entry) => entry.isDirectory()).name);
|
|
@@ -445,7 +445,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
445
445
|
return delegate.execute(input);
|
|
446
446
|
},
|
|
447
447
|
};
|
|
448
|
-
const runtimeRootDir = path.join(rootDir, ".
|
|
448
|
+
const runtimeRootDir = path.join(rootDir, ".wardmote-runtime");
|
|
449
449
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
450
450
|
runId: "large-process-env", adapterKey: "acpx", runtimeRootDir,
|
|
451
451
|
target: { kind: "remote", transport: "sandbox", providerKey: "local-test", remoteCwd: rootDir, runner },
|
|
@@ -468,7 +468,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
468
468
|
}
|
|
469
469
|
});
|
|
470
470
|
it("logs a streamed wrapper launch failure before forwarding its exit", async () => {
|
|
471
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
471
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-wrapper-launch-error-"));
|
|
472
472
|
cleanupDirs.push(rootDir);
|
|
473
473
|
const delegate = createLocalSandboxRunner();
|
|
474
474
|
const logs = [];
|
|
@@ -495,7 +495,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
495
495
|
}
|
|
496
496
|
}, 10_000);
|
|
497
497
|
it("removes an incomplete private command payload when upload fails", async () => {
|
|
498
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
498
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-payload-upload-error-"));
|
|
499
499
|
cleanupDirs.push(rootDir);
|
|
500
500
|
const delegate = createLocalSandboxRunner();
|
|
501
501
|
await expect(startAdapterExecutionTargetProcessSessionBridge({
|
|
@@ -503,7 +503,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
503
503
|
target: {
|
|
504
504
|
kind: "remote", transport: "sandbox", providerKey: "local-test", remoteCwd: rootDir,
|
|
505
505
|
runner: { execute: async (input) => {
|
|
506
|
-
if (/command\.b64\.[^/]+\.
|
|
506
|
+
if (/command\.b64\.[^/]+\.wardmote-upload\.b64/.test(input.args?.[1] ?? "") && input.args[1].includes(">>")) {
|
|
507
507
|
throw new Error("Upload interrupted");
|
|
508
508
|
}
|
|
509
509
|
return delegate.execute(input);
|
|
@@ -522,7 +522,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
522
522
|
{ streamed: true, corrupt: false },
|
|
523
523
|
{ streamed: true, corrupt: true },
|
|
524
524
|
])("reports payload read failures without hanging (streamed=$streamed, corrupt=$corrupt)", async ({ streamed, corrupt }) => {
|
|
525
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
525
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-payload-read-error-"));
|
|
526
526
|
cleanupDirs.push(rootDir);
|
|
527
527
|
const delegate = createLocalSandboxRunner();
|
|
528
528
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
@@ -530,7 +530,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
530
530
|
target: {
|
|
531
531
|
kind: "remote", transport: "sandbox", providerKey: "local-test", remoteCwd: rootDir,
|
|
532
532
|
runner: { execute: async (input) => {
|
|
533
|
-
if (input.env?.
|
|
533
|
+
if (input.env?.WARDMOTE_PROCESS_SESSION_DIR || input.args?.[1]?.includes("nohup node")) {
|
|
534
534
|
const sessionRoot = path.join(rootDir, "process-sessions");
|
|
535
535
|
const entries = await readdir(sessionRoot, { withFileTypes: true });
|
|
536
536
|
const payloadPath = path.join(sessionRoot, entries.find((entry) => entry.isDirectory()).name, "command.b64");
|
|
@@ -563,7 +563,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
563
563
|
// that token. This test drives the bridge with a getter that returns a known
|
|
564
564
|
// token, lets the first poll tick fire, and proves the poll exec reads that
|
|
565
565
|
// token from the active step store.
|
|
566
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
566
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-poll-parent-"));
|
|
567
567
|
cleanupDirs.push(rootDir);
|
|
568
568
|
const childPath = path.join(rootDir, "noop-acp-child.mjs");
|
|
569
569
|
await writeFile(childPath, "process.stdin.on('data', () => {});\n", "utf8");
|
|
@@ -598,7 +598,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
598
598
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
599
599
|
runId: "run-process-session-poll-parent",
|
|
600
600
|
target,
|
|
601
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
601
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
602
602
|
adapterKey: "acpx",
|
|
603
603
|
command: process.execPath,
|
|
604
604
|
args: [childPath],
|
|
@@ -627,7 +627,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
627
627
|
// With no `getRuntimeParentContext`, the poll tick runs with an empty active
|
|
628
628
|
// step store, exactly like the earlier `runWithoutActiveStep` behavior. So a
|
|
629
629
|
// poll `sandbox.exec` span opens unparented with no stale startup flag.
|
|
630
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
630
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-poll-nogetter-"));
|
|
631
631
|
cleanupDirs.push(rootDir);
|
|
632
632
|
const childPath = path.join(rootDir, "noop-acp-child.mjs");
|
|
633
633
|
await writeFile(childPath, "process.stdin.on('data', () => {});\n", "utf8");
|
|
@@ -658,7 +658,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
658
658
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
659
659
|
runId: "run-process-session-poll-nogetter",
|
|
660
660
|
target,
|
|
661
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
661
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
662
662
|
adapterKey: "acpx",
|
|
663
663
|
command: process.execPath,
|
|
664
664
|
args: [childPath],
|
|
@@ -685,7 +685,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
685
685
|
// message in the `data` handler, not once at connect time. This test opens a
|
|
686
686
|
// socket while `connectParent` is live, switches the getter to `turnParent`,
|
|
687
687
|
// sends one stdin line, and proves the stdin write ran under `turnParent`.
|
|
688
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
688
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-stdin-parent-"));
|
|
689
689
|
cleanupDirs.push(rootDir);
|
|
690
690
|
const childPath = path.join(rootDir, "noop-acp-child.mjs");
|
|
691
691
|
await writeFile(childPath, "process.stdin.on('data', () => {});\n", "utf8");
|
|
@@ -700,11 +700,8 @@ describe("sandbox adapter execution targets", () => {
|
|
|
700
700
|
const delegate = createLocalSandboxRunner();
|
|
701
701
|
const runner = {
|
|
702
702
|
execute: async (input) => {
|
|
703
|
-
// Record the active step for the first exec that writes the stdin file.
|
|
704
|
-
// The `.paperclip-upload` temp path under the `stdin` directory is unique
|
|
705
|
-
// to the stdin-write path; the poll loop reads the `events` directory.
|
|
706
703
|
const script = (input.args ?? []).join("\n");
|
|
707
|
-
if (stdinWriteStep === "unset" && /\/stdin\/[^\s']*
|
|
704
|
+
if (stdinWriteStep === "unset" && /\/stdin\/[^\s']*wardmote-upload/.test(script)) {
|
|
708
705
|
stdinWriteStep = getActiveStepContext();
|
|
709
706
|
resolveStdinWrite();
|
|
710
707
|
}
|
|
@@ -722,7 +719,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
722
719
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
723
720
|
runId: "run-process-session-stdin-parent",
|
|
724
721
|
target,
|
|
725
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
722
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
726
723
|
adapterKey: "acpx",
|
|
727
724
|
command: process.execPath,
|
|
728
725
|
args: [childPath],
|
|
@@ -776,7 +773,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
776
773
|
// message to the agent in a `sandbox.agentSession.sendInput` span. This test
|
|
777
774
|
// connects a socket, sends one stdin line, and proves the handler opens that
|
|
778
775
|
// wrapper span around the write.
|
|
779
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
776
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-sendinput-span-"));
|
|
780
777
|
cleanupDirs.push(rootDir);
|
|
781
778
|
const childPath = path.join(rootDir, "noop-acp-child.mjs");
|
|
782
779
|
await writeFile(childPath, "process.stdin.on('data', () => {});\n", "utf8");
|
|
@@ -796,7 +793,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
796
793
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
797
794
|
runId: "run-process-session-sendinput-span",
|
|
798
795
|
target,
|
|
799
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
796
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
800
797
|
adapterKey: "acpx",
|
|
801
798
|
command: process.execPath,
|
|
802
799
|
args: [childPath],
|
|
@@ -840,7 +837,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
840
837
|
// With a span runner injected, the poll timer wraps each 100 ms poll tick in
|
|
841
838
|
// a `sandbox.agentSession.pollOutput` span. This test lets the first poll tick
|
|
842
839
|
// fire and proves the timer opens that wrapper span.
|
|
843
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
840
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-poll-span-"));
|
|
844
841
|
cleanupDirs.push(rootDir);
|
|
845
842
|
const childPath = path.join(rootDir, "noop-acp-child.mjs");
|
|
846
843
|
await writeFile(childPath, "process.stdin.on('data', () => {});\n", "utf8");
|
|
@@ -860,7 +857,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
860
857
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
861
858
|
runId: "run-process-session-poll-span",
|
|
862
859
|
target,
|
|
863
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
860
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
864
861
|
adapterKey: "acpx",
|
|
865
862
|
command: process.execPath,
|
|
866
863
|
args: [childPath],
|
|
@@ -886,7 +883,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
886
883
|
}
|
|
887
884
|
});
|
|
888
885
|
it("bridges bidirectional sandbox process sessions through a local ACPX-spawnable proxy", async () => {
|
|
889
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
886
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-"));
|
|
890
887
|
cleanupDirs.push(rootDir);
|
|
891
888
|
const childPath = path.join(rootDir, "fake-acp-child.mjs");
|
|
892
889
|
await writeFile(childPath, [
|
|
@@ -906,7 +903,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
906
903
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
907
904
|
runId: "run-process-session",
|
|
908
905
|
target,
|
|
909
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
906
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
910
907
|
adapterKey: "acpx",
|
|
911
908
|
command: process.execPath,
|
|
912
909
|
args: [childPath],
|
|
@@ -918,7 +915,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
918
915
|
expect(bridge).not.toBeNull();
|
|
919
916
|
try {
|
|
920
917
|
const result = await runProxyWithInput(bridge.agentCommand, "hello\n");
|
|
921
|
-
const report = await describeProxyRun(result, path.posix.join(rootDir, ".
|
|
918
|
+
const report = await describeProxyRun(result, path.posix.join(rootDir, ".wardmote-runtime", "acpx"));
|
|
922
919
|
expect(result.code, report).toBe(0);
|
|
923
920
|
expect(result.stdout, report).toBe("out:hello\n");
|
|
924
921
|
expect(result.stderr, report).toBe("err:hello\n");
|
|
@@ -935,7 +932,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
935
932
|
{ streamOutputViaSession: false, exitCode: null },
|
|
936
933
|
{ streamOutputViaSession: true, exitCode: null },
|
|
937
934
|
])("exits with stdin open after remote exit (stream=$streamOutputViaSession, code=$exitCode)", async ({ streamOutputViaSession, exitCode, }) => {
|
|
938
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
935
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-open-stdin-"));
|
|
939
936
|
cleanupDirs.push(rootDir);
|
|
940
937
|
// ACP keeps stdin open while it waits for a handshake. A remote child can
|
|
941
938
|
// exit before replying; that must close the proxy and fail the handshake.
|
|
@@ -950,7 +947,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
950
947
|
remoteCwd: rootDir,
|
|
951
948
|
runner: createLocalSandboxRunner(),
|
|
952
949
|
},
|
|
953
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
950
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
954
951
|
adapterKey: "acpx",
|
|
955
952
|
command: exitCode === null ? path.join(rootDir, "missing-agent") : process.execPath,
|
|
956
953
|
args: ["-e", `process.stdout.write("final output\\n".repeat(16_384)); process.stderr.write("final diagnostic\\n"); process.exitCode = ${exitCode};`],
|
|
@@ -967,7 +964,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
967
964
|
expect(result.code).toBe(exitCode ?? 1);
|
|
968
965
|
const terminal = logs.filter((line) => line.includes("ACP process session terminal:"));
|
|
969
966
|
expect(terminal).toEqual([
|
|
970
|
-
`[
|
|
967
|
+
`[wardmote] ACP process session terminal: source=remote_event outcome=${exitCode === null ? "error" : "exit"} exitCode=${exitCode ?? "unknown"} signal=unknown.\n`,
|
|
971
968
|
]);
|
|
972
969
|
if (exitCode === null) {
|
|
973
970
|
expect(result.stdout).toBe("");
|
|
@@ -983,7 +980,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
983
980
|
}
|
|
984
981
|
}, 15_000);
|
|
985
982
|
it("flushes remote errors under backpressure and retains only bounded terminal evidence", async () => {
|
|
986
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
983
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-terminal-flush-"));
|
|
987
984
|
cleanupDirs.push(rootDir);
|
|
988
985
|
const delegate = createLocalSandboxRunner();
|
|
989
986
|
const logs = [];
|
|
@@ -1057,7 +1054,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1057
1054
|
await closed;
|
|
1058
1055
|
expect(JSON.parse(output)).toEqual(frame);
|
|
1059
1056
|
expect(logs.filter((line) => line.includes("ACP process session terminal:"))).toEqual([
|
|
1060
|
-
"[
|
|
1057
|
+
"[wardmote] ACP process session terminal: source=remote_event outcome=error exitCode=unknown signal=unknown.\n",
|
|
1061
1058
|
]);
|
|
1062
1059
|
}
|
|
1063
1060
|
finally {
|
|
@@ -1068,7 +1065,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1068
1065
|
}
|
|
1069
1066
|
}, 15_000);
|
|
1070
1067
|
it("reports a streamed transport failure even when diagnostic persistence stalls", async () => {
|
|
1071
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1068
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-terminal-stream-"));
|
|
1072
1069
|
cleanupDirs.push(rootDir);
|
|
1073
1070
|
const delegate = createLocalSandboxRunner();
|
|
1074
1071
|
const logs = [];
|
|
@@ -1096,7 +1093,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1096
1093
|
const result = await runProxyWithInput(bridge.agentCommand, "", true);
|
|
1097
1094
|
expect(result.code).toBe(1);
|
|
1098
1095
|
expect(logs).toEqual([
|
|
1099
|
-
"[
|
|
1096
|
+
"[wardmote] ACP process session terminal: source=output_stream outcome=error exitCode=unknown signal=unknown.\n",
|
|
1100
1097
|
]);
|
|
1101
1098
|
}
|
|
1102
1099
|
finally {
|
|
@@ -1105,7 +1102,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1105
1102
|
}
|
|
1106
1103
|
}, 10_000);
|
|
1107
1104
|
it("closes a failed output poll without waiting for the run log", async () => {
|
|
1108
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1105
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-terminal-poll-"));
|
|
1109
1106
|
cleanupDirs.push(rootDir);
|
|
1110
1107
|
const delegate = createLocalSandboxRunner();
|
|
1111
1108
|
const logs = [];
|
|
@@ -1134,7 +1131,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1134
1131
|
const result = await runProxyWithInput(bridge.agentCommand, "", true);
|
|
1135
1132
|
expect(result.code).toBe(1);
|
|
1136
1133
|
expect(logs).toEqual([
|
|
1137
|
-
"[
|
|
1134
|
+
"[wardmote] ACP process session terminal: source=output_poll outcome=error exitCode=unknown signal=unknown.\n",
|
|
1138
1135
|
]);
|
|
1139
1136
|
}
|
|
1140
1137
|
finally {
|
|
@@ -1143,7 +1140,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1143
1140
|
}
|
|
1144
1141
|
}, 10_000);
|
|
1145
1142
|
it("records an unexpected authenticated proxy close once and ignores unauthenticated peers", async () => {
|
|
1146
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1143
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-terminal-proxy-"));
|
|
1147
1144
|
cleanupDirs.push(rootDir);
|
|
1148
1145
|
const logs = [];
|
|
1149
1146
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
@@ -1173,7 +1170,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1173
1170
|
await waitForCondition(() => logs.length === 1, "Missing proxy-close diagnostic.");
|
|
1174
1171
|
await bridge.stop();
|
|
1175
1172
|
expect(logs.filter((line) => line.includes("ACP process session terminal:"))).toEqual([
|
|
1176
|
-
"[
|
|
1173
|
+
"[wardmote] ACP process session terminal: source=proxy_close outcome=error exitCode=unknown signal=unknown.\n",
|
|
1177
1174
|
]);
|
|
1178
1175
|
}
|
|
1179
1176
|
finally {
|
|
@@ -1181,7 +1178,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1181
1178
|
}
|
|
1182
1179
|
}, 10_000);
|
|
1183
1180
|
it("buffers sandbox process session output until the local proxy connects", async () => {
|
|
1184
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1181
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-buffer-"));
|
|
1185
1182
|
cleanupDirs.push(rootDir);
|
|
1186
1183
|
const childPath = path.join(rootDir, "fast-acp-child.mjs");
|
|
1187
1184
|
await writeFile(childPath, [
|
|
@@ -1200,7 +1197,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1200
1197
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1201
1198
|
runId: "run-process-session-buffer",
|
|
1202
1199
|
target,
|
|
1203
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1200
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1204
1201
|
adapterKey: "acpx",
|
|
1205
1202
|
command: process.execPath,
|
|
1206
1203
|
args: [childPath],
|
|
@@ -1222,7 +1219,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1222
1219
|
}
|
|
1223
1220
|
});
|
|
1224
1221
|
it("delivers full output when the sandbox child exits immediately after writing", async () => {
|
|
1225
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1222
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-fast-exit-"));
|
|
1226
1223
|
cleanupDirs.push(rootDir);
|
|
1227
1224
|
const childPath = path.join(rootDir, "instant-exit-acp-child.mjs");
|
|
1228
1225
|
await writeFile(childPath, [
|
|
@@ -1240,7 +1237,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1240
1237
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1241
1238
|
runId: "run-process-session-fast-exit",
|
|
1242
1239
|
target,
|
|
1243
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1240
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1244
1241
|
adapterKey: "acpx",
|
|
1245
1242
|
command: process.execPath,
|
|
1246
1243
|
args: [childPath],
|
|
@@ -1261,7 +1258,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1261
1258
|
}
|
|
1262
1259
|
});
|
|
1263
1260
|
it("ignores unauthenticated connections to the process session bridge", async () => {
|
|
1264
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1261
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-auth-"));
|
|
1265
1262
|
cleanupDirs.push(rootDir);
|
|
1266
1263
|
const childPath = path.join(rootDir, "guarded-acp-child.mjs");
|
|
1267
1264
|
await writeFile(childPath, "process.stdout.write('guarded-out\\n');", "utf8");
|
|
@@ -1276,7 +1273,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1276
1273
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1277
1274
|
runId: "run-process-session-auth",
|
|
1278
1275
|
target,
|
|
1279
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1276
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1280
1277
|
adapterKey: "acpx",
|
|
1281
1278
|
command: process.execPath,
|
|
1282
1279
|
args: [childPath],
|
|
@@ -1322,7 +1319,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1322
1319
|
}
|
|
1323
1320
|
});
|
|
1324
1321
|
it("streams sandbox process session output before the remote child exits", async () => {
|
|
1325
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1322
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-stream-"));
|
|
1326
1323
|
cleanupDirs.push(rootDir);
|
|
1327
1324
|
const childPath = path.join(rootDir, "streaming-acp-child.mjs");
|
|
1328
1325
|
await writeFile(childPath, [
|
|
@@ -1347,7 +1344,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1347
1344
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1348
1345
|
runId: "run-process-session-stream",
|
|
1349
1346
|
target,
|
|
1350
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1347
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1351
1348
|
adapterKey: "acpx",
|
|
1352
1349
|
command: process.execPath,
|
|
1353
1350
|
args: [childPath],
|
|
@@ -1401,7 +1398,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1401
1398
|
});
|
|
1402
1399
|
describe("streamed output (streamOutputViaSession)", () => {
|
|
1403
1400
|
it("bridges bidirectional sessions when the wrapper streams output to stdout", async () => {
|
|
1404
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1401
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-stream-echo-"));
|
|
1405
1402
|
cleanupDirs.push(rootDir);
|
|
1406
1403
|
const childPath = path.join(rootDir, "echo-acp-child.mjs");
|
|
1407
1404
|
await writeFile(childPath, [
|
|
@@ -1421,7 +1418,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1421
1418
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1422
1419
|
runId: "run-stream-echo",
|
|
1423
1420
|
target,
|
|
1424
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1421
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1425
1422
|
adapterKey: "acpx",
|
|
1426
1423
|
command: process.execPath,
|
|
1427
1424
|
args: [childPath],
|
|
@@ -1434,7 +1431,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1434
1431
|
expect(bridge).not.toBeNull();
|
|
1435
1432
|
try {
|
|
1436
1433
|
const result = await runProxyWithInput(bridge.agentCommand, "hello\n");
|
|
1437
|
-
const report = await describeProxyRun(result, path.posix.join(rootDir, ".
|
|
1434
|
+
const report = await describeProxyRun(result, path.posix.join(rootDir, ".wardmote-runtime", "acpx"));
|
|
1438
1435
|
expect(result.code, report).toBe(0);
|
|
1439
1436
|
expect(result.stdout, report).toBe("out:hello\n");
|
|
1440
1437
|
expect(result.stderr, report).toBe("err:hello\n");
|
|
@@ -1449,7 +1446,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1449
1446
|
// step) and stay open around the launch. Record the opened span names and
|
|
1450
1447
|
// prove `sandbox.agentProcess` is among them, and that a normal exchange
|
|
1451
1448
|
// still works through the wrap.
|
|
1452
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1449
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-stream-span-"));
|
|
1453
1450
|
cleanupDirs.push(rootDir);
|
|
1454
1451
|
const childPath = path.join(rootDir, "echo-acp-child.mjs");
|
|
1455
1452
|
await writeFile(childPath, [
|
|
@@ -1469,7 +1466,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1469
1466
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1470
1467
|
runId: "run-stream-span",
|
|
1471
1468
|
target,
|
|
1472
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1469
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1473
1470
|
adapterKey: "acpx",
|
|
1474
1471
|
command: process.execPath,
|
|
1475
1472
|
args: [childPath],
|
|
@@ -1490,7 +1487,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1490
1487
|
// frame flows, so it is observable as soon as the handle resolves.
|
|
1491
1488
|
expect(spanNames).toContain("sandbox.agentProcess");
|
|
1492
1489
|
const result = await runProxyWithInput(bridge.agentCommand, "hello\n");
|
|
1493
|
-
const report = await describeProxyRun(result, path.posix.join(rootDir, ".
|
|
1490
|
+
const report = await describeProxyRun(result, path.posix.join(rootDir, ".wardmote-runtime", "acpx"));
|
|
1494
1491
|
expect(result.code, report).toBe(0);
|
|
1495
1492
|
expect(result.stdout, report).toBe("out:hello\n");
|
|
1496
1493
|
}
|
|
@@ -1504,7 +1501,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1504
1501
|
// `bridge.process-session` bring-up step — otherwise it dangles past its
|
|
1505
1502
|
// parent and overlaps `agent.turn`. Build the real run-rooted runner from a
|
|
1506
1503
|
// recording trace context and assert the recorded parent.
|
|
1507
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1504
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-stream-parent-"));
|
|
1508
1505
|
cleanupDirs.push(rootDir);
|
|
1509
1506
|
const childPath = path.join(rootDir, "noop-acp-child.mjs");
|
|
1510
1507
|
await writeFile(childPath, "process.stdin.on('data', () => {});\n", "utf8");
|
|
@@ -1525,7 +1522,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1525
1522
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1526
1523
|
runId: "run-stream-parent",
|
|
1527
1524
|
target,
|
|
1528
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1525
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1529
1526
|
adapterKey: "acpx",
|
|
1530
1527
|
command: process.execPath,
|
|
1531
1528
|
args: [childPath],
|
|
@@ -1552,7 +1549,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1552
1549
|
// at `stop()`, which the caller awaits before it ends `task.run`. Use a
|
|
1553
1550
|
// child that ignores stdin and never exits on its own, so the launch
|
|
1554
1551
|
// command stays pending across `stop()`, and prove the span ends anyway.
|
|
1555
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1552
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-stream-linger-"));
|
|
1556
1553
|
cleanupDirs.push(rootDir);
|
|
1557
1554
|
const childPath = path.join(rootDir, "linger-acp-child.mjs");
|
|
1558
1555
|
await writeFile(childPath, [
|
|
@@ -1574,7 +1571,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1574
1571
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1575
1572
|
runId: "run-stream-linger",
|
|
1576
1573
|
target,
|
|
1577
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1574
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1578
1575
|
adapterKey: "acpx",
|
|
1579
1576
|
command: process.execPath,
|
|
1580
1577
|
args: [childPath],
|
|
@@ -1606,7 +1603,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1606
1603
|
expect(record.ended).toBe(true);
|
|
1607
1604
|
});
|
|
1608
1605
|
it("buffers streamed output until the local proxy connects", async () => {
|
|
1609
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1606
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-stream-buffer-"));
|
|
1610
1607
|
cleanupDirs.push(rootDir);
|
|
1611
1608
|
const childPath = path.join(rootDir, "fast-stream-child.mjs");
|
|
1612
1609
|
await writeFile(childPath, [
|
|
@@ -1625,7 +1622,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1625
1622
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1626
1623
|
runId: "run-stream-buffer",
|
|
1627
1624
|
target,
|
|
1628
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1625
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1629
1626
|
adapterKey: "acpx",
|
|
1630
1627
|
command: process.execPath,
|
|
1631
1628
|
args: [childPath],
|
|
@@ -1650,7 +1647,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1650
1647
|
}
|
|
1651
1648
|
});
|
|
1652
1649
|
it("delivers full streamed output when the sandbox child exits immediately", async () => {
|
|
1653
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1650
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-stream-fast-exit-"));
|
|
1654
1651
|
cleanupDirs.push(rootDir);
|
|
1655
1652
|
const childPath = path.join(rootDir, "instant-stream-child.mjs");
|
|
1656
1653
|
await writeFile(childPath, [
|
|
@@ -1668,7 +1665,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1668
1665
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1669
1666
|
runId: "run-stream-fast-exit",
|
|
1670
1667
|
target,
|
|
1671
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1668
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1672
1669
|
adapterKey: "acpx",
|
|
1673
1670
|
command: process.execPath,
|
|
1674
1671
|
args: [childPath],
|
|
@@ -1690,7 +1687,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1690
1687
|
}
|
|
1691
1688
|
});
|
|
1692
1689
|
it("streams live output before the child exits and never writes output event files", async () => {
|
|
1693
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1690
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-stream-live-"));
|
|
1694
1691
|
cleanupDirs.push(rootDir);
|
|
1695
1692
|
const childPath = path.join(rootDir, "live-stream-child.mjs");
|
|
1696
1693
|
await writeFile(childPath, [
|
|
@@ -1715,7 +1712,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1715
1712
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1716
1713
|
runId: "run-stream-live",
|
|
1717
1714
|
target,
|
|
1718
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1715
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1719
1716
|
adapterKey: "acpx",
|
|
1720
1717
|
command: process.execPath,
|
|
1721
1718
|
args: [childPath],
|
|
@@ -1761,7 +1758,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1761
1758
|
await expect(exitPromise).resolves.toBe(0);
|
|
1762
1759
|
// The streamed path uses the stdout wrapper, not the output-file poll, so
|
|
1763
1760
|
// no `events` directory is ever created under the session runtime tree.
|
|
1764
|
-
const hasEventsDir = await readdir(path.posix.join(rootDir, ".
|
|
1761
|
+
const hasEventsDir = await readdir(path.posix.join(rootDir, ".wardmote-runtime", "acpx", "process-sessions"), { withFileTypes: true, recursive: true })
|
|
1765
1762
|
.then((entries) => entries.some((entry) => entry.isDirectory() && entry.name === "events"))
|
|
1766
1763
|
.catch(() => false);
|
|
1767
1764
|
expect(hasEventsDir).toBe(false);
|
|
@@ -1782,7 +1779,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1782
1779
|
// teardown) must run concurrently with the agent, so each must force
|
|
1783
1780
|
// itself off the session. On the session they queue behind the agent
|
|
1784
1781
|
// command that never returns, and the first handshake write never drains.
|
|
1785
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1782
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-process-session-stream-isolation-"));
|
|
1786
1783
|
cleanupDirs.push(rootDir);
|
|
1787
1784
|
const childPath = path.join(rootDir, "echo-acp-child.mjs");
|
|
1788
1785
|
await writeFile(childPath, [
|
|
@@ -1814,7 +1811,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1814
1811
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1815
1812
|
runId: "run-stream-isolation",
|
|
1816
1813
|
target,
|
|
1817
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1814
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1818
1815
|
adapterKey: "acpx",
|
|
1819
1816
|
command: process.execPath,
|
|
1820
1817
|
args: [childPath],
|
|
@@ -1829,7 +1826,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
1829
1826
|
// Round-trip one input so a stdin-delivery control exec runs and gets
|
|
1830
1827
|
// recorded before the assertions below.
|
|
1831
1828
|
const result = await runProxyWithInput(bridge.agentCommand, "hello\n");
|
|
1832
|
-
expect(result.stdout, await describeProxyRun(result, path.posix.join(rootDir, ".
|
|
1829
|
+
expect(result.stdout, await describeProxyRun(result, path.posix.join(rootDir, ".wardmote-runtime", "acpx"))).toBe("out:hello\n");
|
|
1833
1830
|
// Exactly one exec runs on the persistent session: the long-lived agent
|
|
1834
1831
|
// command. It streams its output through the session log stream, so it
|
|
1835
1832
|
// must not also bypass the session.
|
|
@@ -2171,7 +2168,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2171
2168
|
strictHostKeyChecking: true,
|
|
2172
2169
|
},
|
|
2173
2170
|
};
|
|
2174
|
-
expect(
|
|
2171
|
+
expect(adapterExecutionTargetUsesWardmoteBridge(target)).toBe(true);
|
|
2175
2172
|
expect(adapterExecutionTargetSessionIdentity(target)).toEqual({
|
|
2176
2173
|
transport: "ssh",
|
|
2177
2174
|
host: "ssh.example.test",
|
|
@@ -2212,11 +2209,11 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2212
2209
|
timeoutMs: 7000,
|
|
2213
2210
|
}));
|
|
2214
2211
|
});
|
|
2215
|
-
it("starts a localhost
|
|
2216
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2212
|
+
it("starts a localhost Wardmote bridge for sandbox targets in bridge mode", async () => {
|
|
2213
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-execution-target-bridge-"));
|
|
2217
2214
|
cleanupDirs.push(rootDir);
|
|
2218
2215
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
2219
|
-
const runtimeRootDir = path.join(remoteCwd, ".
|
|
2216
|
+
const runtimeRootDir = path.join(remoteCwd, ".wardmote-runtime", "codex");
|
|
2220
2217
|
await mkdir(runtimeRootDir, { recursive: true });
|
|
2221
2218
|
const requests = [];
|
|
2222
2219
|
const apiServer = createServer((req, res) => {
|
|
@@ -2224,7 +2221,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2224
2221
|
method: req.method ?? "GET",
|
|
2225
2222
|
url: req.url ?? "/",
|
|
2226
2223
|
auth: req.headers.authorization ?? null,
|
|
2227
|
-
runId: typeof req.headers["x-
|
|
2224
|
+
runId: typeof req.headers["x-wardmote-run-id"] === "string" ? req.headers["x-wardmote-run-id"] : null,
|
|
2228
2225
|
});
|
|
2229
2226
|
res.writeHead(200, { "content-type": "application/json" });
|
|
2230
2227
|
res.end(JSON.stringify({ ok: true }));
|
|
@@ -2247,7 +2244,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2247
2244
|
runner: createLocalSandboxRunner(),
|
|
2248
2245
|
timeoutMs: 30_000,
|
|
2249
2246
|
};
|
|
2250
|
-
const bridge = await
|
|
2247
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
2251
2248
|
runId: "run-bridge",
|
|
2252
2249
|
target,
|
|
2253
2250
|
runtimeRootDir,
|
|
@@ -2257,12 +2254,12 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2257
2254
|
});
|
|
2258
2255
|
try {
|
|
2259
2256
|
expect(bridge).not.toBeNull();
|
|
2260
|
-
expect(bridge?.env.
|
|
2261
|
-
expect(bridge?.env.
|
|
2262
|
-
expect(bridge?.env.
|
|
2263
|
-
const response = await fetch(`${bridge.env.
|
|
2257
|
+
expect(bridge?.env.WARDMOTE_API_URL).toMatch(/^http:\/\/127\.0\.0\.1:\d+$/);
|
|
2258
|
+
expect(bridge?.env.WARDMOTE_API_KEY).not.toBe("real-run-jwt");
|
|
2259
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
2260
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/agents/me`, {
|
|
2264
2261
|
headers: {
|
|
2265
|
-
authorization: `Bearer ${bridge.env.
|
|
2262
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
2266
2263
|
accept: "application/json",
|
|
2267
2264
|
},
|
|
2268
2265
|
});
|
|
@@ -2281,10 +2278,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2281
2278
|
}
|
|
2282
2279
|
});
|
|
2283
2280
|
it("creates a sandbox run log tail factory when bridge streaming is enabled", async () => {
|
|
2284
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2281
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-execution-target-bridge-stream-"));
|
|
2285
2282
|
cleanupDirs.push(rootDir);
|
|
2286
2283
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
2287
|
-
const runtimeRootDir = path.join(remoteCwd, ".
|
|
2284
|
+
const runtimeRootDir = path.join(remoteCwd, ".wardmote-runtime", "codex");
|
|
2288
2285
|
await mkdir(runtimeRootDir, { recursive: true });
|
|
2289
2286
|
const logs = [];
|
|
2290
2287
|
const target = {
|
|
@@ -2298,7 +2295,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2298
2295
|
streamRunLogs: true,
|
|
2299
2296
|
timeoutMs: 30_000,
|
|
2300
2297
|
};
|
|
2301
|
-
const bridge = await
|
|
2298
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
2302
2299
|
runId: "run-bridge-stream",
|
|
2303
2300
|
target,
|
|
2304
2301
|
runtimeRootDir,
|
|
@@ -2322,10 +2319,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2322
2319
|
}
|
|
2323
2320
|
});
|
|
2324
2321
|
it("defaults sandbox run log streaming on and honors the explicit opt-out", async () => {
|
|
2325
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2322
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-execution-target-bridge-stream-default-"));
|
|
2326
2323
|
cleanupDirs.push(rootDir);
|
|
2327
2324
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
2328
|
-
const runtimeRootDir = path.join(remoteCwd, ".
|
|
2325
|
+
const runtimeRootDir = path.join(remoteCwd, ".wardmote-runtime", "codex");
|
|
2329
2326
|
await mkdir(runtimeRootDir, { recursive: true });
|
|
2330
2327
|
const baseTarget = {
|
|
2331
2328
|
kind: "remote",
|
|
@@ -2337,7 +2334,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2337
2334
|
runner: createLocalSandboxRunner(),
|
|
2338
2335
|
timeoutMs: 30_000,
|
|
2339
2336
|
};
|
|
2340
|
-
const defaultBridge = await
|
|
2337
|
+
const defaultBridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
2341
2338
|
runId: "run-bridge-stream-default",
|
|
2342
2339
|
target: baseTarget,
|
|
2343
2340
|
runtimeRootDir,
|
|
@@ -2351,7 +2348,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2351
2348
|
finally {
|
|
2352
2349
|
await defaultBridge?.stop();
|
|
2353
2350
|
}
|
|
2354
|
-
const optOutBridge = await
|
|
2351
|
+
const optOutBridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
2355
2352
|
runId: "run-bridge-stream-opt-out",
|
|
2356
2353
|
target: { ...baseTarget, streamRunLogs: false },
|
|
2357
2354
|
runtimeRootDir,
|
|
@@ -2396,7 +2393,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2396
2393
|
const tail = createSandboxRunLogTailFactory({
|
|
2397
2394
|
runner,
|
|
2398
2395
|
remoteCwd: "/workspace",
|
|
2399
|
-
logsDir: "/workspace/.
|
|
2396
|
+
logsDir: "/workspace/.wardmote-runtime/codex/wardmote-bridge/queue/logs",
|
|
2400
2397
|
pollIntervalMs: 1,
|
|
2401
2398
|
maxChunkBytesPerTick: 4,
|
|
2402
2399
|
tickTimeoutMs: 50,
|
|
@@ -2413,7 +2410,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2413
2410
|
expect(runner.execute).toHaveBeenCalledWith(expect.objectContaining({
|
|
2414
2411
|
command: "sh",
|
|
2415
2412
|
cwd: "/workspace",
|
|
2416
|
-
env: {
|
|
2413
|
+
env: { WARDMOTE_SANDBOX_EXEC_CHANNEL: "bridge" },
|
|
2417
2414
|
timeoutMs: 50,
|
|
2418
2415
|
}));
|
|
2419
2416
|
});
|
|
@@ -2440,7 +2437,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2440
2437
|
const tail = createSandboxRunLogTailFactory({
|
|
2441
2438
|
runner,
|
|
2442
2439
|
remoteCwd: "/workspace",
|
|
2443
|
-
logsDir: "/workspace/.
|
|
2440
|
+
logsDir: "/workspace/.wardmote-runtime/codex/wardmote-bridge/queue/logs",
|
|
2444
2441
|
pollIntervalMs: 1,
|
|
2445
2442
|
maxChunkBytesPerTick: 7,
|
|
2446
2443
|
tickTimeoutMs: 50,
|
|
@@ -2470,7 +2467,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2470
2467
|
const tail = createSandboxRunLogTailFactory({
|
|
2471
2468
|
runner,
|
|
2472
2469
|
remoteCwd: "/workspace",
|
|
2473
|
-
logsDir: "/workspace/.
|
|
2470
|
+
logsDir: "/workspace/.wardmote-runtime/codex/wardmote-bridge/queue/logs",
|
|
2474
2471
|
pollIntervalMs: 1,
|
|
2475
2472
|
tickTimeoutMs: 50,
|
|
2476
2473
|
maxConsecutiveFailures: 1,
|
|
@@ -2482,13 +2479,13 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2482
2479
|
await new Promise((resolve) => setTimeout(resolve, 5));
|
|
2483
2480
|
await tail.finish({ stdout: "final out\n", stderr: "final err\n" });
|
|
2484
2481
|
expect(combinedStream(events, "stdout")).toBe("final out\n");
|
|
2485
|
-
expect(combinedStream(events, "stderr")).toBe("final err\n[
|
|
2482
|
+
expect(combinedStream(events, "stderr")).toBe("final err\n[wardmote] Run log streaming degraded during the run; remaining output was delivered at completion.\n");
|
|
2486
2483
|
});
|
|
2487
|
-
it("exposes the
|
|
2488
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2484
|
+
it("exposes the Wardmote bridge to the sandbox shell surface", async () => {
|
|
2485
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-execution-target-bridge-shell-"));
|
|
2489
2486
|
cleanupDirs.push(rootDir);
|
|
2490
2487
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
2491
|
-
const runtimeRootDir = path.join(remoteCwd, ".
|
|
2488
|
+
const runtimeRootDir = path.join(remoteCwd, ".wardmote-runtime", "claude");
|
|
2492
2489
|
await mkdir(runtimeRootDir, { recursive: true });
|
|
2493
2490
|
const requests = [];
|
|
2494
2491
|
const apiServer = createServer((req, res) => {
|
|
@@ -2496,7 +2493,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2496
2493
|
method: req.method ?? "GET",
|
|
2497
2494
|
url: req.url ?? "/",
|
|
2498
2495
|
auth: req.headers.authorization ?? null,
|
|
2499
|
-
runId: typeof req.headers["x-
|
|
2496
|
+
runId: typeof req.headers["x-wardmote-run-id"] === "string" ? req.headers["x-wardmote-run-id"] : null,
|
|
2500
2497
|
});
|
|
2501
2498
|
res.writeHead(200, { "content-type": "application/json" });
|
|
2502
2499
|
res.end(JSON.stringify({ ok: true }));
|
|
@@ -2523,7 +2520,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2523
2520
|
runner,
|
|
2524
2521
|
timeoutMs: 30_000,
|
|
2525
2522
|
};
|
|
2526
|
-
const bridge = await
|
|
2523
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
2527
2524
|
runId: "run-bridge-shell",
|
|
2528
2525
|
target,
|
|
2529
2526
|
runtimeRootDir,
|
|
@@ -2534,14 +2531,14 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2534
2531
|
try {
|
|
2535
2532
|
expect(bridge).not.toBeNull();
|
|
2536
2533
|
const shellProbe = [
|
|
2537
|
-
"const url = `${process.env.
|
|
2538
|
-
"fetch(url, { headers: { authorization: `Bearer ${process.env.
|
|
2534
|
+
"const url = `${process.env.WARDMOTE_API_URL}/api/agents/me`;",
|
|
2535
|
+
"fetch(url, { headers: { authorization: `Bearer ${process.env.WARDMOTE_API_KEY}`, accept: 'application/json' } })",
|
|
2539
2536
|
" .then(async (response) => {",
|
|
2540
2537
|
" const body = await response.json();",
|
|
2541
2538
|
" process.stdout.write(JSON.stringify({",
|
|
2542
2539
|
" status: response.status,",
|
|
2543
2540
|
" body,",
|
|
2544
|
-
" bridgeMode: process.env.
|
|
2541
|
+
" bridgeMode: process.env.WARDMOTE_API_BRIDGE_MODE,",
|
|
2545
2542
|
" }));",
|
|
2546
2543
|
" })",
|
|
2547
2544
|
" .catch((error) => {",
|
|
@@ -2564,16 +2561,16 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2564
2561
|
bridgeMode: "queue_v1",
|
|
2565
2562
|
});
|
|
2566
2563
|
expect(`${result.stdout}\n${result.stderr}`).not.toContain("real-run-jwt");
|
|
2567
|
-
expect(`${result.stdout}\n${result.stderr}`).not.toContain(bridge.env.
|
|
2564
|
+
expect(`${result.stdout}\n${result.stderr}`).not.toContain(bridge.env.WARDMOTE_API_KEY);
|
|
2568
2565
|
const runnerCommandText = JSON.stringify(runner.execute.mock.calls.map(([call]) => ({
|
|
2569
2566
|
command: call.command,
|
|
2570
2567
|
args: call.args,
|
|
2571
2568
|
})));
|
|
2572
2569
|
expect(runnerCommandText).not.toContain("real-run-jwt");
|
|
2573
|
-
expect(runnerCommandText).not.toContain(bridge.env.
|
|
2570
|
+
expect(runnerCommandText).not.toContain(bridge.env.WARDMOTE_API_KEY);
|
|
2574
2571
|
const runtimeFiles = (await readRuntimeTextFiles(runtimeRootDir)).join("\n");
|
|
2575
2572
|
expect(runtimeFiles).not.toContain("real-run-jwt");
|
|
2576
|
-
expect(runtimeFiles).not.toContain(bridge.env.
|
|
2573
|
+
expect(runtimeFiles).not.toContain(bridge.env.WARDMOTE_API_KEY);
|
|
2577
2574
|
expect(requests).toEqual([{
|
|
2578
2575
|
method: "GET",
|
|
2579
2576
|
url: "/api/agents/me",
|
|
@@ -2587,10 +2584,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2587
2584
|
}
|
|
2588
2585
|
});
|
|
2589
2586
|
it("bounds callback bridge operations independently of the adapter run timeout", async () => {
|
|
2590
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2587
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-execution-target-bridge-timeout-"));
|
|
2591
2588
|
cleanupDirs.push(rootDir);
|
|
2592
2589
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
2593
|
-
const runtimeRootDir = path.join(remoteCwd, ".
|
|
2590
|
+
const runtimeRootDir = path.join(remoteCwd, ".wardmote-runtime", "codex");
|
|
2594
2591
|
await mkdir(runtimeRootDir, { recursive: true });
|
|
2595
2592
|
const delegateRunner = createLocalSandboxRunner();
|
|
2596
2593
|
const runner = {
|
|
@@ -2618,7 +2615,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2618
2615
|
runner,
|
|
2619
2616
|
timeoutMs: 30_000,
|
|
2620
2617
|
};
|
|
2621
|
-
const bridge = await
|
|
2618
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
2622
2619
|
runId: "run-bridge-timeout",
|
|
2623
2620
|
target,
|
|
2624
2621
|
runtimeRootDir,
|
|
@@ -2648,10 +2645,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2648
2645
|
// a retryable 502. The in-sandbox server maps the indeterminate 504 to a
|
|
2649
2646
|
// non-retryable 409. A retryable status would repeat the mutation with a new
|
|
2650
2647
|
// request id outside the broker deduplication set.
|
|
2651
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2648
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-execution-target-bridge-limit-"));
|
|
2652
2649
|
cleanupDirs.push(rootDir);
|
|
2653
2650
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
2654
|
-
const runtimeRootDir = path.join(remoteCwd, ".
|
|
2651
|
+
const runtimeRootDir = path.join(remoteCwd, ".wardmote-runtime", "codex");
|
|
2655
2652
|
await mkdir(runtimeRootDir, { recursive: true });
|
|
2656
2653
|
const requests = [];
|
|
2657
2654
|
// The host body sits over the size limit, so the forward read fails. The
|
|
@@ -2663,7 +2660,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2663
2660
|
method: req.method ?? "GET",
|
|
2664
2661
|
url: req.url ?? "/",
|
|
2665
2662
|
auth: req.headers.authorization ?? null,
|
|
2666
|
-
runId: typeof req.headers["x-
|
|
2663
|
+
runId: typeof req.headers["x-wardmote-run-id"] === "string" ? req.headers["x-wardmote-run-id"] : null,
|
|
2667
2664
|
});
|
|
2668
2665
|
res.writeHead(201, {
|
|
2669
2666
|
"content-type": "application/json",
|
|
@@ -2689,7 +2686,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2689
2686
|
runner: createLocalSandboxRunner(),
|
|
2690
2687
|
timeoutMs: 30_000,
|
|
2691
2688
|
};
|
|
2692
|
-
const bridge = await
|
|
2689
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
2693
2690
|
runId: "run-bridge-limit",
|
|
2694
2691
|
target,
|
|
2695
2692
|
runtimeRootDir,
|
|
@@ -2699,10 +2696,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2699
2696
|
maxBodyBytes: 512,
|
|
2700
2697
|
});
|
|
2701
2698
|
try {
|
|
2702
|
-
const response = await fetch(`${bridge.env.
|
|
2699
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/issues/issue-1/comments`, {
|
|
2703
2700
|
method: "POST",
|
|
2704
2701
|
headers: {
|
|
2705
|
-
authorization: `Bearer ${bridge.env.
|
|
2702
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
2706
2703
|
"content-type": "application/json",
|
|
2707
2704
|
},
|
|
2708
2705
|
body: JSON.stringify({ body: "Status update." }),
|
|
@@ -2710,7 +2707,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2710
2707
|
// The indeterminate 504 maps to a non-retryable 409, so the caller does not
|
|
2711
2708
|
// retry the committed mutation.
|
|
2712
2709
|
expect(response.status).toBe(409);
|
|
2713
|
-
expect(response.headers.get("x-
|
|
2710
|
+
expect(response.headers.get("x-wardmote-bridge-outcome")).toBe("indeterminate");
|
|
2714
2711
|
await expect(response.json()).resolves.toEqual({
|
|
2715
2712
|
error: "Bridge response body exceeded the configured size limit of 512 bytes.",
|
|
2716
2713
|
outcome: "indeterminate",
|
|
@@ -2736,10 +2733,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2736
2733
|
// retryable 502 with no indeterminate marker, not the non-retryable 504 the
|
|
2737
2734
|
// forward returns for a mutating method. The in-sandbox server passes the 502
|
|
2738
2735
|
// through, so the caller can retry the safe read.
|
|
2739
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2736
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-execution-target-bridge-safe-limit-"));
|
|
2740
2737
|
cleanupDirs.push(rootDir);
|
|
2741
2738
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
2742
|
-
const runtimeRootDir = path.join(remoteCwd, ".
|
|
2739
|
+
const runtimeRootDir = path.join(remoteCwd, ".wardmote-runtime", "codex");
|
|
2743
2740
|
await mkdir(runtimeRootDir, { recursive: true });
|
|
2744
2741
|
const requests = [];
|
|
2745
2742
|
const largeBody = "x".repeat(1024);
|
|
@@ -2748,7 +2745,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2748
2745
|
method: req.method ?? "GET",
|
|
2749
2746
|
url: req.url ?? "/",
|
|
2750
2747
|
auth: req.headers.authorization ?? null,
|
|
2751
|
-
runId: typeof req.headers["x-
|
|
2748
|
+
runId: typeof req.headers["x-wardmote-run-id"] === "string" ? req.headers["x-wardmote-run-id"] : null,
|
|
2752
2749
|
});
|
|
2753
2750
|
res.writeHead(200, {
|
|
2754
2751
|
"content-type": "application/json",
|
|
@@ -2774,7 +2771,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2774
2771
|
runner: createLocalSandboxRunner(),
|
|
2775
2772
|
timeoutMs: 30_000,
|
|
2776
2773
|
};
|
|
2777
|
-
const bridge = await
|
|
2774
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
2778
2775
|
runId: "run-bridge-safe-limit",
|
|
2779
2776
|
target,
|
|
2780
2777
|
runtimeRootDir,
|
|
@@ -2784,16 +2781,16 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2784
2781
|
maxBodyBytes: 512,
|
|
2785
2782
|
});
|
|
2786
2783
|
try {
|
|
2787
|
-
const response = await fetch(`${bridge.env.
|
|
2784
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/issues/issue-1`, {
|
|
2788
2785
|
method: "GET",
|
|
2789
2786
|
headers: {
|
|
2790
|
-
authorization: `Bearer ${bridge.env.
|
|
2787
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
2791
2788
|
},
|
|
2792
2789
|
});
|
|
2793
2790
|
// The forward returns a retryable 502 with no indeterminate marker, so the
|
|
2794
2791
|
// server passes it through instead of mapping it to a terminal 409.
|
|
2795
2792
|
expect(response.status).toBe(502);
|
|
2796
|
-
expect(response.headers.get("x-
|
|
2793
|
+
expect(response.headers.get("x-wardmote-bridge-outcome")).toBeNull();
|
|
2797
2794
|
await expect(response.json()).resolves.toEqual({
|
|
2798
2795
|
error: "Bridge response body exceeded the configured size limit of 512 bytes.",
|
|
2799
2796
|
});
|
|
@@ -2810,21 +2807,16 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2810
2807
|
}
|
|
2811
2808
|
});
|
|
2812
2809
|
it("forwards the host indeterminate-outcome header so the sandbox server maps the 504 to a non-retryable 409", async () => {
|
|
2813
|
-
|
|
2814
|
-
// `x-paperclip-bridge-outcome: indeterminate` header. The forward must keep
|
|
2815
|
-
// that header, so the in-sandbox server maps the 504 to a non-retryable 409.
|
|
2816
|
-
// If the forward drops the header, the client sees a retryable 504 and a
|
|
2817
|
-
// retry repeats a mutation that already committed.
|
|
2818
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-execution-target-bridge-outcome-"));
|
|
2810
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-execution-target-bridge-outcome-"));
|
|
2819
2811
|
cleanupDirs.push(rootDir);
|
|
2820
2812
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
2821
|
-
const runtimeRootDir = path.join(remoteCwd, ".
|
|
2813
|
+
const runtimeRootDir = path.join(remoteCwd, ".wardmote-runtime", "codex");
|
|
2822
2814
|
await mkdir(runtimeRootDir, { recursive: true });
|
|
2823
2815
|
const responseBody = JSON.stringify({ error: "Mutation outcome is indeterminate.", outcome: "indeterminate", retryable: false });
|
|
2824
2816
|
const apiServer = createServer((_req, res) => {
|
|
2825
2817
|
res.writeHead(504, {
|
|
2826
2818
|
"content-type": "application/json",
|
|
2827
|
-
"x-
|
|
2819
|
+
"x-wardmote-bridge-outcome": "indeterminate",
|
|
2828
2820
|
});
|
|
2829
2821
|
res.end(responseBody);
|
|
2830
2822
|
});
|
|
@@ -2846,7 +2838,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2846
2838
|
runner: createLocalSandboxRunner(),
|
|
2847
2839
|
timeoutMs: 30_000,
|
|
2848
2840
|
};
|
|
2849
|
-
const bridge = await
|
|
2841
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
2850
2842
|
runId: "run-bridge-outcome",
|
|
2851
2843
|
target,
|
|
2852
2844
|
runtimeRootDir,
|
|
@@ -2855,10 +2847,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2855
2847
|
hostApiUrl: `http://127.0.0.1:${address.port}`,
|
|
2856
2848
|
});
|
|
2857
2849
|
try {
|
|
2858
|
-
const response = await fetch(`${bridge.env.
|
|
2850
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/issues/issue-1/comments`, {
|
|
2859
2851
|
method: "POST",
|
|
2860
2852
|
headers: {
|
|
2861
|
-
authorization: `Bearer ${bridge.env.
|
|
2853
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
2862
2854
|
"content-type": "application/json",
|
|
2863
2855
|
},
|
|
2864
2856
|
body: JSON.stringify({ body: "Status update." }),
|
|
@@ -2867,7 +2859,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2867
2859
|
expect(response.status).toBe(409);
|
|
2868
2860
|
// The outcome header and body still reach the client, so a caller that
|
|
2869
2861
|
// reads them still sees the indeterminate result.
|
|
2870
|
-
expect(response.headers.get("x-
|
|
2862
|
+
expect(response.headers.get("x-wardmote-bridge-outcome")).toBe("indeterminate");
|
|
2871
2863
|
await expect(response.json()).resolves.toEqual({
|
|
2872
2864
|
error: "Mutation outcome is indeterminate.",
|
|
2873
2865
|
outcome: "indeterminate",
|
|
@@ -2880,10 +2872,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2880
2872
|
}
|
|
2881
2873
|
});
|
|
2882
2874
|
it("forwards bridge traffic to the local listen origin even when public API URLs are configured", async () => {
|
|
2883
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2875
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-execution-target-bridge-local-"));
|
|
2884
2876
|
cleanupDirs.push(rootDir);
|
|
2885
2877
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
2886
|
-
const runtimeRootDir = path.join(remoteCwd, ".
|
|
2878
|
+
const runtimeRootDir = path.join(remoteCwd, ".wardmote-runtime", "claude");
|
|
2887
2879
|
await mkdir(runtimeRootDir, { recursive: true });
|
|
2888
2880
|
const requests = [];
|
|
2889
2881
|
const apiServer = createServer((req, res) => {
|
|
@@ -2891,7 +2883,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2891
2883
|
method: req.method ?? "GET",
|
|
2892
2884
|
url: req.url ?? "/",
|
|
2893
2885
|
auth: req.headers.authorization ?? null,
|
|
2894
|
-
runId: typeof req.headers["x-
|
|
2886
|
+
runId: typeof req.headers["x-wardmote-run-id"] === "string" ? req.headers["x-wardmote-run-id"] : null,
|
|
2895
2887
|
});
|
|
2896
2888
|
res.writeHead(200, { "content-type": "application/json" });
|
|
2897
2889
|
res.end(JSON.stringify({ ok: true }));
|
|
@@ -2905,14 +2897,14 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2905
2897
|
throw new Error("Expected the bridge local-origin test API server to listen on a TCP port.");
|
|
2906
2898
|
}
|
|
2907
2899
|
// Simulate a deployment where a public base URL is configured: server boot
|
|
2908
|
-
// exports the public origin via
|
|
2909
|
-
// and the local listen host/port via
|
|
2900
|
+
// exports the public origin via WARDMOTE_RUNTIME_API_URL / WARDMOTE_API_URL
|
|
2901
|
+
// and the local listen host/port via WARDMOTE_LISTEN_HOST / WARDMOTE_LISTEN_PORT.
|
|
2910
2902
|
// The wildcard listen host must map to the loopback address of the same
|
|
2911
2903
|
// family (0.0.0.0 -> 127.0.0.1), where the test API server is bound.
|
|
2912
|
-
vi.stubEnv("
|
|
2913
|
-
vi.stubEnv("
|
|
2914
|
-
vi.stubEnv("
|
|
2915
|
-
vi.stubEnv("
|
|
2904
|
+
vi.stubEnv("WARDMOTE_RUNTIME_API_URL", "https://public.example.invalid");
|
|
2905
|
+
vi.stubEnv("WARDMOTE_API_URL", "https://public.example.invalid");
|
|
2906
|
+
vi.stubEnv("WARDMOTE_LISTEN_HOST", "0.0.0.0");
|
|
2907
|
+
vi.stubEnv("WARDMOTE_LISTEN_PORT", String(address.port));
|
|
2916
2908
|
const target = {
|
|
2917
2909
|
kind: "remote",
|
|
2918
2910
|
transport: "sandbox",
|
|
@@ -2923,7 +2915,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2923
2915
|
runner: createLocalSandboxRunner(),
|
|
2924
2916
|
timeoutMs: 30_000,
|
|
2925
2917
|
};
|
|
2926
|
-
const bridge = await
|
|
2918
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
2927
2919
|
runId: "run-bridge-local",
|
|
2928
2920
|
target,
|
|
2929
2921
|
runtimeRootDir,
|
|
@@ -2932,9 +2924,9 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2932
2924
|
});
|
|
2933
2925
|
try {
|
|
2934
2926
|
expect(bridge).not.toBeNull();
|
|
2935
|
-
const response = await fetch(`${bridge.env.
|
|
2927
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/agents/me`, {
|
|
2936
2928
|
headers: {
|
|
2937
|
-
authorization: `Bearer ${bridge.env.
|
|
2929
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
2938
2930
|
accept: "application/json",
|
|
2939
2931
|
},
|
|
2940
2932
|
});
|
|
@@ -2953,10 +2945,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2953
2945
|
}
|
|
2954
2946
|
});
|
|
2955
2947
|
it("lets an explicit hostApiUrl input override the bridge forward target", async () => {
|
|
2956
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2948
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-execution-target-bridge-override-"));
|
|
2957
2949
|
cleanupDirs.push(rootDir);
|
|
2958
2950
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
2959
|
-
const runtimeRootDir = path.join(remoteCwd, ".
|
|
2951
|
+
const runtimeRootDir = path.join(remoteCwd, ".wardmote-runtime", "claude");
|
|
2960
2952
|
await mkdir(runtimeRootDir, { recursive: true });
|
|
2961
2953
|
const requests = [];
|
|
2962
2954
|
const apiServer = createServer((req, res) => {
|
|
@@ -2974,10 +2966,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2974
2966
|
}
|
|
2975
2967
|
// Neither the public URL envs nor the listen host/port should matter when
|
|
2976
2968
|
// the caller passes an explicit hostApiUrl.
|
|
2977
|
-
vi.stubEnv("
|
|
2978
|
-
vi.stubEnv("
|
|
2979
|
-
vi.stubEnv("
|
|
2980
|
-
vi.stubEnv("
|
|
2969
|
+
vi.stubEnv("WARDMOTE_RUNTIME_API_URL", "https://public.example.invalid");
|
|
2970
|
+
vi.stubEnv("WARDMOTE_API_URL", "https://public.example.invalid");
|
|
2971
|
+
vi.stubEnv("WARDMOTE_LISTEN_HOST", "203.0.113.1");
|
|
2972
|
+
vi.stubEnv("WARDMOTE_LISTEN_PORT", "9");
|
|
2981
2973
|
const target = {
|
|
2982
2974
|
kind: "remote",
|
|
2983
2975
|
transport: "sandbox",
|
|
@@ -2988,7 +2980,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2988
2980
|
runner: createLocalSandboxRunner(),
|
|
2989
2981
|
timeoutMs: 30_000,
|
|
2990
2982
|
};
|
|
2991
|
-
const bridge = await
|
|
2983
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
2992
2984
|
runId: "run-bridge-override",
|
|
2993
2985
|
target,
|
|
2994
2986
|
runtimeRootDir,
|
|
@@ -2998,9 +2990,9 @@ describe("sandbox adapter execution targets", () => {
|
|
|
2998
2990
|
});
|
|
2999
2991
|
try {
|
|
3000
2992
|
expect(bridge).not.toBeNull();
|
|
3001
|
-
const response = await fetch(`${bridge.env.
|
|
2993
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/agents/me`, {
|
|
3002
2994
|
headers: {
|
|
3003
|
-
authorization: `Bearer ${bridge.env.
|
|
2995
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
3004
2996
|
accept: "application/json",
|
|
3005
2997
|
},
|
|
3006
2998
|
});
|
|
@@ -3043,8 +3035,8 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3043
3035
|
const openDuplexChannel = async (openInput) => {
|
|
3044
3036
|
control.openCount += 1;
|
|
3045
3037
|
const joined = openInput.command.join(" ");
|
|
3046
|
-
const nonce = /
|
|
3047
|
-
const port = /
|
|
3038
|
+
const nonce = /WARDMOTE_BRIDGE_NONCE='([^']*)'/.exec(joined)?.[1] ?? "";
|
|
3039
|
+
const port = /WARDMOTE_BRIDGE_PORT='([^']*)'/.exec(joined)?.[1] ?? "";
|
|
3048
3040
|
let dataListener = null;
|
|
3049
3041
|
let exitListener = null;
|
|
3050
3042
|
const channel = {
|
|
@@ -3104,9 +3096,9 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3104
3096
|
const openDuplexChannel = async (openInput) => {
|
|
3105
3097
|
control.openCount += 1;
|
|
3106
3098
|
const joined = openInput.command.join(" ");
|
|
3107
|
-
const nonce = /
|
|
3108
|
-
const port = /
|
|
3109
|
-
const bridgeToken = /
|
|
3099
|
+
const nonce = /WARDMOTE_BRIDGE_NONCE='([^']*)'/.exec(joined)?.[1] ?? "";
|
|
3100
|
+
const port = /WARDMOTE_BRIDGE_PORT='([^']*)'/.exec(joined)?.[1] ?? "";
|
|
3101
|
+
const bridgeToken = /WARDMOTE_BRIDGE_TOKEN='([^']*)'/.exec(joined)?.[1] ?? "";
|
|
3110
3102
|
const [hostSide, sandboxSide] = duplexPair();
|
|
3111
3103
|
const dataListeners = [];
|
|
3112
3104
|
const exitListeners = [];
|
|
@@ -3197,7 +3189,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3197
3189
|
// Build a minimal multipart/form-data request body with one binary file
|
|
3198
3190
|
// part, plus the matching `content-type` header value.
|
|
3199
3191
|
function buildMultipartAttachmentUpload(fileBytes) {
|
|
3200
|
-
const boundary = "
|
|
3192
|
+
const boundary = "wardmote-test-boundary";
|
|
3201
3193
|
const head = Buffer.from(`--${boundary}\r\n` +
|
|
3202
3194
|
`Content-Disposition: form-data; name="file"; filename="upload.bin"\r\n` +
|
|
3203
3195
|
`Content-Type: application/octet-stream\r\n\r\n`, "utf8");
|
|
@@ -3225,7 +3217,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3225
3217
|
method: req.method ?? "GET",
|
|
3226
3218
|
url: req.url ?? "/",
|
|
3227
3219
|
auth: req.headers.authorization ?? null,
|
|
3228
|
-
runId: typeof req.headers["x-
|
|
3220
|
+
runId: typeof req.headers["x-wardmote-run-id"] === "string" ? req.headers["x-wardmote-run-id"] : null,
|
|
3229
3221
|
headers,
|
|
3230
3222
|
body: Buffer.concat(chunks),
|
|
3231
3223
|
});
|
|
@@ -3259,7 +3251,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3259
3251
|
// The channel open itself fails (a provider startup fault, before any
|
|
3260
3252
|
// READY line or preface is possible). The host must fall back to the
|
|
3261
3253
|
// file bridge and record the typed open-failure reason, never hang.
|
|
3262
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3254
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-startup-fail-"));
|
|
3263
3255
|
cleanupDirs.push(rootDir);
|
|
3264
3256
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
3265
3257
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -3281,10 +3273,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3281
3273
|
runner,
|
|
3282
3274
|
effectiveCapabilities: duplexCapabilities(true),
|
|
3283
3275
|
};
|
|
3284
|
-
const bridge = await
|
|
3276
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
3285
3277
|
runId: "run-startup-fail",
|
|
3286
3278
|
target,
|
|
3287
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
3279
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
3288
3280
|
adapterKey: "codex",
|
|
3289
3281
|
hostApiToken: "real-run-jwt",
|
|
3290
3282
|
hostApiUrl: api.origin,
|
|
@@ -3294,16 +3286,16 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3294
3286
|
try {
|
|
3295
3287
|
expect(bridge).not.toBeNull();
|
|
3296
3288
|
expect(openCount).toBe(1);
|
|
3297
|
-
expect(bridge?.env.
|
|
3289
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
3298
3290
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
3299
3291
|
expect(fallback?.dimensions.fallback_reason).toBe("channel_open_failed");
|
|
3300
3292
|
// The queue fallback keeps the 415 gate for the attachment upload path:
|
|
3301
3293
|
// it never admits a binary body, and it never forwards the request to
|
|
3302
3294
|
// the host.
|
|
3303
|
-
const uploadResponse = await fetch(`${bridge.env.
|
|
3295
|
+
const uploadResponse = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/companies/co-1/issues/issue-1/attachments`, {
|
|
3304
3296
|
method: "POST",
|
|
3305
3297
|
headers: {
|
|
3306
|
-
authorization: `Bearer ${bridge.env.
|
|
3298
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
3307
3299
|
"content-type": "application/octet-stream",
|
|
3308
3300
|
},
|
|
3309
3301
|
body: Buffer.from([0x50, 0x4b, 0x03, 0x04]),
|
|
@@ -3317,7 +3309,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3317
3309
|
}
|
|
3318
3310
|
}, 20000);
|
|
3319
3311
|
it("test_daytona_selects_http2_v1", async () => {
|
|
3320
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3312
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-select-"));
|
|
3321
3313
|
cleanupDirs.push(rootDir);
|
|
3322
3314
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
3323
3315
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -3340,10 +3332,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3340
3332
|
runner,
|
|
3341
3333
|
effectiveCapabilities: duplexCapabilities(true),
|
|
3342
3334
|
};
|
|
3343
|
-
const bridge = await
|
|
3335
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
3344
3336
|
runId: "run-http2",
|
|
3345
3337
|
target,
|
|
3346
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
3338
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
3347
3339
|
adapterKey: "codex",
|
|
3348
3340
|
hostApiToken: "real-run-jwt",
|
|
3349
3341
|
hostApiUrl: api.origin,
|
|
@@ -3352,10 +3344,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3352
3344
|
try {
|
|
3353
3345
|
expect(bridge).not.toBeNull();
|
|
3354
3346
|
expect(control.openCount).toBe(1);
|
|
3355
|
-
expect(bridge?.env.
|
|
3347
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3356
3348
|
// The host builds the origin from the port it assigned, never from a frame.
|
|
3357
|
-
expect(bridge?.env.
|
|
3358
|
-
expect(bridge?.env.
|
|
3349
|
+
expect(bridge?.env.WARDMOTE_API_URL).toMatch(/^http:\/\/127\.0\.0\.1:\d+$/);
|
|
3350
|
+
expect(bridge?.env.WARDMOTE_API_KEY).not.toBe("real-run-jwt");
|
|
3359
3351
|
// The sandbox gateway forwards one agent request as one real HTTP/2
|
|
3360
3352
|
// stream, over the one session that runs directly on the sandbox
|
|
3361
3353
|
// channel. The host serves it with the real token and the run id.
|
|
@@ -3384,7 +3376,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3384
3376
|
expect(control.stopCount).toBeGreaterThanOrEqual(1);
|
|
3385
3377
|
}, 20000);
|
|
3386
3378
|
it("streams run logs on the http2 path under the same gate and log line as the file path", async () => {
|
|
3387
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3379
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-runlog-"));
|
|
3388
3380
|
cleanupDirs.push(rootDir);
|
|
3389
3381
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
3390
3382
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -3401,10 +3393,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3401
3393
|
streamRunLogs: true,
|
|
3402
3394
|
effectiveCapabilities: duplexCapabilities(true),
|
|
3403
3395
|
};
|
|
3404
|
-
const bridge = await
|
|
3396
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
3405
3397
|
runId: "run-duplex-log",
|
|
3406
3398
|
target,
|
|
3407
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
3399
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
3408
3400
|
adapterKey: "codex",
|
|
3409
3401
|
hostApiToken: "real-run-jwt",
|
|
3410
3402
|
hostApiUrl: api.origin,
|
|
@@ -3416,7 +3408,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3416
3408
|
try {
|
|
3417
3409
|
// The http2 transport served, and it still streams run logs with the same
|
|
3418
3410
|
// gate and the same log line as the file path.
|
|
3419
|
-
expect(bridge?.env.
|
|
3411
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3420
3412
|
expect(bridge?.runLogTail).toBeTruthy();
|
|
3421
3413
|
expect(combinedStream(logs, "stdout")).toContain("Sandbox run log streaming enabled");
|
|
3422
3414
|
const wrapped = bridge.runLogTail.create().wrapCommand("agent-cli", ["--message", "hello world"]);
|
|
@@ -3429,7 +3421,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3429
3421
|
}
|
|
3430
3422
|
}, 20000);
|
|
3431
3423
|
it("returns no run-log tail on the http2 path when streaming is opted out", async () => {
|
|
3432
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3424
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-runlog-off-"));
|
|
3433
3425
|
cleanupDirs.push(rootDir);
|
|
3434
3426
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
3435
3427
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -3445,17 +3437,17 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3445
3437
|
streamRunLogs: false,
|
|
3446
3438
|
effectiveCapabilities: duplexCapabilities(true),
|
|
3447
3439
|
};
|
|
3448
|
-
const bridge = await
|
|
3440
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
3449
3441
|
runId: "run-http2-log-off",
|
|
3450
3442
|
target,
|
|
3451
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
3443
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
3452
3444
|
adapterKey: "codex",
|
|
3453
3445
|
hostApiToken: "real-run-jwt",
|
|
3454
3446
|
hostApiUrl: api.origin,
|
|
3455
3447
|
enableSandboxDuplexBridge: true,
|
|
3456
3448
|
});
|
|
3457
3449
|
try {
|
|
3458
|
-
expect(bridge?.env.
|
|
3450
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3459
3451
|
expect(bridge?.runLogTail ?? null).toBeNull();
|
|
3460
3452
|
}
|
|
3461
3453
|
finally {
|
|
@@ -3464,7 +3456,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3464
3456
|
}
|
|
3465
3457
|
}, 20000);
|
|
3466
3458
|
it("routes http2 channel-open and fallback records to a recorder attached on the server seam", async () => {
|
|
3467
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3459
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-recorder-"));
|
|
3468
3460
|
cleanupDirs.push(rootDir);
|
|
3469
3461
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
3470
3462
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -3490,10 +3482,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3490
3482
|
effectiveCapabilities: duplexCapabilities(true),
|
|
3491
3483
|
duplexObservabilityRecorder: recorder,
|
|
3492
3484
|
};
|
|
3493
|
-
const openBridge = await
|
|
3485
|
+
const openBridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
3494
3486
|
runId: "run-http2-open",
|
|
3495
3487
|
target: openTarget,
|
|
3496
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
3488
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
3497
3489
|
adapterKey: "codex",
|
|
3498
3490
|
hostApiToken: "real-run-jwt",
|
|
3499
3491
|
hostApiUrl: api.origin,
|
|
@@ -3501,7 +3493,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3501
3493
|
duplexObservabilityRecorder: adapterExecutionTargetDuplexObservabilityRecorder(openTarget),
|
|
3502
3494
|
});
|
|
3503
3495
|
try {
|
|
3504
|
-
expect(openBridge?.env.
|
|
3496
|
+
expect(openBridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3505
3497
|
const open = counters.find((record) => record.metric === DUPLEX_COUNTER_CHANNEL_OPEN_TOTAL);
|
|
3506
3498
|
expect(open?.dimensions.transport).toBe("http2");
|
|
3507
3499
|
expect(open?.dimensions.provider).toBe("daytona");
|
|
@@ -3522,10 +3514,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3522
3514
|
effectiveCapabilities: duplexCapabilities(true),
|
|
3523
3515
|
duplexObservabilityRecorder: recorder,
|
|
3524
3516
|
};
|
|
3525
|
-
const fallbackBridge = await
|
|
3517
|
+
const fallbackBridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
3526
3518
|
runId: "run-duplex-fallback",
|
|
3527
3519
|
target: fallbackTarget,
|
|
3528
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
3520
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
3529
3521
|
adapterKey: "codex",
|
|
3530
3522
|
hostApiToken: "real-run-jwt",
|
|
3531
3523
|
hostApiUrl: api.origin,
|
|
@@ -3533,7 +3525,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3533
3525
|
duplexObservabilityRecorder: adapterExecutionTargetDuplexObservabilityRecorder(fallbackTarget),
|
|
3534
3526
|
});
|
|
3535
3527
|
try {
|
|
3536
|
-
expect(fallbackBridge?.env.
|
|
3528
|
+
expect(fallbackBridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
3537
3529
|
const fallback = counters.find((record) => record.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
3538
3530
|
expect(fallback?.dimensions.fallback_reason).toBe("gate_off");
|
|
3539
3531
|
expect(fallback?.dimensions.transport).toBe("file");
|
|
@@ -3547,7 +3539,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3547
3539
|
{ name: "the kill switch is off with the capability granted", enable: false, capability: true },
|
|
3548
3540
|
{ name: "the capability is absent with the kill switch on", enable: true, capability: false },
|
|
3549
3541
|
])("selects the file bridge when $name", async ({ enable, capability }) => {
|
|
3550
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3542
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-gate-"));
|
|
3551
3543
|
cleanupDirs.push(rootDir);
|
|
3552
3544
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
3553
3545
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -3562,10 +3554,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3562
3554
|
runner,
|
|
3563
3555
|
effectiveCapabilities: duplexCapabilities(capability),
|
|
3564
3556
|
};
|
|
3565
|
-
const bridge = await
|
|
3557
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
3566
3558
|
runId: "run-gate",
|
|
3567
3559
|
target,
|
|
3568
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
3560
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
3569
3561
|
adapterKey: "codex",
|
|
3570
3562
|
hostApiToken: "real-run-jwt",
|
|
3571
3563
|
hostApiUrl: api.origin,
|
|
@@ -3575,7 +3567,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3575
3567
|
expect(bridge).not.toBeNull();
|
|
3576
3568
|
// Neither gate combination opened a duplex channel; the file bridge serves.
|
|
3577
3569
|
expect(control.openCount).toBe(0);
|
|
3578
|
-
expect(bridge?.env.
|
|
3570
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
3579
3571
|
}
|
|
3580
3572
|
finally {
|
|
3581
3573
|
await bridge?.stop();
|
|
@@ -3604,7 +3596,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3604
3596
|
onOpen: () => { },
|
|
3605
3597
|
},
|
|
3606
3598
|
])("fails closed to the file bridge on $name and leaves no live session", async ({ onOpen }) => {
|
|
3607
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3599
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-fail-"));
|
|
3608
3600
|
cleanupDirs.push(rootDir);
|
|
3609
3601
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
3610
3602
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -3619,10 +3611,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3619
3611
|
runner,
|
|
3620
3612
|
effectiveCapabilities: duplexCapabilities(true),
|
|
3621
3613
|
};
|
|
3622
|
-
const bridge = await
|
|
3614
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
3623
3615
|
runId: "run-fail",
|
|
3624
3616
|
target,
|
|
3625
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
3617
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
3626
3618
|
adapterKey: "codex",
|
|
3627
3619
|
hostApiToken: "real-run-jwt",
|
|
3628
3620
|
hostApiUrl: api.origin,
|
|
@@ -3633,7 +3625,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3633
3625
|
expect(bridge).not.toBeNull();
|
|
3634
3626
|
expect(control.openCount).toBe(1);
|
|
3635
3627
|
// Fail closed: the file bridge serves after the bounded cleanup.
|
|
3636
|
-
expect(bridge?.env.
|
|
3628
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
3637
3629
|
// The bounded cleanup left no live provider session.
|
|
3638
3630
|
expect(control.closeCount + control.stopCount).toBeGreaterThanOrEqual(1);
|
|
3639
3631
|
}
|
|
@@ -3652,7 +3644,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3652
3644
|
buildReady: (nonce, attackerPort) => `{"version":2,"type":"ready","nonce":"${nonce}","address":"http://127.0.0.1:${attackerPort}"}\n`,
|
|
3653
3645
|
},
|
|
3654
3646
|
])("rejects a READY frame that carries $name and never sends the bridge token there", async ({ buildReady }) => {
|
|
3655
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3647
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-addr-"));
|
|
3656
3648
|
cleanupDirs.push(rootDir);
|
|
3657
3649
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
3658
3650
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -3685,10 +3677,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3685
3677
|
runner,
|
|
3686
3678
|
effectiveCapabilities: duplexCapabilities(true),
|
|
3687
3679
|
};
|
|
3688
|
-
const bridge = await
|
|
3680
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
3689
3681
|
runId: "run-addr",
|
|
3690
3682
|
target,
|
|
3691
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
3683
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
3692
3684
|
adapterKey: "codex",
|
|
3693
3685
|
hostApiToken: "real-run-jwt",
|
|
3694
3686
|
hostApiUrl: api.origin,
|
|
@@ -3699,8 +3691,8 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3699
3691
|
expect(bridge).not.toBeNull();
|
|
3700
3692
|
// The address-bearing READY frame failed the strict schema, so the host
|
|
3701
3693
|
// fell closed to the file bridge and built no channel-supplied endpoint.
|
|
3702
|
-
expect(bridge?.env.
|
|
3703
|
-
expect(bridge?.env.
|
|
3694
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
3695
|
+
expect(bridge?.env.WARDMOTE_API_URL).not.toContain(String(attackerPort));
|
|
3704
3696
|
expect(control.closeCount + control.stopCount).toBeGreaterThanOrEqual(1);
|
|
3705
3697
|
// Give any stray forward a moment, then assert the attacker got nothing.
|
|
3706
3698
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
@@ -3713,7 +3705,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3713
3705
|
}
|
|
3714
3706
|
}, 20000);
|
|
3715
3707
|
it("test_route_allowlist_header_cleanup_and_token_replacement_hold_on_http2", async () => {
|
|
3716
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3708
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-403-"));
|
|
3717
3709
|
cleanupDirs.push(rootDir);
|
|
3718
3710
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
3719
3711
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -3734,17 +3726,17 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3734
3726
|
runner,
|
|
3735
3727
|
effectiveCapabilities: duplexCapabilities(true),
|
|
3736
3728
|
};
|
|
3737
|
-
const bridge = await
|
|
3729
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
3738
3730
|
runId: "run-http2-403",
|
|
3739
3731
|
target,
|
|
3740
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
3732
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
3741
3733
|
adapterKey: "codex",
|
|
3742
3734
|
hostApiToken: "real-run-jwt",
|
|
3743
3735
|
hostApiUrl: api.origin,
|
|
3744
3736
|
enableSandboxDuplexBridge: true,
|
|
3745
3737
|
});
|
|
3746
3738
|
try {
|
|
3747
|
-
expect(bridge?.env.
|
|
3739
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3748
3740
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
3749
3741
|
// An unlisted route answers 403 over the real HTTP/2 stream and never
|
|
3750
3742
|
// reaches the host API — the route allowlist holds on the http2 path.
|
|
@@ -3835,7 +3827,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3835
3827
|
if (!echoAddress || typeof echoAddress === "string") {
|
|
3836
3828
|
throw new Error("Expected the echo server to listen on a TCP port.");
|
|
3837
3829
|
}
|
|
3838
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3830
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-raw-bytes-"));
|
|
3839
3831
|
cleanupDirs.push(rootDir);
|
|
3840
3832
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
3841
3833
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -3855,17 +3847,17 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3855
3847
|
runner,
|
|
3856
3848
|
effectiveCapabilities: duplexCapabilities(true),
|
|
3857
3849
|
};
|
|
3858
|
-
const bridge = await
|
|
3850
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
3859
3851
|
runId: "run-raw-bytes",
|
|
3860
3852
|
target,
|
|
3861
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
3853
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
3862
3854
|
adapterKey: "codex",
|
|
3863
3855
|
hostApiToken: "real-run-jwt",
|
|
3864
3856
|
hostApiUrl: `http://127.0.0.1:${echoAddress.port}`,
|
|
3865
3857
|
enableSandboxDuplexBridge: true,
|
|
3866
3858
|
});
|
|
3867
3859
|
try {
|
|
3868
|
-
expect(bridge?.env.
|
|
3860
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3869
3861
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
3870
3862
|
const response = await http2TestRequest(sessionRef.current, {
|
|
3871
3863
|
method: "POST",
|
|
@@ -3932,7 +3924,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3932
3924
|
]);
|
|
3933
3925
|
});
|
|
3934
3926
|
it("records an http2 request span with latency and the fixed dimension keys", async () => {
|
|
3935
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3927
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-obs-"));
|
|
3936
3928
|
cleanupDirs.push(rootDir);
|
|
3937
3929
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
3938
3930
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -3954,10 +3946,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3954
3946
|
runner,
|
|
3955
3947
|
effectiveCapabilities: duplexCapabilities(true),
|
|
3956
3948
|
};
|
|
3957
|
-
const bridge = await
|
|
3949
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
3958
3950
|
runId: "run-obs",
|
|
3959
3951
|
target,
|
|
3960
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
3952
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
3961
3953
|
adapterKey: "codex",
|
|
3962
3954
|
hostApiToken: "real-run-jwt",
|
|
3963
3955
|
hostApiUrl: api.origin,
|
|
@@ -3965,7 +3957,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3965
3957
|
duplexObservabilityRecorder: recorder,
|
|
3966
3958
|
});
|
|
3967
3959
|
try {
|
|
3968
|
-
expect(bridge?.env.
|
|
3960
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
3969
3961
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
3970
3962
|
const response = await http2TestRequest(sessionRef.current, {
|
|
3971
3963
|
method: "GET",
|
|
@@ -3996,7 +3988,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
3996
3988
|
}
|
|
3997
3989
|
}, 20000);
|
|
3998
3990
|
it("increments the fallback counter with an approved reason when the capability is absent", async () => {
|
|
3999
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3991
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-fb-"));
|
|
4000
3992
|
cleanupDirs.push(rootDir);
|
|
4001
3993
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4002
3994
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4012,10 +4004,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4012
4004
|
runner,
|
|
4013
4005
|
effectiveCapabilities: duplexCapabilities(false),
|
|
4014
4006
|
};
|
|
4015
|
-
const bridge = await
|
|
4007
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4016
4008
|
runId: "run-fb",
|
|
4017
4009
|
target,
|
|
4018
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4010
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4019
4011
|
adapterKey: "codex",
|
|
4020
4012
|
hostApiToken: "real-run-jwt",
|
|
4021
4013
|
hostApiUrl: api.origin,
|
|
@@ -4023,7 +4015,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4023
4015
|
duplexObservabilityRecorder: recorder,
|
|
4024
4016
|
});
|
|
4025
4017
|
try {
|
|
4026
|
-
expect(bridge?.env.
|
|
4018
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4027
4019
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4028
4020
|
expect(fallback).toBeDefined();
|
|
4029
4021
|
const approvedReasons = [
|
|
@@ -4061,7 +4053,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4061
4053
|
expectedReason: "channel_open_failed",
|
|
4062
4054
|
},
|
|
4063
4055
|
])("names the open-failure stage $expectedReason and falls back to the file bridge on $name", async ({ error, expectedReason }) => {
|
|
4064
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4056
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-stage-"));
|
|
4065
4057
|
cleanupDirs.push(rootDir);
|
|
4066
4058
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4067
4059
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4083,10 +4075,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4083
4075
|
runner,
|
|
4084
4076
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4085
4077
|
};
|
|
4086
|
-
const bridge = await
|
|
4078
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4087
4079
|
runId: "run-stage",
|
|
4088
4080
|
target,
|
|
4089
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4081
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4090
4082
|
adapterKey: "codex",
|
|
4091
4083
|
hostApiToken: "real-run-jwt",
|
|
4092
4084
|
hostApiUrl: api.origin,
|
|
@@ -4095,7 +4087,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4095
4087
|
});
|
|
4096
4088
|
try {
|
|
4097
4089
|
// The channel never opened, so the host serves the file bridge.
|
|
4098
|
-
expect(bridge?.env.
|
|
4090
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4099
4091
|
// The channel-open span and the fallback counter name the exact stage.
|
|
4100
4092
|
const openSpan = spans.find((s) => s.name === DUPLEX_SPAN_CHANNEL_OPEN && s.dimensions.outcome === "error");
|
|
4101
4093
|
expect(openSpan?.dimensions.fallback_reason).toBe(expectedReason);
|
|
@@ -4113,7 +4105,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4113
4105
|
{ name: "before any dispatch", dispatchFirst: false, expectedClass: "pre_dispatch" },
|
|
4114
4106
|
{ name: "after a dispatch", dispatchFirst: true, expectedClass: "post_dispatch" },
|
|
4115
4107
|
])("increments the loss counter with the loss class $name", async ({ dispatchFirst, expectedClass }) => {
|
|
4116
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4108
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-loss-"));
|
|
4117
4109
|
cleanupDirs.push(rootDir);
|
|
4118
4110
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4119
4111
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4137,10 +4129,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4137
4129
|
runner,
|
|
4138
4130
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4139
4131
|
};
|
|
4140
|
-
const bridge = await
|
|
4132
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4141
4133
|
runId: "run-loss",
|
|
4142
4134
|
target,
|
|
4143
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4135
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4144
4136
|
adapterKey: "codex",
|
|
4145
4137
|
hostApiToken: "real-run-jwt",
|
|
4146
4138
|
hostApiUrl: api.origin,
|
|
@@ -4148,7 +4140,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4148
4140
|
duplexObservabilityRecorder: recorder,
|
|
4149
4141
|
});
|
|
4150
4142
|
try {
|
|
4151
|
-
expect(bridge?.env.
|
|
4143
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4152
4144
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
4153
4145
|
if (dispatchFirst) {
|
|
4154
4146
|
const response = await http2TestRequest(sessionRef.current, {
|
|
@@ -4173,7 +4165,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4173
4165
|
}
|
|
4174
4166
|
}, 20000);
|
|
4175
4167
|
it("keeps serving the request path when the telemetry recorder throws", async () => {
|
|
4176
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4168
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-guard-"));
|
|
4177
4169
|
cleanupDirs.push(rootDir);
|
|
4178
4170
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4179
4171
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4195,10 +4187,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4195
4187
|
runner,
|
|
4196
4188
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4197
4189
|
};
|
|
4198
|
-
const bridge = await
|
|
4190
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4199
4191
|
runId: "run-guard",
|
|
4200
4192
|
target,
|
|
4201
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4193
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4202
4194
|
adapterKey: "codex",
|
|
4203
4195
|
hostApiToken: "real-run-jwt",
|
|
4204
4196
|
hostApiUrl: api.origin,
|
|
@@ -4207,7 +4199,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4207
4199
|
});
|
|
4208
4200
|
try {
|
|
4209
4201
|
// The throwing recorder never blocked the http2 selection.
|
|
4210
|
-
expect(bridge?.env.
|
|
4202
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4211
4203
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
4212
4204
|
const response = await http2TestRequest(sessionRef.current, {
|
|
4213
4205
|
method: "GET",
|
|
@@ -4232,7 +4224,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4232
4224
|
// error string has no code path into a sink on the http2_v1 transport, so
|
|
4233
4225
|
// this test proves the property that does need a live run: the route,
|
|
4234
4226
|
// the query, the body, and both tokens never ride a sink either.
|
|
4235
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4227
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-redact-"));
|
|
4236
4228
|
cleanupDirs.push(rootDir);
|
|
4237
4229
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4238
4230
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4260,14 +4252,14 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4260
4252
|
runner,
|
|
4261
4253
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4262
4254
|
};
|
|
4263
|
-
const previousDebug = process.env.
|
|
4264
|
-
process.env.
|
|
4255
|
+
const previousDebug = process.env.WARDMOTE_BRIDGE_DEBUG;
|
|
4256
|
+
process.env.WARDMOTE_BRIDGE_DEBUG = "1";
|
|
4265
4257
|
let bridge = null;
|
|
4266
4258
|
try {
|
|
4267
|
-
bridge = await
|
|
4259
|
+
bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4268
4260
|
runId: "run-redact",
|
|
4269
4261
|
target,
|
|
4270
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4262
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4271
4263
|
adapterKey: "codex",
|
|
4272
4264
|
hostApiToken: AGENT_TOKEN_SENTINEL,
|
|
4273
4265
|
hostApiUrl: api.origin,
|
|
@@ -4277,7 +4269,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4277
4269
|
logLines.push(chunk);
|
|
4278
4270
|
},
|
|
4279
4271
|
});
|
|
4280
|
-
expect(bridge?.env.
|
|
4272
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4281
4273
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
4282
4274
|
// Dispatch one real HTTP/2 stream that carries the sentinel route,
|
|
4283
4275
|
// query, and body. The route allowlist accepts an arbitrary issue id
|
|
@@ -4305,16 +4297,16 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4305
4297
|
}
|
|
4306
4298
|
finally {
|
|
4307
4299
|
if (previousDebug === undefined)
|
|
4308
|
-
delete process.env.
|
|
4300
|
+
delete process.env.WARDMOTE_BRIDGE_DEBUG;
|
|
4309
4301
|
else
|
|
4310
|
-
process.env.
|
|
4302
|
+
process.env.WARDMOTE_BRIDGE_DEBUG = previousDebug;
|
|
4311
4303
|
sessionRef.current?.close();
|
|
4312
4304
|
await bridge?.stop();
|
|
4313
4305
|
await api.close();
|
|
4314
4306
|
}
|
|
4315
4307
|
}, 20000);
|
|
4316
4308
|
it("maps a sentinel provider key to the constant other across every sink", async () => {
|
|
4317
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4309
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-prov-"));
|
|
4318
4310
|
cleanupDirs.push(rootDir);
|
|
4319
4311
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4320
4312
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4337,10 +4329,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4337
4329
|
runner,
|
|
4338
4330
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4339
4331
|
};
|
|
4340
|
-
const bridge = await
|
|
4332
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4341
4333
|
runId: "run-prov",
|
|
4342
4334
|
target,
|
|
4343
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4335
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4344
4336
|
adapterKey: "codex",
|
|
4345
4337
|
hostApiToken: "real-run-jwt",
|
|
4346
4338
|
hostApiUrl: api.origin,
|
|
@@ -4348,7 +4340,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4348
4340
|
duplexObservabilityRecorder: recorder,
|
|
4349
4341
|
});
|
|
4350
4342
|
try {
|
|
4351
|
-
expect(bridge?.env.
|
|
4343
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4352
4344
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
4353
4345
|
const response = await http2TestRequest(sessionRef.current, {
|
|
4354
4346
|
method: "GET",
|
|
@@ -4378,7 +4370,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4378
4370
|
}
|
|
4379
4371
|
}, 20000);
|
|
4380
4372
|
it("caps the pre-READY readiness buffer and falls back with a contaminated reason", async () => {
|
|
4381
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4373
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-cap-"));
|
|
4382
4374
|
cleanupDirs.push(rootDir);
|
|
4383
4375
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4384
4376
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4402,10 +4394,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4402
4394
|
runner,
|
|
4403
4395
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4404
4396
|
};
|
|
4405
|
-
const bridge = await
|
|
4397
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4406
4398
|
runId: "run-cap",
|
|
4407
4399
|
target,
|
|
4408
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4400
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4409
4401
|
adapterKey: "codex",
|
|
4410
4402
|
hostApiToken: "real-run-jwt",
|
|
4411
4403
|
hostApiUrl: api.origin,
|
|
@@ -4419,7 +4411,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4419
4411
|
expect(bridge).not.toBeNull();
|
|
4420
4412
|
expect(control.openCount).toBe(1);
|
|
4421
4413
|
// The cap drove the failure, so the file bridge serves after the bounded cleanup.
|
|
4422
|
-
expect(bridge?.env.
|
|
4414
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4423
4415
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4424
4416
|
expect(fallback?.dimensions.fallback_reason).toBe("contaminated");
|
|
4425
4417
|
// The bounded cleanup left no live provider session.
|
|
@@ -4431,7 +4423,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4431
4423
|
}
|
|
4432
4424
|
}, 20000);
|
|
4433
4425
|
it("caps the pre-READY buffer under many small newline-less chunks", async () => {
|
|
4434
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4426
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-cap-small-"));
|
|
4435
4427
|
cleanupDirs.push(rootDir);
|
|
4436
4428
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4437
4429
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4459,10 +4451,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4459
4451
|
runner,
|
|
4460
4452
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4461
4453
|
};
|
|
4462
|
-
const bridge = await
|
|
4454
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4463
4455
|
runId: "run-cap-small",
|
|
4464
4456
|
target,
|
|
4465
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4457
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4466
4458
|
adapterKey: "codex",
|
|
4467
4459
|
hostApiToken: "real-run-jwt",
|
|
4468
4460
|
hostApiUrl: api.origin,
|
|
@@ -4476,7 +4468,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4476
4468
|
expect(bridge).not.toBeNull();
|
|
4477
4469
|
expect(control.openCount).toBe(1);
|
|
4478
4470
|
// The cap drove the failure, so the file bridge serves after the bounded cleanup.
|
|
4479
|
-
expect(bridge?.env.
|
|
4471
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4480
4472
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4481
4473
|
expect(fallback?.dimensions.fallback_reason).toBe("contaminated");
|
|
4482
4474
|
expect(control.closeCount + control.stopCount).toBeGreaterThanOrEqual(1);
|
|
@@ -4487,7 +4479,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4487
4479
|
}
|
|
4488
4480
|
}, 20000);
|
|
4489
4481
|
it("bounds the pre-READY newline-scan work by the bytes received", async () => {
|
|
4490
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4482
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-scan-"));
|
|
4491
4483
|
cleanupDirs.push(rootDir);
|
|
4492
4484
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4493
4485
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4516,10 +4508,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4516
4508
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4517
4509
|
};
|
|
4518
4510
|
__duplexReadinessTesting.resetNewlineScanUnits();
|
|
4519
|
-
const bridge = await
|
|
4511
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4520
4512
|
runId: "run-scan-bound",
|
|
4521
4513
|
target,
|
|
4522
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4514
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4523
4515
|
adapterKey: "codex",
|
|
4524
4516
|
hostApiToken: "real-run-jwt",
|
|
4525
4517
|
hostApiUrl: api.origin,
|
|
@@ -4542,7 +4534,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4542
4534
|
}
|
|
4543
4535
|
}, 20000);
|
|
4544
4536
|
it("bounds the pre-READY buffer growth-copy work by the bytes received", async () => {
|
|
4545
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4537
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-growth-"));
|
|
4546
4538
|
cleanupDirs.push(rootDir);
|
|
4547
4539
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4548
4540
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4572,10 +4564,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4572
4564
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4573
4565
|
};
|
|
4574
4566
|
__duplexReadinessTesting.resetBufferGrowthCopyUnits();
|
|
4575
|
-
const bridge = await
|
|
4567
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4576
4568
|
runId: "run-growth-bound",
|
|
4577
4569
|
target,
|
|
4578
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4570
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4579
4571
|
adapterKey: "codex",
|
|
4580
4572
|
hostApiToken: "real-run-jwt",
|
|
4581
4573
|
hostApiUrl: api.origin,
|
|
@@ -4599,7 +4591,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4599
4591
|
}
|
|
4600
4592
|
}, 20000);
|
|
4601
4593
|
it("bounds the pre-READY skip scan work by the bytes received", async () => {
|
|
4602
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4594
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-blank-"));
|
|
4603
4595
|
cleanupDirs.push(rootDir);
|
|
4604
4596
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4605
4597
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4629,10 +4621,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4629
4621
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4630
4622
|
};
|
|
4631
4623
|
__duplexReadinessTesting.resetNewlineScanUnits();
|
|
4632
|
-
const bridge = await
|
|
4624
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4633
4625
|
runId: "run-blank-scan",
|
|
4634
4626
|
target,
|
|
4635
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4627
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4636
4628
|
adapterKey: "codex",
|
|
4637
4629
|
hostApiToken: "real-run-jwt",
|
|
4638
4630
|
hostApiUrl: api.origin,
|
|
@@ -4650,7 +4642,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4650
4642
|
expect(scanUnits).toBeLessThanOrEqual(4 * totalBytes);
|
|
4651
4643
|
// The gate skipped the noise and accepted the READY frame, so the http2
|
|
4652
4644
|
// transport serves and no fallback fired.
|
|
4653
|
-
expect(bridge?.env.
|
|
4645
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4654
4646
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4655
4647
|
expect(fallback).toBeUndefined();
|
|
4656
4648
|
}
|
|
@@ -4660,7 +4652,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4660
4652
|
}
|
|
4661
4653
|
}, 20000);
|
|
4662
4654
|
it("test_a_prologue_of_any_length_before_the_ready_line_is_discarded", async () => {
|
|
4663
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4655
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-noise-"));
|
|
4664
4656
|
cleanupDirs.push(rootDir);
|
|
4665
4657
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4666
4658
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4672,7 +4664,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4672
4664
|
// in the code. The preface scan then starts only on the bytes the gate
|
|
4673
4665
|
// retained after that accepted line.
|
|
4674
4666
|
const { runner, control } = makeHttp2SelectionRunner((ctx) => {
|
|
4675
|
-
ctx.emitRaw("sh -c exec env
|
|
4667
|
+
ctx.emitRaw("sh -c exec env WARDMOTE_BRIDGE_NONCE=... node gateway.mjs\n");
|
|
4676
4668
|
ctx.emitRaw('{"version":2,"type":"ready"}\n');
|
|
4677
4669
|
ctx.emitRaw("x".repeat(50_000)); // an arbitrarily long prologue, no fixed length
|
|
4678
4670
|
ctx.emitReady();
|
|
@@ -4688,10 +4680,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4688
4680
|
runner,
|
|
4689
4681
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4690
4682
|
};
|
|
4691
|
-
const bridge = await
|
|
4683
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4692
4684
|
runId: "run-noise-ready",
|
|
4693
4685
|
target,
|
|
4694
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4686
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4695
4687
|
adapterKey: "codex",
|
|
4696
4688
|
hostApiToken: "real-run-jwt",
|
|
4697
4689
|
hostApiUrl: api.origin,
|
|
@@ -4705,7 +4697,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4705
4697
|
// The gate skipped the echo, the partial frame, and the long prologue,
|
|
4706
4698
|
// then accepted the READY frame, so the http2 transport serves and no
|
|
4707
4699
|
// fallback fired.
|
|
4708
|
-
expect(bridge?.env.
|
|
4700
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4709
4701
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4710
4702
|
expect(fallback).toBeUndefined();
|
|
4711
4703
|
}
|
|
@@ -4715,7 +4707,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4715
4707
|
}
|
|
4716
4708
|
}, 20000);
|
|
4717
4709
|
it("settles a wrong-nonce READY frame as a nonce mismatch, even after a noise line", async () => {
|
|
4718
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4710
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-noise-nonce-"));
|
|
4719
4711
|
cleanupDirs.push(rootDir);
|
|
4720
4712
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4721
4713
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4738,10 +4730,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4738
4730
|
runner,
|
|
4739
4731
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4740
4732
|
};
|
|
4741
|
-
const bridge = await
|
|
4733
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4742
4734
|
runId: "run-noise-nonce",
|
|
4743
4735
|
target,
|
|
4744
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4736
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4745
4737
|
adapterKey: "codex",
|
|
4746
4738
|
hostApiToken: "real-run-jwt",
|
|
4747
4739
|
hostApiUrl: api.origin,
|
|
@@ -4753,7 +4745,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4753
4745
|
expect(bridge).not.toBeNull();
|
|
4754
4746
|
expect(control.openCount).toBe(1);
|
|
4755
4747
|
// The wrong nonce failed the handshake, so the file bridge serves.
|
|
4756
|
-
expect(bridge?.env.
|
|
4748
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4757
4749
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4758
4750
|
expect(fallback?.dimensions.fallback_reason).toBe("ready_nonce_mismatch");
|
|
4759
4751
|
// The bounded cleanup left no live provider session.
|
|
@@ -4765,7 +4757,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4765
4757
|
}
|
|
4766
4758
|
}, 20000);
|
|
4767
4759
|
it("enforces the buffer cap on an over-cap blank prefix before it accepts a valid READY frame", async () => {
|
|
4768
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4760
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-capbypass-"));
|
|
4769
4761
|
cleanupDirs.push(rootDir);
|
|
4770
4762
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4771
4763
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4794,10 +4786,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4794
4786
|
runner,
|
|
4795
4787
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4796
4788
|
};
|
|
4797
|
-
const bridge = await
|
|
4789
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4798
4790
|
runId: "run-cap-bypass",
|
|
4799
4791
|
target,
|
|
4800
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4792
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4801
4793
|
adapterKey: "codex",
|
|
4802
4794
|
hostApiToken: "real-run-jwt",
|
|
4803
4795
|
hostApiUrl: api.origin,
|
|
@@ -4810,7 +4802,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4810
4802
|
expect(bridge).not.toBeNull();
|
|
4811
4803
|
expect(control.openCount).toBe(1);
|
|
4812
4804
|
// The cap drove the failure before READY acceptance, so the file bridge serves.
|
|
4813
|
-
expect(bridge?.env.
|
|
4805
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4814
4806
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
4815
4807
|
expect(fallback?.dimensions.fallback_reason).toBe("contaminated");
|
|
4816
4808
|
// The bounded cleanup left no live provider session.
|
|
@@ -4822,7 +4814,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4822
4814
|
}
|
|
4823
4815
|
}, 20000);
|
|
4824
4816
|
it("records the channel-open span with the fallback_reason dimension on the fallback path", async () => {
|
|
4825
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4817
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-duplex-openspan-"));
|
|
4826
4818
|
cleanupDirs.push(rootDir);
|
|
4827
4819
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4828
4820
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4842,10 +4834,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4842
4834
|
runner,
|
|
4843
4835
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4844
4836
|
};
|
|
4845
|
-
const bridge = await
|
|
4837
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4846
4838
|
runId: "run-open-span",
|
|
4847
4839
|
target,
|
|
4848
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4840
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4849
4841
|
adapterKey: "codex",
|
|
4850
4842
|
hostApiToken: "real-run-jwt",
|
|
4851
4843
|
hostApiUrl: api.origin,
|
|
@@ -4854,7 +4846,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4854
4846
|
duplexObservabilityRecorder: recorder,
|
|
4855
4847
|
});
|
|
4856
4848
|
try {
|
|
4857
|
-
expect(bridge?.env.
|
|
4849
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
4858
4850
|
const openSpan = spans.find((span) => span.name === DUPLEX_SPAN_CHANNEL_OPEN);
|
|
4859
4851
|
expect(openSpan).toBeDefined();
|
|
4860
4852
|
expect(openSpan?.dimensions).toMatchObject({
|
|
@@ -4872,7 +4864,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4872
4864
|
}
|
|
4873
4865
|
}, 20000);
|
|
4874
4866
|
it("drops a header outside the allowlist on the host http2 forward path", async () => {
|
|
4875
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4867
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-hdr-"));
|
|
4876
4868
|
cleanupDirs.push(rootDir);
|
|
4877
4869
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4878
4870
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4893,17 +4885,17 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4893
4885
|
runner,
|
|
4894
4886
|
effectiveCapabilities: duplexCapabilities(true),
|
|
4895
4887
|
};
|
|
4896
|
-
const bridge = await
|
|
4888
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4897
4889
|
runId: "run-hdr",
|
|
4898
4890
|
target,
|
|
4899
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4891
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4900
4892
|
adapterKey: "codex",
|
|
4901
4893
|
hostApiToken: "real-run-jwt",
|
|
4902
4894
|
hostApiUrl: api.origin,
|
|
4903
4895
|
enableSandboxDuplexBridge: true,
|
|
4904
4896
|
});
|
|
4905
4897
|
try {
|
|
4906
|
-
expect(bridge?.env.
|
|
4898
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4907
4899
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
4908
4900
|
const response = await http2TestRequest(sessionRef.current, {
|
|
4909
4901
|
method: "GET",
|
|
@@ -4934,7 +4926,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4934
4926
|
}
|
|
4935
4927
|
}, 20000);
|
|
4936
4928
|
it("selects the http2 transport for a large forward budget", async () => {
|
|
4937
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4929
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-budget-"));
|
|
4938
4930
|
cleanupDirs.push(rootDir);
|
|
4939
4931
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4940
4932
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -4959,10 +4951,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4959
4951
|
// holds no nested-budget derivation (that budget set belonged to the retired
|
|
4960
4952
|
// duplex_v1 broker only), so a large forward budget must still select and
|
|
4961
4953
|
// serve normally.
|
|
4962
|
-
const bridge = await
|
|
4954
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
4963
4955
|
runId: "run-budget",
|
|
4964
4956
|
target,
|
|
4965
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
4957
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
4966
4958
|
adapterKey: "codex",
|
|
4967
4959
|
hostApiToken: "real-run-jwt",
|
|
4968
4960
|
hostApiUrl: api.origin,
|
|
@@ -4970,7 +4962,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4970
4962
|
forwardTimeoutMs: 60_000,
|
|
4971
4963
|
});
|
|
4972
4964
|
try {
|
|
4973
|
-
expect(bridge?.env.
|
|
4965
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
4974
4966
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
4975
4967
|
const response = await http2TestRequest(sessionRef.current, {
|
|
4976
4968
|
method: "GET",
|
|
@@ -4986,7 +4978,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
4986
4978
|
}
|
|
4987
4979
|
}, 20000);
|
|
4988
4980
|
it("test_a_missing_preface_aborts_the_open_and_falls_back_to_queue_v1", async () => {
|
|
4989
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
4981
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-no-preface-"));
|
|
4990
4982
|
cleanupDirs.push(rootDir);
|
|
4991
4983
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
4992
4984
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5010,10 +5002,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5010
5002
|
runner,
|
|
5011
5003
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5012
5004
|
};
|
|
5013
|
-
const bridge = await
|
|
5005
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5014
5006
|
runId: "run-no-preface",
|
|
5015
5007
|
target,
|
|
5016
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5008
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5017
5009
|
adapterKey: "codex",
|
|
5018
5010
|
hostApiToken: "real-run-jwt",
|
|
5019
5011
|
hostApiUrl: api.origin,
|
|
@@ -5027,7 +5019,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5027
5019
|
expect(bridge).not.toBeNull();
|
|
5028
5020
|
expect(control.openCount).toBe(1);
|
|
5029
5021
|
// The missing preface aborted the open; the file bridge serves.
|
|
5030
|
-
expect(bridge?.env.
|
|
5022
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
5031
5023
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
5032
5024
|
expect(fallback?.dimensions.fallback_reason).toBe("preface_missing");
|
|
5033
5025
|
// The bounded cleanup left no live provider session.
|
|
@@ -5039,7 +5031,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5039
5031
|
}
|
|
5040
5032
|
}, 20000);
|
|
5041
5033
|
it("test_disabled_flag_selects_queue_v1", async () => {
|
|
5042
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5034
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-disabled-"));
|
|
5043
5035
|
cleanupDirs.push(rootDir);
|
|
5044
5036
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5045
5037
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5056,10 +5048,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5056
5048
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5057
5049
|
};
|
|
5058
5050
|
// The kill switch is off. The host must never open the channel at all.
|
|
5059
|
-
const bridge = await
|
|
5051
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5060
5052
|
runId: "run-disabled",
|
|
5061
5053
|
target,
|
|
5062
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5054
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5063
5055
|
adapterKey: "codex",
|
|
5064
5056
|
hostApiToken: "real-run-jwt",
|
|
5065
5057
|
hostApiUrl: api.origin,
|
|
@@ -5069,7 +5061,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5069
5061
|
try {
|
|
5070
5062
|
expect(bridge).not.toBeNull();
|
|
5071
5063
|
expect(control.openCount).toBe(0);
|
|
5072
|
-
expect(bridge?.env.
|
|
5064
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
5073
5065
|
const fallback = counters.find((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
5074
5066
|
expect(fallback?.dimensions.fallback_reason).toBe("gate_off");
|
|
5075
5067
|
}
|
|
@@ -5082,7 +5074,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5082
5074
|
// The open attempt runs once per run, with no retry loop: a preface
|
|
5083
5075
|
// failure falls through to the file bridge exactly one time, and the
|
|
5084
5076
|
// host never re-attempts http2_v1 afterward in the same run.
|
|
5085
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5077
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-one-way-"));
|
|
5086
5078
|
cleanupDirs.push(rootDir);
|
|
5087
5079
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5088
5080
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5101,10 +5093,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5101
5093
|
runner,
|
|
5102
5094
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5103
5095
|
};
|
|
5104
|
-
const bridge = await
|
|
5096
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5105
5097
|
runId: "run-one-way",
|
|
5106
5098
|
target,
|
|
5107
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5099
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5108
5100
|
adapterKey: "codex",
|
|
5109
5101
|
hostApiToken: "real-run-jwt",
|
|
5110
5102
|
hostApiUrl: api.origin,
|
|
@@ -5117,7 +5109,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5117
5109
|
// The host opened the channel exactly once for the whole run — no retry
|
|
5118
5110
|
// loop re-attempted http2_v1 after the fallback.
|
|
5119
5111
|
expect(control.openCount).toBe(1);
|
|
5120
|
-
expect(bridge?.env.
|
|
5112
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
5121
5113
|
// Exactly one fallback record — the transition never repeats.
|
|
5122
5114
|
const fallbacks = counters.filter((c) => c.metric === DUPLEX_COUNTER_FALLBACK_TOTAL);
|
|
5123
5115
|
expect(fallbacks).toHaveLength(1);
|
|
@@ -5136,7 +5128,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5136
5128
|
// READY: it holds the channel open, with no client preface arriving
|
|
5137
5129
|
// (so the http2 server, if bound, would try to write its own SETTINGS
|
|
5138
5130
|
// frame), and asserts zero bytes crossed the channel the whole time.
|
|
5139
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5131
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-no-early-write-"));
|
|
5140
5132
|
cleanupDirs.push(rootDir);
|
|
5141
5133
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5142
5134
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5147,7 +5139,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5147
5139
|
const readySentAtMs = { value: 0 };
|
|
5148
5140
|
const openDuplexChannel = async (openInput) => {
|
|
5149
5141
|
const joined = openInput.command.join(" ");
|
|
5150
|
-
const nonce = /
|
|
5142
|
+
const nonce = /WARDMOTE_BRIDGE_NONCE='([^']*)'/.exec(joined)?.[1] ?? "";
|
|
5151
5143
|
let dataListener = null;
|
|
5152
5144
|
const channel = {
|
|
5153
5145
|
write: (data) => {
|
|
@@ -5182,10 +5174,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5182
5174
|
runner,
|
|
5183
5175
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5184
5176
|
};
|
|
5185
|
-
const bridge = await
|
|
5177
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5186
5178
|
runId: "run-no-early-write",
|
|
5187
5179
|
target,
|
|
5188
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5180
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5189
5181
|
adapterKey: "codex",
|
|
5190
5182
|
hostApiToken: "real-run-jwt",
|
|
5191
5183
|
hostApiUrl: api.origin,
|
|
@@ -5197,7 +5189,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5197
5189
|
// The preface never arrived, so the open fell back to the file bridge —
|
|
5198
5190
|
// and across the whole open attempt, including the wait after READY,
|
|
5199
5191
|
// the host wrote zero bytes to the channel.
|
|
5200
|
-
expect(bridge?.env.
|
|
5192
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
5201
5193
|
expect(hostWrites).toHaveLength(0);
|
|
5202
5194
|
}
|
|
5203
5195
|
finally {
|
|
@@ -5211,7 +5203,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5211
5203
|
// bytes are deliberately sentinel-marked and syntactically invalid (not
|
|
5212
5204
|
// valid UTF-8 JSON), then a valid READY frame. No log line — on any
|
|
5213
5205
|
// stream — may contain the sentinel bytes.
|
|
5214
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5206
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-invalid-ready-bytes-"));
|
|
5215
5207
|
cleanupDirs.push(rootDir);
|
|
5216
5208
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5217
5209
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5234,10 +5226,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5234
5226
|
runner,
|
|
5235
5227
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5236
5228
|
};
|
|
5237
|
-
const bridge = await
|
|
5229
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5238
5230
|
runId: "run-invalid-ready-bytes",
|
|
5239
5231
|
target,
|
|
5240
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5232
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5241
5233
|
adapterKey: "codex",
|
|
5242
5234
|
hostApiToken: "real-run-jwt",
|
|
5243
5235
|
hostApiUrl: api.origin,
|
|
@@ -5248,7 +5240,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5248
5240
|
});
|
|
5249
5241
|
try {
|
|
5250
5242
|
// The invalid line was skipped as noise, and READY still passed.
|
|
5251
|
-
expect(bridge?.env.
|
|
5243
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5252
5244
|
const logDump = logLines.join("");
|
|
5253
5245
|
expect(logDump).not.toContain(INVALID_LINE_SENTINEL);
|
|
5254
5246
|
}
|
|
@@ -5261,7 +5253,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5261
5253
|
// A loss ordered after a host-observed orderly completion is a normal
|
|
5262
5254
|
// teardown, not a failure: the run already completed. The disposition
|
|
5263
5255
|
// latch must keep the success and emit no loss event for it.
|
|
5264
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5256
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-orderly-close-"));
|
|
5265
5257
|
cleanupDirs.push(rootDir);
|
|
5266
5258
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5267
5259
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5282,10 +5274,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5282
5274
|
runner,
|
|
5283
5275
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5284
5276
|
};
|
|
5285
|
-
const bridge = await
|
|
5277
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5286
5278
|
runId: "run-orderly-close",
|
|
5287
5279
|
target,
|
|
5288
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5280
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5289
5281
|
adapterKey: "codex",
|
|
5290
5282
|
hostApiToken: "real-run-jwt",
|
|
5291
5283
|
hostApiUrl: api.origin,
|
|
@@ -5293,7 +5285,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5293
5285
|
duplexObservabilityRecorder: recorder,
|
|
5294
5286
|
});
|
|
5295
5287
|
try {
|
|
5296
|
-
expect(bridge?.env.
|
|
5288
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5297
5289
|
// The agent turn completes cleanly before the channel ends.
|
|
5298
5290
|
expect(bridge?.settleRunDisposition?.()).toEqual({ failed: false, lossReason: null });
|
|
5299
5291
|
emitExit();
|
|
@@ -5315,7 +5307,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5315
5307
|
// retryable: the host answers 502 with no indeterminate marker, the same
|
|
5316
5308
|
// rule `forwardBridgeRequest` already applies on every transport. This
|
|
5317
5309
|
// proves the http2_v1 forward handler reuses that one function unchanged.
|
|
5318
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5310
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-safe-retry-"));
|
|
5319
5311
|
cleanupDirs.push(rootDir);
|
|
5320
5312
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5321
5313
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5336,10 +5328,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5336
5328
|
runner,
|
|
5337
5329
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5338
5330
|
};
|
|
5339
|
-
const bridge = await
|
|
5331
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5340
5332
|
runId: "run-safe-retry",
|
|
5341
5333
|
target,
|
|
5342
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5334
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5343
5335
|
adapterKey: "codex",
|
|
5344
5336
|
hostApiToken: "real-run-jwt",
|
|
5345
5337
|
hostApiUrl: api.origin,
|
|
@@ -5349,7 +5341,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5349
5341
|
maxBodyBytes: 1,
|
|
5350
5342
|
});
|
|
5351
5343
|
try {
|
|
5352
|
-
expect(bridge?.env.
|
|
5344
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5353
5345
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5354
5346
|
const response = await http2TestRequest(sessionRef.current, {
|
|
5355
5347
|
method: "GET",
|
|
@@ -5357,7 +5349,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5357
5349
|
headers: { authorization: `Bearer ${bridgeToken}` },
|
|
5358
5350
|
});
|
|
5359
5351
|
expect(response.status).toBe(502);
|
|
5360
|
-
expect(response.headers["x-
|
|
5352
|
+
expect(response.headers["x-wardmote-bridge-outcome"]).toBeUndefined();
|
|
5361
5353
|
}
|
|
5362
5354
|
finally {
|
|
5363
5355
|
sessionRef.current?.close();
|
|
@@ -5375,7 +5367,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5375
5367
|
// host and the gateway share one resolved ceiling: this request carries
|
|
5376
5368
|
// no body, so only the mock host's own response — comfortably over one
|
|
5377
5369
|
// byte — trips the size check this test exists to force.
|
|
5378
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5370
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-unsafe-indeterminate-"));
|
|
5379
5371
|
cleanupDirs.push(rootDir);
|
|
5380
5372
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5381
5373
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5396,10 +5388,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5396
5388
|
runner,
|
|
5397
5389
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5398
5390
|
};
|
|
5399
|
-
const bridge = await
|
|
5391
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5400
5392
|
runId: "run-unsafe-indeterminate",
|
|
5401
5393
|
target,
|
|
5402
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5394
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5403
5395
|
adapterKey: "codex",
|
|
5404
5396
|
hostApiToken: "real-run-jwt",
|
|
5405
5397
|
hostApiUrl: api.origin,
|
|
@@ -5407,7 +5399,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5407
5399
|
maxBodyBytes: 1,
|
|
5408
5400
|
});
|
|
5409
5401
|
try {
|
|
5410
|
-
expect(bridge?.env.
|
|
5402
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5411
5403
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5412
5404
|
const response = await http2TestRequest(sessionRef.current, {
|
|
5413
5405
|
method: "POST",
|
|
@@ -5415,7 +5407,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5415
5407
|
headers: { authorization: `Bearer ${bridgeToken}`, "content-type": "application/json" },
|
|
5416
5408
|
});
|
|
5417
5409
|
expect(response.status).toBe(504);
|
|
5418
|
-
expect(response.headers["x-
|
|
5410
|
+
expect(response.headers["x-wardmote-bridge-outcome"]).toBe("indeterminate");
|
|
5419
5411
|
}
|
|
5420
5412
|
finally {
|
|
5421
5413
|
sessionRef.current?.close();
|
|
@@ -5449,7 +5441,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5449
5441
|
throw new Error("Expected the mock host server to listen on a TCP port.");
|
|
5450
5442
|
}
|
|
5451
5443
|
const apiOrigin = `http://127.0.0.1:${apiAddress.port}`;
|
|
5452
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5444
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-abort-forward-"));
|
|
5453
5445
|
cleanupDirs.push(rootDir);
|
|
5454
5446
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5455
5447
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5469,10 +5461,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5469
5461
|
runner,
|
|
5470
5462
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5471
5463
|
};
|
|
5472
|
-
const bridge = await
|
|
5464
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5473
5465
|
runId: "run-abort-forward",
|
|
5474
5466
|
target,
|
|
5475
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5467
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5476
5468
|
adapterKey: "codex",
|
|
5477
5469
|
hostApiToken: "real-run-jwt",
|
|
5478
5470
|
hostApiUrl: apiOrigin,
|
|
@@ -5482,7 +5474,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5482
5474
|
forwardTimeoutMs: 60_000,
|
|
5483
5475
|
});
|
|
5484
5476
|
try {
|
|
5485
|
-
expect(bridge?.env.
|
|
5477
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5486
5478
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5487
5479
|
const clientStream = sessionRef.current.request({
|
|
5488
5480
|
":method": "GET",
|
|
@@ -5531,7 +5523,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5531
5523
|
throw new Error("Expected the mock host server to listen on a TCP port.");
|
|
5532
5524
|
}
|
|
5533
5525
|
const apiOrigin = `http://127.0.0.1:${apiAddress.port}`;
|
|
5534
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5526
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-denied-response-chunk-"));
|
|
5535
5527
|
cleanupDirs.push(rootDir);
|
|
5536
5528
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5537
5529
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5551,17 +5543,17 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5551
5543
|
runner,
|
|
5552
5544
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5553
5545
|
};
|
|
5554
|
-
const bridge = await
|
|
5546
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5555
5547
|
runId: "run-denied-response-chunk",
|
|
5556
5548
|
target,
|
|
5557
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5549
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5558
5550
|
adapterKey: "codex",
|
|
5559
5551
|
hostApiToken: "real-run-jwt",
|
|
5560
5552
|
hostApiUrl: apiOrigin,
|
|
5561
5553
|
enableSandboxDuplexBridge: true,
|
|
5562
5554
|
});
|
|
5563
5555
|
try {
|
|
5564
|
-
expect(bridge?.env.
|
|
5556
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5565
5557
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5566
5558
|
// A capacity denial reaches the client as the retryable 503 the
|
|
5567
5559
|
// HTTP/2 bridge server's own capacity-denial path answers
|
|
@@ -5616,7 +5608,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5616
5608
|
throw new Error("Expected the mock host server to listen on a TCP port.");
|
|
5617
5609
|
}
|
|
5618
5610
|
const apiOrigin = `http://127.0.0.1:${apiAddress.port}`;
|
|
5619
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5611
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-denied-response-concat-"));
|
|
5620
5612
|
cleanupDirs.push(rootDir);
|
|
5621
5613
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5622
5614
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5636,10 +5628,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5636
5628
|
runner,
|
|
5637
5629
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5638
5630
|
};
|
|
5639
|
-
const bridge = await
|
|
5631
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5640
5632
|
runId: "run-denied-response-concat",
|
|
5641
5633
|
target,
|
|
5642
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5634
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5643
5635
|
adapterKey: "codex",
|
|
5644
5636
|
hostApiToken: "real-run-jwt",
|
|
5645
5637
|
hostApiUrl: apiOrigin,
|
|
@@ -5648,7 +5640,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5648
5640
|
const concatSpy = vi.spyOn(Buffer, "concat");
|
|
5649
5641
|
const readerCancelSpy = vi.spyOn(ReadableStreamDefaultReader.prototype, "cancel");
|
|
5650
5642
|
try {
|
|
5651
|
-
expect(bridge?.env.
|
|
5643
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5652
5644
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5653
5645
|
// A capacity denial must reach the client as the retryable 503 the
|
|
5654
5646
|
// HTTP/2 bridge server's own capacity-denial path answers, not the
|
|
@@ -5728,7 +5720,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5728
5720
|
throw new Error("Expected the mock host server to listen on a TCP port.");
|
|
5729
5721
|
}
|
|
5730
5722
|
const apiOrigin = `http://127.0.0.1:${apiAddress.port}`;
|
|
5731
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5723
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-denied-response-mutation-"));
|
|
5732
5724
|
cleanupDirs.push(rootDir);
|
|
5733
5725
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5734
5726
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5748,17 +5740,17 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5748
5740
|
runner,
|
|
5749
5741
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5750
5742
|
};
|
|
5751
|
-
const bridge = await
|
|
5743
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5752
5744
|
runId: "run-denied-response-mutation",
|
|
5753
5745
|
target,
|
|
5754
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5746
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5755
5747
|
adapterKey: "codex",
|
|
5756
5748
|
hostApiToken: "real-run-jwt",
|
|
5757
5749
|
hostApiUrl: apiOrigin,
|
|
5758
5750
|
enableSandboxDuplexBridge: true,
|
|
5759
5751
|
});
|
|
5760
5752
|
try {
|
|
5761
|
-
expect(bridge?.env.
|
|
5753
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5762
5754
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5763
5755
|
const response = await http2TestRequest(sessionRef.current, {
|
|
5764
5756
|
method: "POST",
|
|
@@ -5766,7 +5758,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5766
5758
|
headers: { authorization: `Bearer ${bridgeToken}`, "content-type": "application/json" },
|
|
5767
5759
|
});
|
|
5768
5760
|
expect(response.status).toBe(504);
|
|
5769
|
-
expect(response.headers["x-
|
|
5761
|
+
expect(response.headers["x-wardmote-bridge-outcome"]).toBe("indeterminate");
|
|
5770
5762
|
expect(JSON.parse(response.body.toString("utf8"))).toMatchObject({
|
|
5771
5763
|
outcome: "indeterminate",
|
|
5772
5764
|
retryable: false,
|
|
@@ -5806,7 +5798,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5806
5798
|
throw new Error("Expected the mock host server to listen on a TCP port.");
|
|
5807
5799
|
}
|
|
5808
5800
|
const apiOrigin = `http://127.0.0.1:${apiAddress.port}`;
|
|
5809
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5801
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-ceiling-aggregate-"));
|
|
5810
5802
|
cleanupDirs.push(rootDir);
|
|
5811
5803
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5812
5804
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5826,17 +5818,17 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5826
5818
|
runner,
|
|
5827
5819
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5828
5820
|
};
|
|
5829
|
-
const bridge = await
|
|
5821
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5830
5822
|
runId: "run-ceiling-aggregate",
|
|
5831
5823
|
target,
|
|
5832
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5824
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5833
5825
|
adapterKey: "codex",
|
|
5834
5826
|
hostApiToken: "real-run-jwt",
|
|
5835
5827
|
hostApiUrl: apiOrigin,
|
|
5836
5828
|
enableSandboxDuplexBridge: true,
|
|
5837
5829
|
});
|
|
5838
5830
|
try {
|
|
5839
|
-
expect(bridge?.env.
|
|
5831
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5840
5832
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5841
5833
|
const responses = await Promise.all(Array.from({ length: HTTP2_BRIDGE_MAX_CONCURRENT_STREAMS }, () => http2TestRequest(sessionRef.current, {
|
|
5842
5834
|
method: "POST",
|
|
@@ -5871,7 +5863,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5871
5863
|
ctx.emitReady();
|
|
5872
5864
|
sessionRef.current = ctx.connectHttp2();
|
|
5873
5865
|
});
|
|
5874
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5866
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-host-body-limit-"));
|
|
5875
5867
|
cleanupDirs.push(rootDir);
|
|
5876
5868
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5877
5869
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -5884,10 +5876,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5884
5876
|
runner,
|
|
5885
5877
|
effectiveCapabilities: duplexCapabilities(true),
|
|
5886
5878
|
};
|
|
5887
|
-
const bridge = await
|
|
5879
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5888
5880
|
runId: "run-host-body-limit",
|
|
5889
5881
|
target,
|
|
5890
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
5882
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
5891
5883
|
adapterKey: "codex",
|
|
5892
5884
|
hostApiToken: "real-run-jwt",
|
|
5893
5885
|
hostApiUrl: api.origin,
|
|
@@ -5900,7 +5892,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5900
5892
|
maxBodyBytes: 100,
|
|
5901
5893
|
});
|
|
5902
5894
|
try {
|
|
5903
|
-
expect(bridge?.env.
|
|
5895
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
5904
5896
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
5905
5897
|
const response = await http2TestRequest(sessionRef.current, {
|
|
5906
5898
|
method: "POST",
|
|
@@ -5929,10 +5921,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5929
5921
|
// with no `reservation` option at all. `readBridgeForwardResponseBody`
|
|
5930
5922
|
// must behave exactly as it did before that option existed: it still
|
|
5931
5923
|
// forwards the request and still returns the host's body.
|
|
5932
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5924
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-queue-no-reservation-"));
|
|
5933
5925
|
cleanupDirs.push(rootDir);
|
|
5934
5926
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5935
|
-
const runtimeRootDir = path.join(remoteCwd, ".
|
|
5927
|
+
const runtimeRootDir = path.join(remoteCwd, ".wardmote-runtime", "codex");
|
|
5936
5928
|
await mkdir(runtimeRootDir, { recursive: true });
|
|
5937
5929
|
const apiServer = createServer((req, res) => {
|
|
5938
5930
|
res.writeHead(201, { "content-type": "application/json" });
|
|
@@ -5956,7 +5948,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5956
5948
|
runner: createLocalSandboxRunner(),
|
|
5957
5949
|
timeoutMs: 30_000,
|
|
5958
5950
|
};
|
|
5959
|
-
const bridge = await
|
|
5951
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
5960
5952
|
runId: "run-queue-no-reservation",
|
|
5961
5953
|
target,
|
|
5962
5954
|
runtimeRootDir,
|
|
@@ -5965,11 +5957,11 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5965
5957
|
hostApiUrl: `http://127.0.0.1:${address.port}`,
|
|
5966
5958
|
});
|
|
5967
5959
|
try {
|
|
5968
|
-
expect(bridge?.env.
|
|
5969
|
-
const response = await fetch(`${bridge.env.
|
|
5960
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("queue_v1");
|
|
5961
|
+
const response = await fetch(`${bridge.env.WARDMOTE_API_URL}/api/issues/abc/comments`, {
|
|
5970
5962
|
method: "POST",
|
|
5971
5963
|
headers: {
|
|
5972
|
-
authorization: `Bearer ${bridge.env.
|
|
5964
|
+
authorization: `Bearer ${bridge.env.WARDMOTE_API_KEY}`,
|
|
5973
5965
|
"content-type": "application/json",
|
|
5974
5966
|
},
|
|
5975
5967
|
body: JSON.stringify({ body: "hello" }),
|
|
@@ -5992,7 +5984,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
5992
5984
|
// rather than against synthetic frames.
|
|
5993
5985
|
// ---------------------------------------------------------------------------
|
|
5994
5986
|
async function runReadinessReplay(emit) {
|
|
5995
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
5987
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-pty-replay-"));
|
|
5996
5988
|
cleanupDirs.push(rootDir);
|
|
5997
5989
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
5998
5990
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -6009,17 +6001,17 @@ describe("sandbox adapter execution targets", () => {
|
|
|
6009
6001
|
runner,
|
|
6010
6002
|
effectiveCapabilities: duplexCapabilities(true),
|
|
6011
6003
|
};
|
|
6012
|
-
const bridge = await
|
|
6004
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
6013
6005
|
runId: "run-pty-replay",
|
|
6014
6006
|
target,
|
|
6015
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
6007
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
6016
6008
|
adapterKey: "codex",
|
|
6017
6009
|
hostApiToken: "real-run-jwt",
|
|
6018
6010
|
hostApiUrl: api.origin,
|
|
6019
6011
|
enableSandboxDuplexBridge: true,
|
|
6020
6012
|
duplexReadinessTimeoutMs: 2_000,
|
|
6021
6013
|
});
|
|
6022
|
-
const mode = bridge?.env.
|
|
6014
|
+
const mode = bridge?.env.WARDMOTE_API_BRIDGE_MODE;
|
|
6023
6015
|
await bridge?.stop();
|
|
6024
6016
|
await api.close();
|
|
6025
6017
|
return { mode, control };
|
|
@@ -6029,8 +6021,8 @@ describe("sandbox adapter execution targets", () => {
|
|
|
6029
6021
|
// on its own clean line.
|
|
6030
6022
|
it("PTY replay: accepts READY after an echoed prompt and wrapper line", async () => {
|
|
6031
6023
|
const { mode } = await runReadinessReplay((ctx) => {
|
|
6032
|
-
ctx.emitRaw("daytona@212487a7f3c9:~$ exec 2>'/tmp/
|
|
6033
|
-
"exec 'bash' '-c' 'exec env
|
|
6024
|
+
ctx.emitRaw("daytona@212487a7f3c9:~$ exec 2>'/tmp/wardmote-duplex-x.log'; stty raw -echo; " +
|
|
6025
|
+
"exec 'bash' '-c' 'exec env WARDMOTE_BRIDGE_NONCE=" + ctx.nonce + " node gateway.mjs'\r\n");
|
|
6034
6026
|
ctx.emitRaw('{"version":2,"type":"ready","nonce":"' + ctx.nonce + '"}\n');
|
|
6035
6027
|
ctx.connectHttp2();
|
|
6036
6028
|
});
|
|
@@ -6115,7 +6107,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
6115
6107
|
// HTTP/2 server. A pre-preface byte would make the server report a
|
|
6116
6108
|
// `PROTOCOL_ERROR`; this test proves the real session opens cleanly
|
|
6117
6109
|
// instead, which only holds when the offset is exact.
|
|
6118
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
6110
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-preface-offset-"));
|
|
6119
6111
|
cleanupDirs.push(rootDir);
|
|
6120
6112
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
6121
6113
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -6138,17 +6130,17 @@ describe("sandbox adapter execution targets", () => {
|
|
|
6138
6130
|
runner,
|
|
6139
6131
|
effectiveCapabilities: duplexCapabilities(true),
|
|
6140
6132
|
};
|
|
6141
|
-
const bridge = await
|
|
6133
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
6142
6134
|
runId: "run-preface-offset",
|
|
6143
6135
|
target,
|
|
6144
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
6136
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
6145
6137
|
adapterKey: "codex",
|
|
6146
6138
|
hostApiToken: "real-run-jwt",
|
|
6147
6139
|
hostApiUrl: api.origin,
|
|
6148
6140
|
enableSandboxDuplexBridge: true,
|
|
6149
6141
|
});
|
|
6150
6142
|
try {
|
|
6151
|
-
expect(bridge?.env.
|
|
6143
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
6152
6144
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
6153
6145
|
const response = await http2TestRequest(sessionRef.current, {
|
|
6154
6146
|
method: "GET",
|
|
@@ -6170,7 +6162,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
6170
6162
|
// the shell. This test embeds the exact preface bytes in the pre-READY
|
|
6171
6163
|
// noise, then proves a session still starts only at the REAL preface
|
|
6172
6164
|
// that follows READY.
|
|
6173
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
6165
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-http2-preface-lookalike-"));
|
|
6174
6166
|
cleanupDirs.push(rootDir);
|
|
6175
6167
|
const remoteCwd = path.join(rootDir, "workspace");
|
|
6176
6168
|
await mkdir(remoteCwd, { recursive: true });
|
|
@@ -6193,10 +6185,10 @@ describe("sandbox adapter execution targets", () => {
|
|
|
6193
6185
|
runner,
|
|
6194
6186
|
effectiveCapabilities: duplexCapabilities(true),
|
|
6195
6187
|
};
|
|
6196
|
-
const bridge = await
|
|
6188
|
+
const bridge = await startAdapterExecutionTargetWardmoteBridge({
|
|
6197
6189
|
runId: "run-preface-lookalike",
|
|
6198
6190
|
target,
|
|
6199
|
-
runtimeRootDir: path.join(remoteCwd, ".
|
|
6191
|
+
runtimeRootDir: path.join(remoteCwd, ".wardmote-runtime", "codex"),
|
|
6200
6192
|
adapterKey: "codex",
|
|
6201
6193
|
hostApiToken: "real-run-jwt",
|
|
6202
6194
|
hostApiUrl: api.origin,
|
|
@@ -6205,7 +6197,7 @@ describe("sandbox adapter execution targets", () => {
|
|
|
6205
6197
|
try {
|
|
6206
6198
|
expect(bridge).not.toBeNull();
|
|
6207
6199
|
expect(control.openCount).toBe(1);
|
|
6208
|
-
expect(bridge?.env.
|
|
6200
|
+
expect(bridge?.env.WARDMOTE_API_BRIDGE_MODE).toBe("http2_v1");
|
|
6209
6201
|
await waitForCondition(() => sessionRef.current !== null, "the http2 client session to open", 4000);
|
|
6210
6202
|
const response = await http2TestRequest(sessionRef.current, {
|
|
6211
6203
|
method: "GET",
|