@tickernelz/wardmote-adapter-utils 2026.1109.0 → 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 +1 -1
- package/dist/acpx-engine/ephemeral-session-environment.test.js.map +1 -1
- package/dist/acpx-engine/execute-identity.test.js +3 -3
- 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 +135 -196
- package/dist/acpx-engine/execute.js.map +1 -1
- package/dist/acpx-engine/execute.test.js +171 -187
- package/dist/acpx-engine/execute.test.js.map +1 -1
- package/dist/acpx-engine/filesystem-protocol.test.js +1 -1
- 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 +1 -1
- 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 +10 -13
- 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 +6 -6
- package/dist/acpx-engine/spawn-smoke.test.js.map +1 -1
- package/dist/acpx-engine/startup-characterization.test.js +14 -18
- 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/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 +36 -38
- package/dist/command-managed-runtime.test.js.map +1 -1
- package/dist/directory-merge-lock.test.js +1 -1
- package/dist/directory-merge-lock.test.js.map +1 -1
- package/dist/execution-target-sandbox.test.js +259 -267
- package/dist/execution-target-sandbox.test.js.map +1 -1
- package/dist/execution-target-stdin-race.test.js +55 -65
- 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 +35 -86
- package/dist/execution-target.js.map +1 -1
- package/dist/execution-target.test.js +1 -1
- package/dist/execution-target.test.js.map +1 -1
- package/dist/forbidden-config-env.test.js +2 -2
- package/dist/forbidden-config-env.test.js.map +1 -1
- 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 +7 -7
- 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 +5 -5
- package/dist/github-launcher-environment.test.js.map +1 -1
- package/dist/github-launcher.js +8 -8
- 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 +16 -16
- 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/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/runner-connectivity.d.ts +5 -5
- package/dist/runner-connectivity.d.ts.map +1 -1
- package/dist/runner-connectivity.js +11 -11
- 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 +28 -61
- package/dist/sandbox-callback-bridge.js.map +1 -1
- package/dist/sandbox-callback-bridge.test.js +67 -88
- 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-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 +130 -140
- package/dist/sandbox-managed-runtime.test.js.map +1 -1
- package/dist/sandbox-run-log-stream.js +1 -1
- package/dist/sandbox-run-log-stream.js.map +1 -1
- package/dist/server-utils-env.test.js +8 -7
- package/dist/server-utils-env.test.js.map +1 -1
- package/dist/server-utils.d.ts +118 -144
- package/dist/server-utils.d.ts.map +1 -1
- package/dist/server-utils.js +243 -270
- package/dist/server-utils.js.map +1 -1
- package/dist/server-utils.test.js +274 -257
- 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 +16 -38
- 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/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/wardmote-mcp-mount.d.ts +9 -9
- package/dist/wardmote-mcp-mount.d.ts.map +1 -1
- package/dist/wardmote-mcp-mount.js +9 -9
- package/dist/wardmote-mcp-mount.js.map +1 -1
- package/dist/wardmote-mcp.d.ts +23 -25
- package/dist/wardmote-mcp.d.ts.map +1 -1
- package/dist/wardmote-mcp.js +32 -33
- package/dist/wardmote-mcp.js.map +1 -1
- package/dist/wardmote-mcp.test.js +52 -52
- package/dist/wardmote-mcp.test.js.map +1 -1
- package/dist/wardmote-runner-permissions.d.ts +14 -19
- package/dist/wardmote-runner-permissions.d.ts.map +1 -1
- package/dist/wardmote-runner-permissions.js +8 -13
- package/dist/wardmote-runner-permissions.js.map +1 -1
- package/dist/wardmote-runner-permissions.test.js +32 -32
- package/dist/wardmote-runner-permissions.test.js.map +1 -1
- package/dist/workspace-git-stream.test.js +1 -1
- package/dist/workspace-git-stream.test.js.map +1 -1
- package/dist/workspace-manifest.test.js +3 -3
- 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 +3 -3
- package/dist/workspace-restore-merge.js.map +1 -1
- package/dist/workspace-restore-merge.test.js +50 -56
- 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/package.json +2 -2
|
@@ -93,7 +93,7 @@ describe("sandbox callback bridge", () => {
|
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
it("round-trips localhost bridge requests over the sandbox queue without forwarding the bridge token", async () => {
|
|
96
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
96
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-runtime-"));
|
|
97
97
|
cleanupDirs.push(rootDir);
|
|
98
98
|
const localWorkspaceDir = path.join(rootDir, "local-workspace");
|
|
99
99
|
const remoteWorkspaceDir = path.join(rootDir, "remote-workspace");
|
|
@@ -170,7 +170,7 @@ describe("sandbox callback bridge", () => {
|
|
|
170
170
|
authorization: `Bearer ${bridgeToken}`,
|
|
171
171
|
accept: "application/json",
|
|
172
172
|
"if-none-match": '"client-cache-key"',
|
|
173
|
-
"x-
|
|
173
|
+
"x-wardmote-run-id": "run-bridge-1",
|
|
174
174
|
"x-bridge-debug": "drop-me",
|
|
175
175
|
},
|
|
176
176
|
});
|
|
@@ -216,13 +216,13 @@ describe("sandbox callback bridge", () => {
|
|
|
216
216
|
},
|
|
217
217
|
});
|
|
218
218
|
expect(seenRequests[0]?.headers.authorization).toBeUndefined();
|
|
219
|
-
expect(seenRequests[0]?.headers["x-
|
|
219
|
+
expect(seenRequests[0]?.headers["x-wardmote-run-id"]).toBeUndefined();
|
|
220
220
|
const githubResponse = await fetch(`${bridge.baseUrl}/runtime-tools/github/credentials`, {
|
|
221
221
|
method: "POST",
|
|
222
222
|
headers: {
|
|
223
223
|
authorization: `Bearer ${bridgeToken}`,
|
|
224
224
|
"content-type": "application/json",
|
|
225
|
-
"x-
|
|
225
|
+
"x-wardmote-github-capability": "test-run-scoped-capability",
|
|
226
226
|
},
|
|
227
227
|
body: "{}",
|
|
228
228
|
});
|
|
@@ -230,7 +230,7 @@ describe("sandbox callback bridge", () => {
|
|
|
230
230
|
await githubResponse.arrayBuffer();
|
|
231
231
|
expect(seenRequests[1]).toMatchObject({
|
|
232
232
|
method: "POST", path: "/runtime-tools/github/credentials", body: "{}",
|
|
233
|
-
headers: { "x-
|
|
233
|
+
headers: { "x-wardmote-github-capability": "test-run-scoped-capability" },
|
|
234
234
|
});
|
|
235
235
|
expect(seenRequests[1]?.headers.authorization).toBeUndefined();
|
|
236
236
|
const feedbackBody = JSON.stringify({ kind: "complaint", body: "😭".repeat(5000), idempotencyKey: "bridge-feedback" });
|
|
@@ -243,7 +243,7 @@ describe("sandbox callback bridge", () => {
|
|
|
243
243
|
expect(seenRequests[2]?.headers.authorization).toBeUndefined();
|
|
244
244
|
});
|
|
245
245
|
it("publishes complete fixture envelopes before queue readers can reserve their size", async () => {
|
|
246
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
246
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-publication-"));
|
|
247
247
|
cleanupDirs.push(rootDir);
|
|
248
248
|
const client = createFileSystemSandboxCallbackBridgeQueueClient();
|
|
249
249
|
const requestPath = path.join(rootDir, "fixture.json");
|
|
@@ -276,7 +276,7 @@ describe("sandbox callback bridge", () => {
|
|
|
276
276
|
}
|
|
277
277
|
});
|
|
278
278
|
it("keeps the bounded reader fail-closed when a visible request grows after its size is reserved", async () => {
|
|
279
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
279
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-growing-request-"));
|
|
280
280
|
cleanupDirs.push(rootDir);
|
|
281
281
|
const queueDir = path.join(rootDir, "queue");
|
|
282
282
|
const directories = sandboxCallbackBridgeDirectories(queueDir);
|
|
@@ -319,7 +319,7 @@ describe("sandbox callback bridge", () => {
|
|
|
319
319
|
}
|
|
320
320
|
});
|
|
321
321
|
it("serves schema discovery over the queue and denies schema mutations and lookalikes", async () => {
|
|
322
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
322
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-schema-"));
|
|
323
323
|
cleanupDirs.push(rootDir);
|
|
324
324
|
const queueDir = path.join(rootDir, "queue");
|
|
325
325
|
const directories = sandboxCallbackBridgeDirectories(queueDir);
|
|
@@ -360,7 +360,7 @@ describe("sandbox callback bridge", () => {
|
|
|
360
360
|
expect(forwarded).toEqual(["GET /api/openapi.json"]);
|
|
361
361
|
});
|
|
362
362
|
it("denies non-allowlisted requests by default", async () => {
|
|
363
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
363
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-default-policy-"));
|
|
364
364
|
cleanupDirs.push(rootDir);
|
|
365
365
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
366
366
|
const directories = sandboxCallbackBridgeDirectories(queueDir);
|
|
@@ -394,7 +394,7 @@ describe("sandbox callback bridge", () => {
|
|
|
394
394
|
});
|
|
395
395
|
});
|
|
396
396
|
it("drains already-queued requests on stop", async () => {
|
|
397
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
397
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-drain-"));
|
|
398
398
|
cleanupDirs.push(rootDir);
|
|
399
399
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
400
400
|
const directories = sandboxCallbackBridgeDirectories(queueDir);
|
|
@@ -436,7 +436,7 @@ describe("sandbox callback bridge", () => {
|
|
|
436
436
|
await expect(readFile(path.posix.join(directories.responsesDir, "req-b.json"), "utf8")).resolves.toContain("\"req-b\"");
|
|
437
437
|
});
|
|
438
438
|
it("writes fast 503 responses for queued requests that miss the drain deadline", async () => {
|
|
439
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
439
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-drain-timeout-"));
|
|
440
440
|
cleanupDirs.push(rootDir);
|
|
441
441
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
442
442
|
const directories = sandboxCallbackBridgeDirectories(queueDir);
|
|
@@ -484,7 +484,7 @@ describe("sandbox callback bridge", () => {
|
|
|
484
484
|
await expect(readFile(path.posix.join(directories.responsesDir, "req-b.json"), "utf8")).resolves.toContain("Bridge worker stopped before request could be handled.");
|
|
485
485
|
});
|
|
486
486
|
it("handles SSH queue polling failures without emitting an unhandled rejection", async () => {
|
|
487
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
487
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-ssh-failure-"));
|
|
488
488
|
cleanupDirs.push(rootDir);
|
|
489
489
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
490
490
|
const unhandled = [];
|
|
@@ -498,7 +498,7 @@ describe("sandbox callback bridge", () => {
|
|
|
498
498
|
makeDir: async () => { },
|
|
499
499
|
makeDirs: async () => { },
|
|
500
500
|
listJsonFiles: async () => {
|
|
501
|
-
throw new Error("list /remote/.
|
|
501
|
+
throw new Error("list /remote/.wardmote-runtime/gemini/wardmote-bridge/queue/requests failed with exit code 255: kex_exchange_identification: read: Connection reset by peer");
|
|
502
502
|
},
|
|
503
503
|
readTextFile: async () => {
|
|
504
504
|
throw new Error("unexpected readTextFile");
|
|
@@ -531,7 +531,7 @@ describe("sandbox callback bridge", () => {
|
|
|
531
531
|
// terminal catch, killing the relay for the rest of the run. The loop must
|
|
532
532
|
// instead back off, retry, and still deliver requests queued after the
|
|
533
533
|
// failure window.
|
|
534
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
534
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-transient-"));
|
|
535
535
|
cleanupDirs.push(rootDir);
|
|
536
536
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
537
537
|
const directories = sandboxCallbackBridgeDirectories(queueDir);
|
|
@@ -580,19 +580,13 @@ describe("sandbox callback bridge", () => {
|
|
|
580
580
|
expect(listCalls).toBeGreaterThan(3);
|
|
581
581
|
});
|
|
582
582
|
it("keeps the queue-directory setup on the startup step but resets the poll loop store", async () => {
|
|
583
|
-
// The worker starts inside the measured `bridge.paperclip` step. Its awaited
|
|
584
|
-
// queue-directory setup is startup work, so a `makeDir` `sandbox.exec` span
|
|
585
|
-
// must keep the active step and its `criticalPath` flag. The long-lived poll
|
|
586
|
-
// loop runs run-time execs for the whole run, so a loop `sandbox.exec` span
|
|
587
|
-
// must open unparented with no stale flag. This test reads the active step in
|
|
588
|
-
// both places and proves the boundary sits at the loop, not the whole worker.
|
|
589
583
|
let setupStep = "unset";
|
|
590
584
|
let loopStep = "unset";
|
|
591
585
|
let resolveFirstPoll = () => { };
|
|
592
586
|
const firstPoll = new Promise((resolve) => {
|
|
593
587
|
resolveFirstPoll = resolve;
|
|
594
588
|
});
|
|
595
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
589
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-step-store-"));
|
|
596
590
|
cleanupDirs.push(rootDir);
|
|
597
591
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
598
592
|
const worker = await measureStartupStep({}, () => 0, "bridge.paperclip", () => startSandboxCallbackBridgeWorker({
|
|
@@ -633,15 +627,7 @@ describe("sandbox callback bridge", () => {
|
|
|
633
627
|
// stale `criticalPath` flag.
|
|
634
628
|
expect(loopStep).toBeNull();
|
|
635
629
|
});
|
|
636
|
-
it("
|
|
637
|
-
// The worker starts inside the measured `bridge.paperclip` step. Its awaited
|
|
638
|
-
// queue-directory setup is startup work and keeps the active step. The poll
|
|
639
|
-
// loop shell stays outside that store. But a per-request unit of work is
|
|
640
|
-
// run-time work, so the worker runs each request under the current-run
|
|
641
|
-
// parent context. A request `sandbox.exec` span then parents to the live run
|
|
642
|
-
// span, not to the ended startup step. This test drives the worker with a
|
|
643
|
-
// `getRuntimeParentContext` that returns a known token, queues one request,
|
|
644
|
-
// and proves the request work reads that token from the active step store.
|
|
630
|
+
it("test_wardmote_loop_exec_parents_to_run_context", async () => {
|
|
645
631
|
const runParentToken = { marker: "run-parent-token" };
|
|
646
632
|
let setupStep = "unset";
|
|
647
633
|
let requestStep = "unset";
|
|
@@ -650,7 +636,7 @@ describe("sandbox callback bridge", () => {
|
|
|
650
636
|
const requestServed = new Promise((resolve) => {
|
|
651
637
|
resolveServed = resolve;
|
|
652
638
|
});
|
|
653
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
639
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-run-parent-"));
|
|
654
640
|
cleanupDirs.push(rootDir);
|
|
655
641
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
656
642
|
const worker = await measureStartupStep({}, () => 0, "bridge.paperclip", () => startSandboxCallbackBridgeWorker({
|
|
@@ -703,7 +689,7 @@ describe("sandbox callback bridge", () => {
|
|
|
703
689
|
const requestServed = new Promise((resolve) => {
|
|
704
690
|
resolveServed = resolve;
|
|
705
691
|
});
|
|
706
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
692
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-relay-span-"));
|
|
707
693
|
cleanupDirs.push(rootDir);
|
|
708
694
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
709
695
|
const worker = await startSandboxCallbackBridgeWorker({
|
|
@@ -733,7 +719,7 @@ describe("sandbox callback bridge", () => {
|
|
|
733
719
|
await worker.stop();
|
|
734
720
|
expect(wrapped).toContain("sandbox.callbackBridge.relayRequest");
|
|
735
721
|
});
|
|
736
|
-
it("
|
|
722
|
+
it("test_wardmote_loop_exec_stays_unparented_without_getter", async () => {
|
|
737
723
|
// With no `getRuntimeParentContext`, a request runs with an empty active
|
|
738
724
|
// step store, exactly like the earlier `runWithoutActiveStep` behavior. So a
|
|
739
725
|
// request `sandbox.exec` span opens unparented with no stale startup flag.
|
|
@@ -743,7 +729,7 @@ describe("sandbox callback bridge", () => {
|
|
|
743
729
|
const requestServed = new Promise((resolve) => {
|
|
744
730
|
resolveServed = resolve;
|
|
745
731
|
});
|
|
746
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
732
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-no-getter-"));
|
|
747
733
|
cleanupDirs.push(rootDir);
|
|
748
734
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
749
735
|
const worker = await measureStartupStep({}, () => 0, "bridge.paperclip", () => startSandboxCallbackBridgeWorker({
|
|
@@ -770,7 +756,7 @@ describe("sandbox callback bridge", () => {
|
|
|
770
756
|
expect(requestStep).toBeNull();
|
|
771
757
|
});
|
|
772
758
|
it("serializes remote response writes so stop does not recreate a late orphaned response", async () => {
|
|
773
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
759
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-response-lock-"));
|
|
774
760
|
cleanupDirs.push(rootDir);
|
|
775
761
|
const localWorkspaceDir = path.join(rootDir, "local-workspace");
|
|
776
762
|
const remoteWorkspaceDir = path.join(rootDir, "remote-workspace");
|
|
@@ -843,10 +829,10 @@ describe("sandbox callback bridge", () => {
|
|
|
843
829
|
});
|
|
844
830
|
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
845
831
|
await expect(readdir(directories.responsesDir)).resolves.toEqual([]);
|
|
846
|
-
await expect(readdir(directories.responsesDir).then((entries) => entries.filter((entry) => entry.endsWith(".tmp") || entry.includes(".
|
|
832
|
+
await expect(readdir(directories.responsesDir).then((entries) => entries.filter((entry) => entry.endsWith(".tmp") || entry.includes(".wardmote-write.lock")))).resolves.toEqual([]);
|
|
847
833
|
});
|
|
848
834
|
it("rejects non-JSON request bodies and full queues at the bridge server", async () => {
|
|
849
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
835
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-server-guards-"));
|
|
850
836
|
cleanupDirs.push(rootDir);
|
|
851
837
|
const localWorkspaceDir = path.join(rootDir, "local-workspace");
|
|
852
838
|
const remoteWorkspaceDir = path.join(rootDir, "remote-workspace");
|
|
@@ -928,7 +914,7 @@ describe("sandbox callback bridge", () => {
|
|
|
928
914
|
});
|
|
929
915
|
});
|
|
930
916
|
it("returns a 502 when the host response times out", async () => {
|
|
931
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
917
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-timeout-"));
|
|
932
918
|
cleanupDirs.push(rootDir);
|
|
933
919
|
const localWorkspaceDir = path.join(rootDir, "local-workspace");
|
|
934
920
|
const remoteWorkspaceDir = path.join(rootDir, "remote-workspace");
|
|
@@ -974,7 +960,7 @@ describe("sandbox callback bridge", () => {
|
|
|
974
960
|
});
|
|
975
961
|
});
|
|
976
962
|
it("returns a 502 for malformed host response files", async () => {
|
|
977
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
963
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-malformed-response-"));
|
|
978
964
|
cleanupDirs.push(rootDir);
|
|
979
965
|
const localWorkspaceDir = path.join(rootDir, "local-workspace");
|
|
980
966
|
const remoteWorkspaceDir = path.join(rootDir, "remote-workspace");
|
|
@@ -1024,10 +1010,10 @@ describe("sandbox callback bridge", () => {
|
|
|
1024
1010
|
});
|
|
1025
1011
|
});
|
|
1026
1012
|
it("reuses an already-uploaded bridge entrypoint when the remote file hash matches", async () => {
|
|
1027
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1013
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-sync-"));
|
|
1028
1014
|
cleanupDirs.push(rootDir);
|
|
1029
1015
|
const remoteWorkspaceDir = path.join(rootDir, "remote-workspace");
|
|
1030
|
-
const remoteAssetDir = path.posix.join(remoteWorkspaceDir, ".
|
|
1016
|
+
const remoteAssetDir = path.posix.join(remoteWorkspaceDir, ".wardmote-runtime", "codex", "paperclip-bridge", "server");
|
|
1031
1017
|
await mkdir(remoteWorkspaceDir, { recursive: true });
|
|
1032
1018
|
const bridgeAsset = await createSandboxCallbackBridgeAsset();
|
|
1033
1019
|
cleanupFns.push(bridgeAsset.cleanup);
|
|
@@ -1052,15 +1038,15 @@ describe("sandbox callback bridge", () => {
|
|
|
1052
1038
|
expect(first.uploaded).toBe(true);
|
|
1053
1039
|
expect(second.uploaded).toBe(false);
|
|
1054
1040
|
await expect(readFile(path.posix.join(remoteAssetDir, "paperclip-bridge-server.mjs"), "utf8")).resolves.toBe(expandedSource);
|
|
1055
|
-
await expect(readdir(remoteAssetDir).then((entries) => entries.filter((entry) => entry.endsWith(".
|
|
1041
|
+
await expect(readdir(remoteAssetDir).then((entries) => entries.filter((entry) => entry.endsWith(".wardmote-upload.b64") ||
|
|
1056
1042
|
entry.endsWith(".partial") ||
|
|
1057
|
-
entry === ".
|
|
1043
|
+
entry === ".wardmote-bridge-upload.lock"))).resolves.toEqual([]);
|
|
1058
1044
|
});
|
|
1059
1045
|
it("rejects a corrupted bridge entrypoint upload without committing a torn remote file", async () => {
|
|
1060
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1046
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-sync-corrupt-"));
|
|
1061
1047
|
cleanupDirs.push(rootDir);
|
|
1062
1048
|
const remoteWorkspaceDir = path.join(rootDir, "remote-workspace");
|
|
1063
|
-
const remoteAssetDir = path.posix.join(remoteWorkspaceDir, ".
|
|
1049
|
+
const remoteAssetDir = path.posix.join(remoteWorkspaceDir, ".wardmote-runtime", "codex", "paperclip-bridge", "server");
|
|
1064
1050
|
await mkdir(remoteWorkspaceDir, { recursive: true });
|
|
1065
1051
|
const bridgeAsset = await createSandboxCallbackBridgeAsset();
|
|
1066
1052
|
cleanupFns.push(bridgeAsset.cleanup);
|
|
@@ -1078,22 +1064,16 @@ describe("sandbox callback bridge", () => {
|
|
|
1078
1064
|
timeoutMs: 30_000,
|
|
1079
1065
|
})).rejects.toThrow(/sha mismatch/i);
|
|
1080
1066
|
await expect(readFile(path.posix.join(remoteAssetDir, "paperclip-bridge-server.mjs"), "utf8")).rejects.toThrow();
|
|
1081
|
-
await expect(readdir(remoteAssetDir).then((entries) => entries.filter((entry) => entry.endsWith(".
|
|
1067
|
+
await expect(readdir(remoteAssetDir).then((entries) => entries.filter((entry) => entry.endsWith(".wardmote-upload.b64") ||
|
|
1082
1068
|
entry.endsWith(".partial") ||
|
|
1083
|
-
entry === ".
|
|
1069
|
+
entry === ".wardmote-bridge-upload.lock"))).resolves.toEqual([]);
|
|
1084
1070
|
});
|
|
1085
|
-
// The process-session remote script is a static, Paperclip-authored `.mjs`
|
|
1086
|
-
// written into the sandbox on every bridge start. `syncRemoteTextFileWithHashSkip`
|
|
1087
|
-
// (which now backs that write, mirroring the bridge-entrypoint sha256 gate)
|
|
1088
|
-
// content-hash-skips it so a warm start where the remote script already matches
|
|
1089
|
-
// costs ZERO write execs instead of the prior ~3 (prepare/append/finalize base64
|
|
1090
|
-
// upload).
|
|
1091
1071
|
it("test_process_session_script_skipped_when_remote_hash_matches: warm start with a matching remote hash writes 0 execs", async () => {
|
|
1092
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1072
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-hashskip-warm-"));
|
|
1093
1073
|
cleanupDirs.push(rootDir);
|
|
1094
1074
|
const remoteDir = path.join(rootDir, "runtime", "codex", "process-sessions");
|
|
1095
1075
|
const remotePath = path.posix.join(remoteDir, "paperclip-process-session-remote.mjs");
|
|
1096
|
-
const lockDir = path.posix.join(remoteDir, ".
|
|
1076
|
+
const lockDir = path.posix.join(remoteDir, ".wardmote-process-session-script.lock");
|
|
1097
1077
|
const body = "console.log('process session remote script v1');\n";
|
|
1098
1078
|
let execCount = 0;
|
|
1099
1079
|
const inner = createExecRunner();
|
|
@@ -1128,16 +1108,16 @@ describe("sandbox callback bridge", () => {
|
|
|
1128
1108
|
expect(second.sha256).toBe(first.sha256);
|
|
1129
1109
|
// The remote file is unchanged and no upload/partial/lock leftovers remain.
|
|
1130
1110
|
await expect(readFile(remotePath, "utf8")).resolves.toBe(body);
|
|
1131
|
-
await expect(readdir(remoteDir).then((entries) => entries.filter((entry) => entry.endsWith(".
|
|
1111
|
+
await expect(readdir(remoteDir).then((entries) => entries.filter((entry) => entry.endsWith(".wardmote-upload.b64") ||
|
|
1132
1112
|
entry.endsWith(".partial") ||
|
|
1133
|
-
entry === ".
|
|
1113
|
+
entry === ".wardmote-process-session-script.lock"))).resolves.toEqual([]);
|
|
1134
1114
|
});
|
|
1135
1115
|
it("test_process_session_script_rewritten_on_hash_mismatch: a mismatched remote hash still rewrites the script", async () => {
|
|
1136
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1116
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-hashskip-cold-"));
|
|
1137
1117
|
cleanupDirs.push(rootDir);
|
|
1138
1118
|
const remoteDir = path.join(rootDir, "runtime", "codex", "process-sessions");
|
|
1139
1119
|
const remotePath = path.posix.join(remoteDir, "paperclip-process-session-remote.mjs");
|
|
1140
|
-
const lockDir = path.posix.join(remoteDir, ".
|
|
1120
|
+
const lockDir = path.posix.join(remoteDir, ".wardmote-process-session-script.lock");
|
|
1141
1121
|
const body = "console.log('process session remote script v2');\n";
|
|
1142
1122
|
// Pre-seed the remote with a DIFFERENT script (a prior/stale build).
|
|
1143
1123
|
await mkdir(remoteDir, { recursive: true });
|
|
@@ -1157,11 +1137,11 @@ describe("sandbox callback bridge", () => {
|
|
|
1157
1137
|
await expect(readFile(remotePath, "utf8")).resolves.toBe(body);
|
|
1158
1138
|
});
|
|
1159
1139
|
it("fails loud when the hash-skip sync exec errors instead of silently re-uploading", async () => {
|
|
1160
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1140
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-hashskip-fail-"));
|
|
1161
1141
|
cleanupDirs.push(rootDir);
|
|
1162
1142
|
const remoteDir = path.join(rootDir, "runtime", "codex", "process-sessions");
|
|
1163
1143
|
const remotePath = path.posix.join(remoteDir, "paperclip-process-session-remote.mjs");
|
|
1164
|
-
const lockDir = path.posix.join(remoteDir, ".
|
|
1144
|
+
const lockDir = path.posix.join(remoteDir, ".wardmote-process-session-script.lock");
|
|
1165
1145
|
// A runner whose exec fails: the hash-gate cannot be evaluated. The write
|
|
1166
1146
|
// must surface the failure, never swallow it and re-upload behind a green
|
|
1167
1147
|
// return value.
|
|
@@ -1215,7 +1195,6 @@ describe("sandbox callback bridge", () => {
|
|
|
1215
1195
|
{ method: "GET", path: "/api/companies/co-1/email/tasks/issue-1" },
|
|
1216
1196
|
{ method: "GET", path: "/api/companies/co-1/email/deliveries/send-1" },
|
|
1217
1197
|
{ method: "POST", path: "/api/companies/co-1/email/send" },
|
|
1218
|
-
// Hire skill (paperclip-create-agent): discovery + submit + issue linking
|
|
1219
1198
|
{ method: "GET", path: "/llms/agent-configuration.txt" },
|
|
1220
1199
|
{ method: "GET", path: "/llms/agent-configuration/claude_local.txt" },
|
|
1221
1200
|
{ method: "GET", path: "/llms/agent-icons.txt" },
|
|
@@ -1397,7 +1376,7 @@ describe("sandbox callback bridge", () => {
|
|
|
1397
1376
|
const scripts = runner.execute.mock.calls.map(([input]) => input.args?.[1] ?? "");
|
|
1398
1377
|
expect(scripts.filter((script) => script.startsWith("printf"))).toHaveLength(1);
|
|
1399
1378
|
expect(scripts.some((script) => script.startsWith("base64 -d"))).toBe(false);
|
|
1400
|
-
expect(scripts.at(-1)).toMatch(/^rm -f .*
|
|
1379
|
+
expect(scripts.at(-1)).toMatch(/^rm -f .*wardmote-upload/);
|
|
1401
1380
|
expect(vi.getTimerCount()).toBe(0);
|
|
1402
1381
|
}
|
|
1403
1382
|
finally {
|
|
@@ -1458,7 +1437,7 @@ describe("sandbox callback bridge", () => {
|
|
|
1458
1437
|
remoteCwd: "/workspace",
|
|
1459
1438
|
timeoutMs: 30_000,
|
|
1460
1439
|
});
|
|
1461
|
-
await client.makeDir("/workspace/.
|
|
1440
|
+
await client.makeDir("/workspace/.wardmote-runtime/codex/wardmote-bridge/queue");
|
|
1462
1441
|
expect(runner.execute).toHaveBeenCalledWith(expect.objectContaining({
|
|
1463
1442
|
env: {
|
|
1464
1443
|
WARDMOTE_SANDBOX_EXEC_CHANNEL: "bridge",
|
|
@@ -1466,7 +1445,7 @@ describe("sandbox callback bridge", () => {
|
|
|
1466
1445
|
}));
|
|
1467
1446
|
});
|
|
1468
1447
|
it("creates the bridge queue directories in one directory-creation exec", async () => {
|
|
1469
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1448
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-makedirs-"));
|
|
1470
1449
|
cleanupDirs.push(rootDir);
|
|
1471
1450
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
1472
1451
|
const directories = sandboxCallbackBridgeDirectories(queueDir);
|
|
@@ -1499,7 +1478,7 @@ describe("sandbox callback bridge", () => {
|
|
|
1499
1478
|
]);
|
|
1500
1479
|
});
|
|
1501
1480
|
it("falls back to sequential makeDir when the queue client omits makeDirs", async () => {
|
|
1502
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1481
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-makedir-fallback-"));
|
|
1503
1482
|
cleanupDirs.push(rootDir);
|
|
1504
1483
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
1505
1484
|
const directories = sandboxCallbackBridgeDirectories(queueDir);
|
|
@@ -1587,7 +1566,7 @@ describe("sandbox callback bridge", () => {
|
|
|
1587
1566
|
})}\n`;
|
|
1588
1567
|
}
|
|
1589
1568
|
it("times out a stalled poll, surfaces a run-level error, and recovers to deliver the request", async () => {
|
|
1590
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1569
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-hang-"));
|
|
1591
1570
|
cleanupDirs.push(rootDir);
|
|
1592
1571
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
1593
1572
|
const directories = sandboxCallbackBridgeDirectories(queueDir);
|
|
@@ -1892,7 +1871,7 @@ describe("sandbox callback bridge", () => {
|
|
|
1892
1871
|
const responseBody = JSON.parse(parsed.body);
|
|
1893
1872
|
expect(responseBody.outcome).toBe("indeterminate");
|
|
1894
1873
|
expect(responseBody.retryable).toBe(false);
|
|
1895
|
-
expect(parsed.headers?.["x-
|
|
1874
|
+
expect(parsed.headers?.["x-wardmote-bridge-outcome"]).toBe("indeterminate");
|
|
1896
1875
|
expect(responseWrites.some((write) => write.status === 503)).toBe(false);
|
|
1897
1876
|
expect(responseWrites.some((write) => write.status === 502)).toBe(false);
|
|
1898
1877
|
// The backstop removed the request file, so it does not strand in the queue.
|
|
@@ -1985,7 +1964,7 @@ describe("sandbox callback bridge", () => {
|
|
|
1985
1964
|
const responseBody = JSON.parse(parsed.body);
|
|
1986
1965
|
expect(responseBody.outcome).toBe("indeterminate");
|
|
1987
1966
|
expect(responseBody.retryable).toBe(false);
|
|
1988
|
-
expect(parsed.headers?.["x-
|
|
1967
|
+
expect(parsed.headers?.["x-wardmote-bridge-outcome"]).toBe("indeterminate");
|
|
1989
1968
|
expect(requestRemovals).toContain(requestPath);
|
|
1990
1969
|
await worker.stop({ drainTimeoutMs: 10 });
|
|
1991
1970
|
});
|
|
@@ -2238,7 +2217,7 @@ describe("sandbox callback bridge", () => {
|
|
|
2238
2217
|
const responseBody = JSON.parse(parsed.body);
|
|
2239
2218
|
expect(responseBody.outcome).toBe("indeterminate");
|
|
2240
2219
|
expect(responseBody.retryable).toBe(false);
|
|
2241
|
-
expect(parsed.headers?.["x-
|
|
2220
|
+
expect(parsed.headers?.["x-wardmote-bridge-outcome"]).toBe("indeterminate");
|
|
2242
2221
|
// The finalize writes failed before the backstop wrote, so it took a later
|
|
2243
2222
|
// attempt.
|
|
2244
2223
|
expect(writeAttempts).toBeGreaterThanOrEqual(4);
|
|
@@ -2427,7 +2406,7 @@ describe("sandbox callback bridge", () => {
|
|
|
2427
2406
|
// possibly-committed mutation. The outcome header and body still forward, so a
|
|
2428
2407
|
// caller that reads them still sees the indeterminate result.
|
|
2429
2408
|
const source = getSandboxCallbackBridgeServerSource();
|
|
2430
|
-
expect(source).toContain("x-
|
|
2409
|
+
expect(source).toContain("x-wardmote-bridge-outcome");
|
|
2431
2410
|
expect(source).toContain('=== "indeterminate"');
|
|
2432
2411
|
expect(source).toContain("res.statusCode = 409");
|
|
2433
2412
|
});
|
|
@@ -2511,7 +2490,7 @@ describe("sandbox callback bridge", () => {
|
|
|
2511
2490
|
await worker.stop({ drainTimeoutMs: 10 });
|
|
2512
2491
|
});
|
|
2513
2492
|
it("trips the watchdog on a stalled poll, writes a 503, and surfaces a run-level error", async () => {
|
|
2514
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2493
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-watchdog-"));
|
|
2515
2494
|
cleanupDirs.push(rootDir);
|
|
2516
2495
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
2517
2496
|
const directories = sandboxCallbackBridgeDirectories(queueDir);
|
|
@@ -2551,7 +2530,7 @@ describe("sandbox callback bridge", () => {
|
|
|
2551
2530
|
await worker.stop({ drainTimeoutMs: 400 });
|
|
2552
2531
|
});
|
|
2553
2532
|
it("processes a fast request with no false-positive timeout and no run-level error", async () => {
|
|
2554
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2533
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-fast-"));
|
|
2555
2534
|
cleanupDirs.push(rootDir);
|
|
2556
2535
|
const queueDir = path.posix.join(rootDir, "queue");
|
|
2557
2536
|
const directories = sandboxCallbackBridgeDirectories(queueDir);
|
|
@@ -2611,7 +2590,7 @@ describe("sandbox callback bridge", () => {
|
|
|
2611
2590
|
};
|
|
2612
2591
|
}
|
|
2613
2592
|
it("cleans up a timed-out request file and keeps serving after the host recovers", async () => {
|
|
2614
|
-
const fixture = await prepareGatewayFixture("
|
|
2593
|
+
const fixture = await prepareGatewayFixture("wardmote-bridge-timeout-clean-");
|
|
2615
2594
|
const bridge = await startSandboxCallbackBridgeServer({
|
|
2616
2595
|
runner: fixture.runner,
|
|
2617
2596
|
remoteCwd: fixture.remoteWorkspaceDir,
|
|
@@ -2659,7 +2638,7 @@ describe("sandbox callback bridge", () => {
|
|
|
2659
2638
|
await expect(recovered.json()).resolves.toMatchObject({ ok: true });
|
|
2660
2639
|
}, 30_000);
|
|
2661
2640
|
it("sweeps stale request files before rejecting at the queue-depth cap", async () => {
|
|
2662
|
-
const fixture = await prepareGatewayFixture("
|
|
2641
|
+
const fixture = await prepareGatewayFixture("wardmote-bridge-stale-sweep-");
|
|
2663
2642
|
const bridge = await startSandboxCallbackBridgeServer({
|
|
2664
2643
|
runner: fixture.runner,
|
|
2665
2644
|
remoteCwd: fixture.remoteWorkspaceDir,
|
|
@@ -2751,7 +2730,7 @@ describe("sandbox callback bridge", () => {
|
|
|
2751
2730
|
// Before readiness, the crash handlers must not keep the process alive: a
|
|
2752
2731
|
// failed bind means the gateway can never serve, and surviving would only
|
|
2753
2732
|
// leave an un-ready zombie while the host waits out its readiness poll.
|
|
2754
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2733
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-bind-fail-"));
|
|
2755
2734
|
cleanupDirs.push(rootDir);
|
|
2756
2735
|
const entrypoint = path.join(rootDir, "paperclip-bridge-server.mjs");
|
|
2757
2736
|
await writeFile(entrypoint, getSandboxCallbackBridgeServerSource(), "utf8");
|
|
@@ -2782,14 +2761,14 @@ describe("sandbox callback bridge", () => {
|
|
|
2782
2761
|
child.on("close", resolve);
|
|
2783
2762
|
});
|
|
2784
2763
|
expect(exitCode).toBe(1);
|
|
2785
|
-
expect(stderr).toContain("[
|
|
2764
|
+
expect(stderr).toContain("[wardmote-bridge] server error");
|
|
2786
2765
|
expect(stderr).toContain("EADDRINUSE");
|
|
2787
2766
|
}, 15_000);
|
|
2788
2767
|
it("exits nonzero for the retired duplex_v1 mode instead of starting the queue gateway", async () => {
|
|
2789
2768
|
// The closed mode allowlist rejects `duplex_v1` before the queue-directory
|
|
2790
2769
|
// check, so a stale `duplex_v1` launch environment fails startup instead
|
|
2791
2770
|
// of silently falling through to the queue gateway.
|
|
2792
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2771
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-mode-duplex-"));
|
|
2793
2772
|
cleanupDirs.push(rootDir);
|
|
2794
2773
|
const entrypoint = path.join(rootDir, "paperclip-bridge-server.mjs");
|
|
2795
2774
|
await writeFile(entrypoint, getSandboxCallbackBridgeServerSource(), "utf8");
|
|
@@ -2818,7 +2797,7 @@ describe("sandbox callback bridge", () => {
|
|
|
2818
2797
|
it("exits nonzero for an unknown bridge mode instead of starting the queue gateway", async () => {
|
|
2819
2798
|
// The closed mode allowlist rejects every value it does not name, not
|
|
2820
2799
|
// only the retired duplex transport.
|
|
2821
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2800
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-mode-unknown-"));
|
|
2822
2801
|
cleanupDirs.push(rootDir);
|
|
2823
2802
|
const entrypoint = path.join(rootDir, "paperclip-bridge-server.mjs");
|
|
2824
2803
|
await writeFile(entrypoint, getSandboxCallbackBridgeServerSource(), "utf8");
|
|
@@ -2851,7 +2830,7 @@ describe("sandbox callback bridge", () => {
|
|
|
2851
2830
|
// with nothing in between, because the gateway hands stdout to the
|
|
2852
2831
|
// HTTP/2 client immediately after it writes READY and starts no
|
|
2853
2832
|
// heartbeat timer and writes no envelope frame on this path.
|
|
2854
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2833
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-http2-gateway-"));
|
|
2855
2834
|
cleanupDirs.push(rootDir);
|
|
2856
2835
|
const entrypoint = path.join(rootDir, "paperclip-bridge-server.mjs");
|
|
2857
2836
|
await writeFile(entrypoint, getSandboxCallbackBridgeServerSource(), "utf8");
|
|
@@ -2925,7 +2904,7 @@ describe("sandbox callback bridge", () => {
|
|
|
2925
2904
|
* receives, proving the send path carries no intermediate string.
|
|
2926
2905
|
*/
|
|
2927
2906
|
async function startHttp2GatewayForTest(options) {
|
|
2928
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2907
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-http2-test-"));
|
|
2929
2908
|
cleanupDirs.push(rootDir);
|
|
2930
2909
|
const entrypoint = path.join(rootDir, "paperclip-bridge-server.mjs");
|
|
2931
2910
|
await writeFile(entrypoint, getSandboxCallbackBridgeServerSource(), "utf8");
|
|
@@ -3212,7 +3191,7 @@ describe("sandbox callback bridge", () => {
|
|
|
3212
3191
|
bridgeToken,
|
|
3213
3192
|
forwardRequest: async () => ({
|
|
3214
3193
|
status: 504,
|
|
3215
|
-
headers: { "content-type": "application/json", "x-
|
|
3194
|
+
headers: { "content-type": "application/json", "x-wardmote-bridge-outcome": "indeterminate" },
|
|
3216
3195
|
body: Buffer.from(indeterminateBody, "utf8"),
|
|
3217
3196
|
}),
|
|
3218
3197
|
});
|
|
@@ -3223,7 +3202,7 @@ describe("sandbox callback bridge", () => {
|
|
|
3223
3202
|
});
|
|
3224
3203
|
expect(response.status).toBe(409);
|
|
3225
3204
|
expect(response.status).toBeLessThan(500);
|
|
3226
|
-
expect(response.headers.get("x-
|
|
3205
|
+
expect(response.headers.get("x-wardmote-bridge-outcome")).toBe("indeterminate");
|
|
3227
3206
|
const responseBytes = Buffer.from(await response.arrayBuffer());
|
|
3228
3207
|
expect(responseBytes.toString("utf8")).toBe(indeterminateBody);
|
|
3229
3208
|
}, 15_000);
|
|
@@ -3245,10 +3224,10 @@ describe("sandbox callback bridge", () => {
|
|
|
3245
3224
|
headers: { authorization: `Bearer ${bridgeToken}` },
|
|
3246
3225
|
});
|
|
3247
3226
|
expect(response.status).toBe(503);
|
|
3248
|
-
expect(response.headers.get("x-
|
|
3227
|
+
expect(response.headers.get("x-wardmote-bridge-outcome")).toBeNull();
|
|
3249
3228
|
}, 15_000);
|
|
3250
3229
|
async function startQueueGatewayForFileTest(options) {
|
|
3251
|
-
const root = await mkdtemp(path.join(os.tmpdir(), "
|
|
3230
|
+
const root = await mkdtemp(path.join(os.tmpdir(), "wardmote-file-codec-"));
|
|
3252
3231
|
cleanupDirs.push(root);
|
|
3253
3232
|
const asset = await createSandboxCallbackBridgeAsset();
|
|
3254
3233
|
cleanupFns.push(asset.cleanup);
|
|
@@ -3311,12 +3290,12 @@ describe("sandbox callback bridge", () => {
|
|
|
3311
3290
|
method: "POST", headers: { authorization: `Bearer ${gateway.bridgeToken}`, "content-type": "multipart/form-data; boundary=boundary" }, body: Buffer.from([0xff]),
|
|
3312
3291
|
});
|
|
3313
3292
|
expect(response.status).toBe(409);
|
|
3314
|
-
expect(response.headers.get("x-
|
|
3293
|
+
expect(response.headers.get("x-wardmote-bridge-outcome")).toBe("indeterminate");
|
|
3315
3294
|
await expect(response.json()).resolves.toMatchObject({ retryable: false, outcome: "indeterminate" });
|
|
3316
3295
|
expect(handled).toHaveBeenCalledTimes(1);
|
|
3317
3296
|
});
|
|
3318
3297
|
it("rejects a request body over maxBodyBytes on the queue path before it writes the queue file", async () => {
|
|
3319
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3298
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-queue-maxbody-"));
|
|
3320
3299
|
cleanupDirs.push(rootDir);
|
|
3321
3300
|
const localWorkspaceDir = path.join(rootDir, "local-workspace");
|
|
3322
3301
|
const remoteWorkspaceDir = path.join(rootDir, "remote-workspace");
|
|
@@ -3366,7 +3345,7 @@ describe("sandbox callback bridge", () => {
|
|
|
3366
3345
|
expect(requestFiles.filter((name) => name.endsWith(".json"))).toHaveLength(0);
|
|
3367
3346
|
});
|
|
3368
3347
|
it("keeps the queue request payload's body field as a plain JSON string", async () => {
|
|
3369
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
3348
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-bridge-queue-body-shape-"));
|
|
3370
3349
|
cleanupDirs.push(rootDir);
|
|
3371
3350
|
const localWorkspaceDir = path.join(rootDir, "local-workspace");
|
|
3372
3351
|
const remoteWorkspaceDir = path.join(rootDir, "remote-workspace");
|