@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
|
@@ -3,7 +3,7 @@ import os from "node:os";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
5
|
import { createRuntimeStore } from "acpx/runtime";
|
|
6
|
-
import { DEFAULT_REMOTE_SANDBOX_ADAPTER_TIMEOUT_SEC, prepareAdapterExecutionTargetRuntime,
|
|
6
|
+
import { DEFAULT_REMOTE_SANDBOX_ADAPTER_TIMEOUT_SEC, prepareAdapterExecutionTargetRuntime, startAdapterExecutionTargetWardmoteBridge, startAdapterExecutionTargetProcessSessionBridge, } from "@tickernelz/wardmote-adapter-utils/execution-target";
|
|
7
7
|
// Wrap the staging seam + both sandbox bridges in call-recording spies that
|
|
8
8
|
// still delegate to the real implementations (a runner-backed sandbox test
|
|
9
9
|
// exercises them end-to-end against a local runner). This lets the staging
|
|
@@ -14,7 +14,7 @@ vi.mock("@tickernelz/wardmote-adapter-utils/execution-target", async (importActu
|
|
|
14
14
|
return {
|
|
15
15
|
...actual,
|
|
16
16
|
prepareAdapterExecutionTargetRuntime: vi.fn(actual.prepareAdapterExecutionTargetRuntime),
|
|
17
|
-
|
|
17
|
+
startAdapterExecutionTargetWardmoteBridge: vi.fn(actual.startAdapterExecutionTargetWardmoteBridge),
|
|
18
18
|
startAdapterExecutionTargetProcessSessionBridge: vi.fn(actual.startAdapterExecutionTargetProcessSessionBridge),
|
|
19
19
|
};
|
|
20
20
|
});
|
|
@@ -31,7 +31,7 @@ import { getActiveStepContext, runWithRuntimeParent, SANDBOX_STARTUP_SPAN_ATTRS,
|
|
|
31
31
|
const tempRoots = [];
|
|
32
32
|
let defaultGeminiTestHome;
|
|
33
33
|
async function makeTempRoot() {
|
|
34
|
-
const root = await fs.mkdtemp(path.join(os.tmpdir(), "
|
|
34
|
+
const root = await fs.mkdtemp(path.join(os.tmpdir(), "wardmote-acpx-skills-"));
|
|
35
35
|
tempRoots.push(root);
|
|
36
36
|
return root;
|
|
37
37
|
}
|
|
@@ -59,7 +59,7 @@ async function createSkill(root, name, body = `---\nrequired: false\n---\n# ${na
|
|
|
59
59
|
await fs.mkdir(skillDir, { recursive: true });
|
|
60
60
|
await fs.writeFile(path.join(skillDir, "SKILL.md"), body, "utf8");
|
|
61
61
|
return {
|
|
62
|
-
key: `
|
|
62
|
+
key: `tickernelz/test/${name}`,
|
|
63
63
|
runtimeName: name,
|
|
64
64
|
source: skillDir,
|
|
65
65
|
required: false,
|
|
@@ -244,10 +244,6 @@ function issueSandboxExecFromStore(tracing) {
|
|
|
244
244
|
const activeStep = getActiveStepContext();
|
|
245
245
|
tracing.tracer.startSpan("sandbox.exec", undefined, activeStep?.parentContext);
|
|
246
246
|
}
|
|
247
|
-
// The closed span-attribute allowlist for a sandbox-start span. A test asserts
|
|
248
|
-
// every recorded attribute key is in this set, so a command, path, id, or
|
|
249
|
-
// error-text key can never ride a span. Every key uses the closed
|
|
250
|
-
// `paperclip.sandbox.startup.` prefix from the attribute contract.
|
|
251
247
|
const A = SANDBOX_STARTUP_SPAN_ATTRS;
|
|
252
248
|
const ALLOWED_STARTUP_SPAN_ATTRIBUTE_KEYS = new Set([
|
|
253
249
|
// Step-span keys.
|
|
@@ -272,14 +268,14 @@ const ALLOWED_STARTUP_SPAN_ATTRIBUTE_KEYS = new Set([
|
|
|
272
268
|
// non-reversible run-id hash and its own wall time, so no command, path, id, or
|
|
273
269
|
// error text can ride the `task.run` span.
|
|
274
270
|
const ALLOWED_RUN_SPAN_ATTRIBUTE_KEYS = new Set([
|
|
275
|
-
"
|
|
276
|
-
"
|
|
271
|
+
"wardmote.task.run.run_id",
|
|
272
|
+
"wardmote.task.run.wall_ms",
|
|
277
273
|
]);
|
|
278
274
|
// The closed attribute allowlist for the agent turn span. It carries only its
|
|
279
275
|
// own wall time, so no command, path, id, prompt, or error text can ride the
|
|
280
276
|
// `agent.turn` span.
|
|
281
277
|
const ALLOWED_TURN_SPAN_ATTRIBUTE_KEYS = new Set([
|
|
282
|
-
"
|
|
278
|
+
"wardmote.agent.turn.wall_ms",
|
|
283
279
|
]);
|
|
284
280
|
describe("shared ACPX engine runtime behavior", () => {
|
|
285
281
|
it("integrates the env-free store while delivering current credentials and options to the provider", async () => {
|
|
@@ -347,8 +343,8 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
347
343
|
const root = await makeTempRoot();
|
|
348
344
|
const config = { agent, cwd: root, stateDir: path.join(root, "state") };
|
|
349
345
|
const full = await runExecutor(config);
|
|
350
|
-
const explicitFull = await runExecutor(config, { context: {
|
|
351
|
-
const readOnly = await runExecutor(config, { context: {
|
|
346
|
+
const explicitFull = await runExecutor(config, { context: { wardmoteToolProfile: "full" } });
|
|
347
|
+
const readOnly = await runExecutor(config, { context: { wardmoteToolProfile: "read_only" } });
|
|
352
348
|
for (const run of [full, explicitFull]) {
|
|
353
349
|
expect(run.sessionModes).toEqual([]);
|
|
354
350
|
expect(run.runtimeOptions[0]).not.toHaveProperty("onPermissionRequest");
|
|
@@ -361,7 +357,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
361
357
|
});
|
|
362
358
|
it("leaves agents without a read-only session mode on their configured mode in a read_only run", async () => {
|
|
363
359
|
const root = await makeTempRoot();
|
|
364
|
-
const run = await runExecutor({ agent: "gemini", cwd: root, stateDir: path.join(root, "state") }, { context: {
|
|
360
|
+
const run = await runExecutor({ agent: "gemini", cwd: root, stateDir: path.join(root, "state") }, { context: { wardmoteToolProfile: "read_only" } });
|
|
365
361
|
expect(run.sessionModes).toEqual([]);
|
|
366
362
|
expect(typeof run.runtimeOptions[0]?.onPermissionRequest).toBe("function");
|
|
367
363
|
});
|
|
@@ -407,7 +403,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
407
403
|
};
|
|
408
404
|
const context = {
|
|
409
405
|
taskId: "issue-1",
|
|
410
|
-
|
|
406
|
+
wardmoteWorkspace: { cwd: root },
|
|
411
407
|
};
|
|
412
408
|
const firstOnSpawn = vi.fn(async (meta) => {
|
|
413
409
|
expect(meta).toEqual({ pid: processPid, processGroupId: null, startedAt });
|
|
@@ -524,7 +520,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
524
520
|
});
|
|
525
521
|
expect(logs).toContainEqual({
|
|
526
522
|
stream: "stderr",
|
|
527
|
-
text: "[
|
|
523
|
+
text: "[wardmote] Ignoring invalid user CODEX_CONFIG while applying runtime Codex settings; expected a JSON object.\n",
|
|
528
524
|
});
|
|
529
525
|
});
|
|
530
526
|
it("sets Claude and Gemini models at startup without unsupported picker calls", async () => {
|
|
@@ -557,8 +553,8 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
557
553
|
expect(prompt).toContain("You are agent agent-1");
|
|
558
554
|
expect(prompt).toContain("Connection tools:");
|
|
559
555
|
expect(prompt).toContain("Execution contract:");
|
|
560
|
-
expect(prompt).toContain(context.
|
|
561
|
-
expect(prompt).toContain(context.
|
|
556
|
+
expect(prompt).toContain(context.wardmoteTaskMarkdownAssignment);
|
|
557
|
+
expect(prompt).toContain(context.wardmoteTaskCommunicationGuidance);
|
|
562
558
|
expect(prompt).not.toContain('"objective":');
|
|
563
559
|
expect(prompt).not.toContain("### Issue description");
|
|
564
560
|
expect(prompt).toContain('"id":"comment-first"');
|
|
@@ -571,8 +567,8 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
571
567
|
expect(resumed.sessionInputs[0]?.resumeSessionId).toBe(fresh.result.sessionId);
|
|
572
568
|
const resumedPrompt = String(resumed.turnInputs[0]?.text ?? "");
|
|
573
569
|
expect(resumedPrompt).not.toContain("Execution contract:");
|
|
574
|
-
expect(resumedPrompt).toContain(context.
|
|
575
|
-
expect(resumedPrompt).not.toContain(context.
|
|
570
|
+
expect(resumedPrompt).toContain(context.wardmoteTaskMarkdownAssignmentCompact);
|
|
571
|
+
expect(resumedPrompt).not.toContain(context.wardmoteTaskCommunicationGuidance);
|
|
576
572
|
expect(resumedPrompt).not.toContain('"id":"comment-first"');
|
|
577
573
|
expect(resumedPrompt).toContain('"id":"comment-second"');
|
|
578
574
|
const reset = await runExecutor(config, { context });
|
|
@@ -580,16 +576,16 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
580
576
|
const resetPrompt = String(reset.turnInputs[0]?.text ?? "");
|
|
581
577
|
expect(resetPrompt).toContain("You are agent agent-1");
|
|
582
578
|
expect(resetPrompt).toContain("Connection tools:");
|
|
583
|
-
expect(resetPrompt).toContain(context.
|
|
579
|
+
expect(resetPrompt).toContain(context.wardmoteTaskMarkdownAssignment);
|
|
584
580
|
expect(resetPrompt).toContain("Execution contract:");
|
|
585
581
|
});
|
|
586
|
-
it("includes
|
|
582
|
+
it("includes Wardmote env and API access notes in the ACPX prompt without leaking the token", async () => {
|
|
587
583
|
const { meta } = await runExecutor({ agent: "custom", agentCommand: "node ./fake-acp.js" }, {
|
|
588
584
|
authToken: "runtime-secret-token",
|
|
589
585
|
context: {
|
|
590
586
|
taskId: "issue-1",
|
|
591
587
|
wakeReason: "issue_assigned",
|
|
592
|
-
|
|
588
|
+
wardmoteWake: {
|
|
593
589
|
reason: "issue_assigned",
|
|
594
590
|
issue: { id: "issue-1", identifier: "TEST-1" },
|
|
595
591
|
},
|
|
@@ -597,15 +593,15 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
597
593
|
});
|
|
598
594
|
const prompt = String(meta[0]?.prompt ?? "");
|
|
599
595
|
const promptMetrics = meta[0]?.promptMetrics;
|
|
600
|
-
expect(prompt).toContain("
|
|
596
|
+
expect(prompt).toContain("Wardmote runtime note:");
|
|
601
597
|
expect(prompt).toContain("WARDMOTE_AGENT_ID");
|
|
602
598
|
expect(prompt).toContain("WARDMOTE_API_KEY");
|
|
603
599
|
expect(prompt).not.toContain("WARDMOTE_WAKE_PAYLOAD_JSON");
|
|
604
|
-
expect(prompt).toContain("##
|
|
600
|
+
expect(prompt).toContain("## Wardmote Wake Payload");
|
|
605
601
|
expect(prompt).toContain("TEST-1");
|
|
606
|
-
expect(prompt).toContain("
|
|
607
|
-
expect(prompt).toContain("
|
|
608
|
-
expect(prompt).toContain("
|
|
602
|
+
expect(prompt).toContain("Wardmote API access note:");
|
|
603
|
+
expect(prompt).toContain("wardmoteAddComment");
|
|
604
|
+
expect(prompt).toContain("wardmoteApiRequest");
|
|
609
605
|
expect(prompt).not.toContain("curl ");
|
|
610
606
|
expect(prompt).not.toContain("$WARDMOTE_API_URL/api/");
|
|
611
607
|
expect(prompt).not.toContain("/api/issues/{id}");
|
|
@@ -637,14 +633,14 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
637
633
|
completedActions, coverage: { kind: "full_task_history", throughCommentId: messages[49].id, summaryThroughCommentId: null },
|
|
638
634
|
};
|
|
639
635
|
expect(Buffer.byteLength(JSON.stringify(continuation))).toBeGreaterThan(128 * 1024);
|
|
640
|
-
const context = { taskId: "issue-1",
|
|
636
|
+
const context = { taskId: "issue-1", wardmoteWake: {
|
|
641
637
|
reason: "issue_commented", issue: { id: "issue-1" }, executionContinuation: continuation,
|
|
642
638
|
} };
|
|
643
639
|
const fresh = await runExecutor(config, { context });
|
|
644
640
|
const changedMessage = { ...messages[49], body: "Updated direction: preserve approval gates." };
|
|
645
641
|
const resumed = await runExecutor(config, {
|
|
646
642
|
runtime: { sessionParams: fresh.result.sessionParams },
|
|
647
|
-
context: { ...context,
|
|
643
|
+
context: { ...context, wardmoteWake: { ...context.wardmoteWake, executionContinuation: {
|
|
648
644
|
...continuation, resumeDelta: { baseRunId: "run-1", messages: [changedMessage] },
|
|
649
645
|
} } },
|
|
650
646
|
});
|
|
@@ -676,10 +672,10 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
676
672
|
const context = {
|
|
677
673
|
conversationMode: true,
|
|
678
674
|
taskId: "chat-1",
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
675
|
+
wardmoteTaskMarkdown: chatDirective,
|
|
676
|
+
wardmoteTaskMarkdownCompact: chatDirective,
|
|
677
|
+
wardmoteTaskCommunicationGuidance: "Frozen Slack communication preference.",
|
|
678
|
+
wardmoteWake: {
|
|
683
679
|
reason: "issue_commented",
|
|
684
680
|
issue: { id: "chat-1", workMode: "planning", status: "in_progress" },
|
|
685
681
|
interactionKind: "request_confirmation",
|
|
@@ -720,8 +716,8 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
720
716
|
authToken: "runtime-secret-token",
|
|
721
717
|
context: {
|
|
722
718
|
taskId: "issue-chat-1",
|
|
723
|
-
|
|
724
|
-
|
|
719
|
+
wardmoteTaskMarkdown: "# CHAT-1 — Answer the provider message",
|
|
720
|
+
wardmoteWake: {
|
|
725
721
|
reason: "External chat message received",
|
|
726
722
|
externalChatProvider: "discord",
|
|
727
723
|
checkedOutByHarness: true,
|
|
@@ -756,9 +752,9 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
756
752
|
const promptMetrics = meta[0]?.promptMetrics;
|
|
757
753
|
expect(prompt).toContain("## External chat response contract");
|
|
758
754
|
expect(prompt).toContain("# CHAT-1 — Answer the provider message");
|
|
759
|
-
expect(prompt).toContain("Make zero
|
|
760
|
-
expect(prompt).not.toContain("
|
|
761
|
-
expect(prompt).not.toContain("
|
|
755
|
+
expect(prompt).toContain("Make zero Wardmote API calls");
|
|
756
|
+
expect(prompt).not.toContain("Wardmote API access note:");
|
|
757
|
+
expect(prompt).not.toContain("Wardmote runtime note:");
|
|
762
758
|
expect(prompt).not.toContain("Leave durable progress in comments, documents, or work products");
|
|
763
759
|
expect(promptMetrics?.runtimeNoteChars).toBe(0);
|
|
764
760
|
expect(promptMetrics?.heartbeatPromptChars).toBe(0);
|
|
@@ -768,8 +764,8 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
768
764
|
authToken: "runtime-secret-token",
|
|
769
765
|
context: {
|
|
770
766
|
taskId: "issue-chat-overflow",
|
|
771
|
-
|
|
772
|
-
|
|
767
|
+
wardmoteTaskMarkdown: "# CHAT-2 — Answer every queued message",
|
|
768
|
+
wardmoteWake: {
|
|
773
769
|
reason: "External chat message received",
|
|
774
770
|
externalChatProvider: "slack",
|
|
775
771
|
checkedOutByHarness: true,
|
|
@@ -801,7 +797,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
801
797
|
const prompt = String(meta[0]?.prompt ?? "");
|
|
802
798
|
expect(prompt).not.toContain("read_current_wake_comments");
|
|
803
799
|
expect(prompt).not.toContain("## External chat response contract");
|
|
804
|
-
expect(prompt).toContain("
|
|
800
|
+
expect(prompt).toContain("Wardmote API access note:");
|
|
805
801
|
expect(prompt).toContain("Only fetch the API thread");
|
|
806
802
|
});
|
|
807
803
|
it("preserves a configured agent prompt template on a guarded external-chat turn", async () => {
|
|
@@ -812,7 +808,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
812
808
|
}, {
|
|
813
809
|
context: {
|
|
814
810
|
taskId: "issue-chat-1",
|
|
815
|
-
|
|
811
|
+
wardmoteWake: {
|
|
816
812
|
reason: "External chat message received",
|
|
817
813
|
externalChatProvider: "telegram",
|
|
818
814
|
checkedOutByHarness: true,
|
|
@@ -841,7 +837,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
841
837
|
it("does not show a scoped issue API command when the task id is unavailable", async () => {
|
|
842
838
|
const { meta } = await runExecutor({ agent: "custom", agentCommand: "node ./fake-acp.js" }, { authToken: "runtime-secret-token" });
|
|
843
839
|
const prompt = String(meta[0]?.prompt ?? "");
|
|
844
|
-
expect(prompt).toContain("
|
|
840
|
+
expect(prompt).toContain("Wardmote API access note:");
|
|
845
841
|
expect(prompt).toContain("Use a real issue id from the current context before making issue write requests.");
|
|
846
842
|
expect(prompt).not.toContain("$WARDMOTE_API_BASE/api/issues/$WARDMOTE_TASK_ID");
|
|
847
843
|
});
|
|
@@ -1468,8 +1464,8 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1468
1464
|
const { meta } = await runExecutor({
|
|
1469
1465
|
agent: "claude",
|
|
1470
1466
|
stateDir,
|
|
1471
|
-
|
|
1472
|
-
|
|
1467
|
+
wardmoteRuntimeSkills: [skill],
|
|
1468
|
+
wardmoteSkillSync: { desiredSkills: [skill.key] },
|
|
1473
1469
|
});
|
|
1474
1470
|
const mountedRoot = await onlyChildDir(path.join(stateDir, "runtime-skills", "claude"));
|
|
1475
1471
|
const skillsHome = path.join(mountedRoot, ".claude", "skills");
|
|
@@ -1494,16 +1490,16 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1494
1490
|
agent: "codex",
|
|
1495
1491
|
stateDir: path.join(root, "state"),
|
|
1496
1492
|
env: { CODEX_HOME: codexHome },
|
|
1497
|
-
|
|
1493
|
+
wardmoteRuntimeSkills: [keep, remove],
|
|
1498
1494
|
};
|
|
1499
1495
|
await runExecutor({
|
|
1500
1496
|
...baseConfig,
|
|
1501
|
-
|
|
1497
|
+
wardmoteSkillSync: { desiredSkills: [keep.key, remove.key] },
|
|
1502
1498
|
});
|
|
1503
1499
|
expect(await pathExists(path.join(codexHome, "skills", remove.runtimeName, "SKILL.md"))).toBe(true);
|
|
1504
1500
|
await runExecutor({
|
|
1505
1501
|
...baseConfig,
|
|
1506
|
-
|
|
1502
|
+
wardmoteSkillSync: { desiredSkills: [keep.key] },
|
|
1507
1503
|
});
|
|
1508
1504
|
expect(await pathExists(path.join(codexHome, "skills", keep.runtimeName, "SKILL.md"))).toBe(true);
|
|
1509
1505
|
expect(await pathExists(path.join(codexHome, "skills", keep.runtimeName, "leak.txt"))).toBe(false);
|
|
@@ -1516,14 +1512,14 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1516
1512
|
const codexHome = path.join(root, "codex-home");
|
|
1517
1513
|
const operational = {
|
|
1518
1514
|
...await createSkill(skillRoot, "paperclip"),
|
|
1519
|
-
key: "tickernelz/wardmote/
|
|
1515
|
+
key: "tickernelz/wardmote/wardmote",
|
|
1520
1516
|
};
|
|
1521
1517
|
await runExecutor({
|
|
1522
1518
|
agent: "codex",
|
|
1523
1519
|
stateDir: path.join(root, "state"),
|
|
1524
1520
|
env: { CODEX_HOME: codexHome },
|
|
1525
|
-
|
|
1526
|
-
|
|
1521
|
+
wardmoteRuntimeSkills: [operational],
|
|
1522
|
+
wardmoteSkillSync: { desiredSkills: [] },
|
|
1527
1523
|
});
|
|
1528
1524
|
expect(await pathExists(path.join(codexHome, "skills", operational.runtimeName, "SKILL.md"))).toBe(true);
|
|
1529
1525
|
});
|
|
@@ -1531,7 +1527,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1531
1527
|
const root = await makeTempRoot();
|
|
1532
1528
|
const operational = {
|
|
1533
1529
|
...await createSkill(path.join(root, "skills"), "paperclip"),
|
|
1534
|
-
key: "tickernelz/wardmote/
|
|
1530
|
+
key: "tickernelz/wardmote/wardmote",
|
|
1535
1531
|
};
|
|
1536
1532
|
const homes = [path.join(root, "first-home"), path.join(root, "next-home")];
|
|
1537
1533
|
for (const home of homes) {
|
|
@@ -1539,8 +1535,8 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1539
1535
|
agent,
|
|
1540
1536
|
stateDir: path.join(root, "state"),
|
|
1541
1537
|
env: agent === "codex" ? { CODEX_HOME: home } : { HOME: home },
|
|
1542
|
-
|
|
1543
|
-
|
|
1538
|
+
wardmoteRuntimeSkills: [operational],
|
|
1539
|
+
wardmoteSkillSync: { desiredSkills: [] },
|
|
1544
1540
|
});
|
|
1545
1541
|
const skillsHome = agent === "codex" ? path.join(home, "skills") : path.join(home, ".gemini", "skills");
|
|
1546
1542
|
expect(String(meta[0]?.prompt ?? "")).toContain(`Skill root for this run: ${skillsHome}`);
|
|
@@ -1562,17 +1558,17 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1562
1558
|
agent: "codex",
|
|
1563
1559
|
stateDir: path.join(root, "state"),
|
|
1564
1560
|
env: { CODEX_HOME: codexHome },
|
|
1565
|
-
|
|
1566
|
-
|
|
1561
|
+
wardmoteRuntimeSkills: [legacy],
|
|
1562
|
+
wardmoteSkillSync: { desiredSkills: [] },
|
|
1567
1563
|
});
|
|
1568
1564
|
expect(await pathExists(path.join(skillsHome, legacy.runtimeName))).toBe(false);
|
|
1569
1565
|
});
|
|
1570
1566
|
it.skipIf(process.platform === "win32")("replaces stale managed Codex auth files with source symlinks", async () => {
|
|
1571
1567
|
const root = await makeTempRoot();
|
|
1572
1568
|
const sourceCodexHome = path.join(root, "source-codex-home");
|
|
1573
|
-
const
|
|
1574
|
-
const
|
|
1575
|
-
const managedCodexHome = path.join(
|
|
1569
|
+
const wardmoteHome = path.join(root, "paperclip-home");
|
|
1570
|
+
const wardmoteInstanceId = "test-instance";
|
|
1571
|
+
const managedCodexHome = path.join(wardmoteHome, "instances", wardmoteInstanceId, "companies", "company-1", "codex-home");
|
|
1576
1572
|
await fs.mkdir(sourceCodexHome, { recursive: true });
|
|
1577
1573
|
await fs.mkdir(managedCodexHome, { recursive: true });
|
|
1578
1574
|
const sourceAuth = path.join(sourceCodexHome, "auth.json");
|
|
@@ -1580,17 +1576,17 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1580
1576
|
await fs.writeFile(sourceAuth, "{\"source\":true}", "utf8");
|
|
1581
1577
|
await fs.writeFile(managedAuth, "{\"stale\":true}", "utf8");
|
|
1582
1578
|
const previousCodexHome = process.env.CODEX_HOME;
|
|
1583
|
-
const
|
|
1584
|
-
const
|
|
1579
|
+
const previousWardmoteHome = process.env.WARDMOTE_HOME;
|
|
1580
|
+
const previousWardmoteInstanceId = process.env.WARDMOTE_INSTANCE_ID;
|
|
1585
1581
|
try {
|
|
1586
1582
|
process.env.CODEX_HOME = sourceCodexHome;
|
|
1587
|
-
process.env.WARDMOTE_HOME =
|
|
1588
|
-
process.env.WARDMOTE_INSTANCE_ID =
|
|
1583
|
+
process.env.WARDMOTE_HOME = wardmoteHome;
|
|
1584
|
+
process.env.WARDMOTE_INSTANCE_ID = wardmoteInstanceId;
|
|
1589
1585
|
await runExecutor({
|
|
1590
1586
|
agent: "codex",
|
|
1591
1587
|
stateDir: path.join(root, "state"),
|
|
1592
|
-
|
|
1593
|
-
|
|
1588
|
+
wardmoteRuntimeSkills: [],
|
|
1589
|
+
wardmoteSkillSync: { desiredSkills: [] },
|
|
1594
1590
|
});
|
|
1595
1591
|
}
|
|
1596
1592
|
finally {
|
|
@@ -1598,14 +1594,14 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1598
1594
|
delete process.env.CODEX_HOME;
|
|
1599
1595
|
else
|
|
1600
1596
|
process.env.CODEX_HOME = previousCodexHome;
|
|
1601
|
-
if (
|
|
1597
|
+
if (previousWardmoteHome === undefined)
|
|
1602
1598
|
delete process.env.WARDMOTE_HOME;
|
|
1603
1599
|
else
|
|
1604
|
-
process.env.WARDMOTE_HOME =
|
|
1605
|
-
if (
|
|
1600
|
+
process.env.WARDMOTE_HOME = previousWardmoteHome;
|
|
1601
|
+
if (previousWardmoteInstanceId === undefined)
|
|
1606
1602
|
delete process.env.WARDMOTE_INSTANCE_ID;
|
|
1607
1603
|
else
|
|
1608
|
-
process.env.WARDMOTE_INSTANCE_ID =
|
|
1604
|
+
process.env.WARDMOTE_INSTANCE_ID = previousWardmoteInstanceId;
|
|
1609
1605
|
}
|
|
1610
1606
|
const authStat = await fs.lstat(managedAuth);
|
|
1611
1607
|
expect(authStat.isSymbolicLink()).toBe(true);
|
|
@@ -1614,11 +1610,11 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1614
1610
|
it.each(["OPENAI_API_KEY", "CODEX_API_KEY"])("uses isolated API-key auth instead of the host ChatGPT login for %s", async (keyName) => {
|
|
1615
1611
|
const root = await makeTempRoot();
|
|
1616
1612
|
const sourceCodexHome = path.join(root, "source-codex-home");
|
|
1617
|
-
const
|
|
1613
|
+
const wardmoteHome = path.join(root, "paperclip-home");
|
|
1618
1614
|
await fs.mkdir(sourceCodexHome, { recursive: true });
|
|
1619
1615
|
const sourceAuth = path.join(sourceCodexHome, "auth.json");
|
|
1620
1616
|
await fs.writeFile(sourceAuth, JSON.stringify({ tokens: "host-login" }), "utf8");
|
|
1621
|
-
const managedHome = path.join(
|
|
1617
|
+
const managedHome = path.join(wardmoteHome, "instances", "test-instance", "companies", "company-1", "acp-engine", "agents", "agent-1", "codex-home");
|
|
1622
1618
|
await fs.mkdir(managedHome, { recursive: true });
|
|
1623
1619
|
const managedAuth = path.join(managedHome, "auth.json");
|
|
1624
1620
|
if (process.platform === "win32") {
|
|
@@ -1628,7 +1624,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1628
1624
|
await fs.symlink(sourceAuth, managedAuth);
|
|
1629
1625
|
}
|
|
1630
1626
|
vi.stubEnv("CODEX_HOME", sourceCodexHome);
|
|
1631
|
-
vi.stubEnv("WARDMOTE_HOME",
|
|
1627
|
+
vi.stubEnv("WARDMOTE_HOME", wardmoteHome);
|
|
1632
1628
|
vi.stubEnv("WARDMOTE_INSTANCE_ID", "test-instance");
|
|
1633
1629
|
vi.stubEnv("OPENAI_API_KEY", "");
|
|
1634
1630
|
vi.stubEnv("CODEX_API_KEY", "");
|
|
@@ -1637,8 +1633,8 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1637
1633
|
agent: "codex",
|
|
1638
1634
|
stateDir: path.join(root, "state"),
|
|
1639
1635
|
env: { [keyName]: "sk-acp-test-key" },
|
|
1640
|
-
|
|
1641
|
-
|
|
1636
|
+
wardmoteRuntimeSkills: [],
|
|
1637
|
+
wardmoteSkillSync: { desiredSkills: [] },
|
|
1642
1638
|
});
|
|
1643
1639
|
const sessionEnv = sessionInputs[0].sessionOptions.env;
|
|
1644
1640
|
expect(sessionEnv.CODEX_HOME).toBe(managedHome);
|
|
@@ -1656,11 +1652,11 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1656
1652
|
});
|
|
1657
1653
|
it("sets GROK_HOME for a Grok run from the company Grok home, and leaves CODEX_HOME unchanged for a Codex run", async () => {
|
|
1658
1654
|
const root = await makeTempRoot();
|
|
1659
|
-
const
|
|
1660
|
-
const
|
|
1661
|
-
const
|
|
1655
|
+
const wardmoteHome = path.join(root, "paperclip-home");
|
|
1656
|
+
const previousWardmoteHome = process.env.WARDMOTE_HOME;
|
|
1657
|
+
const previousWardmoteInstanceId = process.env.WARDMOTE_INSTANCE_ID;
|
|
1662
1658
|
try {
|
|
1663
|
-
process.env.WARDMOTE_HOME =
|
|
1659
|
+
process.env.WARDMOTE_HOME = wardmoteHome;
|
|
1664
1660
|
process.env.WARDMOTE_INSTANCE_ID = "default";
|
|
1665
1661
|
const grokRun = await runExecutor({
|
|
1666
1662
|
agent: "grok",
|
|
@@ -1669,7 +1665,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1669
1665
|
});
|
|
1670
1666
|
expect(grokRun.sessionInputs[0]?.sessionOptions).toMatchObject({
|
|
1671
1667
|
env: expect.objectContaining({
|
|
1672
|
-
GROK_HOME: path.join(
|
|
1668
|
+
GROK_HOME: path.join(wardmoteHome, "instances", "default", "companies", "company-1", "grok-home"),
|
|
1673
1669
|
}),
|
|
1674
1670
|
});
|
|
1675
1671
|
const codexHome = path.join(root, "codex-home");
|
|
@@ -1677,8 +1673,8 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1677
1673
|
agent: "codex",
|
|
1678
1674
|
stateDir: path.join(root, "state-codex"),
|
|
1679
1675
|
env: { CODEX_HOME: codexHome },
|
|
1680
|
-
|
|
1681
|
-
|
|
1676
|
+
wardmoteRuntimeSkills: [],
|
|
1677
|
+
wardmoteSkillSync: { desiredSkills: [] },
|
|
1682
1678
|
});
|
|
1683
1679
|
const codexEnv = (codexRun.sessionInputs[0]?.sessionOptions)
|
|
1684
1680
|
.env;
|
|
@@ -1686,14 +1682,14 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1686
1682
|
expect(codexEnv.GROK_HOME).toBeUndefined();
|
|
1687
1683
|
}
|
|
1688
1684
|
finally {
|
|
1689
|
-
if (
|
|
1685
|
+
if (previousWardmoteHome === undefined)
|
|
1690
1686
|
delete process.env.WARDMOTE_HOME;
|
|
1691
1687
|
else
|
|
1692
|
-
process.env.WARDMOTE_HOME =
|
|
1693
|
-
if (
|
|
1688
|
+
process.env.WARDMOTE_HOME = previousWardmoteHome;
|
|
1689
|
+
if (previousWardmoteInstanceId === undefined)
|
|
1694
1690
|
delete process.env.WARDMOTE_INSTANCE_ID;
|
|
1695
1691
|
else
|
|
1696
|
-
process.env.WARDMOTE_INSTANCE_ID =
|
|
1692
|
+
process.env.WARDMOTE_INSTANCE_ID = previousWardmoteInstanceId;
|
|
1697
1693
|
}
|
|
1698
1694
|
});
|
|
1699
1695
|
it("uses direct registry commands and per-session env across ACPX agent changes", async () => {
|
|
@@ -1749,8 +1745,8 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1749
1745
|
CODEX_HOME: codexHome,
|
|
1750
1746
|
[apiKeyName]: "sk-acp-test-key",
|
|
1751
1747
|
},
|
|
1752
|
-
|
|
1753
|
-
|
|
1748
|
+
wardmoteRuntimeSkills: [],
|
|
1749
|
+
wardmoteSkillSync: { desiredSkills: [] },
|
|
1754
1750
|
});
|
|
1755
1751
|
const env = sessionInputs[0].sessionOptions.env;
|
|
1756
1752
|
expect(env[apiKeyName]).toBe("sk-acp-test-key");
|
|
@@ -1769,8 +1765,8 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1769
1765
|
agent: "codex",
|
|
1770
1766
|
stateDir: path.join(root, "state"),
|
|
1771
1767
|
env: { CODEX_HOME: codexHome },
|
|
1772
|
-
|
|
1773
|
-
|
|
1768
|
+
wardmoteRuntimeSkills: [],
|
|
1769
|
+
wardmoteSkillSync: { desiredSkills: [] },
|
|
1774
1770
|
});
|
|
1775
1771
|
const env = sessionInputs[0].sessionOptions.env;
|
|
1776
1772
|
expect(env[apiKeyName]).toBe("sk-host-inherited-key");
|
|
@@ -1803,7 +1799,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1803
1799
|
return runExecutor({ ...config, env: {
|
|
1804
1800
|
WARDMOTE_RUN_SCRATCH_DIR: dir, WARDMOTE_TASK_SCRATCH_DIR: dir,
|
|
1805
1801
|
WARDMOTE_SCRATCH_DIR: dir, WARDMOTE_TMPDIR: dir, TEMP: dir, TMP: dir, TMPDIR: userTemp,
|
|
1806
|
-
} }, { context: { taskId: "issue-1",
|
|
1802
|
+
} }, { context: { taskId: "issue-1", wardmoteScratch: { type: "heartbeat_run", dir, tempKeysApplied: ["TEMP", "TMP"] } } });
|
|
1807
1803
|
}
|
|
1808
1804
|
const first = await withScratch(path.join(root, "run-1"), "/custom/tmp-1");
|
|
1809
1805
|
const second = await withScratch(path.join(root, "run-2"), "/custom/tmp-1");
|
|
@@ -1819,7 +1815,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1819
1815
|
WARDMOTE_RUN_SCRATCH_DIR: dir, WARDMOTE_TASK_SCRATCH_DIR: dir,
|
|
1820
1816
|
WARDMOTE_SCRATCH_DIR: dir, WARDMOTE_TMPDIR: tempDir,
|
|
1821
1817
|
TEMP: tempDir, TMP: tempDir, TMPDIR: userTemp ?? tempDir,
|
|
1822
|
-
} }, { context: { taskId: "issue-1",
|
|
1818
|
+
} }, { context: { taskId: "issue-1", wardmoteScratch: {
|
|
1823
1819
|
type: "heartbeat_run", dir, tempDir,
|
|
1824
1820
|
tempKeysApplied: userTemp ? ["TEMP", "TMP"] : ["TMPDIR", "TEMP", "TMP"],
|
|
1825
1821
|
} } });
|
|
@@ -1858,7 +1854,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1858
1854
|
context: {
|
|
1859
1855
|
taskId: "issue-1",
|
|
1860
1856
|
wakeReason: "issue_assigned",
|
|
1861
|
-
|
|
1857
|
+
wardmoteWorkspace: { cwd, realization: { additional } },
|
|
1862
1858
|
},
|
|
1863
1859
|
});
|
|
1864
1860
|
const projectA = {
|
|
@@ -1909,7 +1905,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1909
1905
|
context: {
|
|
1910
1906
|
taskId: "issue-1",
|
|
1911
1907
|
wakeReason: "issue_assigned",
|
|
1912
|
-
|
|
1908
|
+
wardmoteWorkspace: {
|
|
1913
1909
|
cwd,
|
|
1914
1910
|
realization: {
|
|
1915
1911
|
additional: projectPaths.map((localPath, index) => ({
|
|
@@ -1954,7 +1950,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
1954
1950
|
context: {
|
|
1955
1951
|
taskId: "issue-1",
|
|
1956
1952
|
wakeReason: "issue_assigned",
|
|
1957
|
-
|
|
1953
|
+
wardmoteWorkspace: { cwd, realization: { additional: [referencedProject] } },
|
|
1958
1954
|
},
|
|
1959
1955
|
});
|
|
1960
1956
|
const fp = (r) => r.result.sessionParams?.configFingerprint;
|
|
@@ -2000,7 +1996,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
2000
1996
|
context: {
|
|
2001
1997
|
taskId: "issue-1",
|
|
2002
1998
|
wakeReason: "issue_assigned",
|
|
2003
|
-
|
|
1999
|
+
wardmoteWorkspace: { cwd, realization: { additional: [referencedProject] } },
|
|
2004
2000
|
},
|
|
2005
2001
|
});
|
|
2006
2002
|
const fp = (r) => r.result.sessionParams?.configFingerprint;
|
|
@@ -2086,7 +2082,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
2086
2082
|
const root = await makeTempRoot();
|
|
2087
2083
|
const localCwd = path.join(root, "local");
|
|
2088
2084
|
const remoteCwd = "/workspace/remote";
|
|
2089
|
-
const { sessionInputs, runtimeOptions } = await runExecutor({ agent: "custom", agentCommand: "node ./fake-acp.js", cwd: localCwd, stateDir: path.join(root, "state") }, { context: {
|
|
2085
|
+
const { sessionInputs, runtimeOptions } = await runExecutor({ agent: "custom", agentCommand: "node ./fake-acp.js", cwd: localCwd, stateDir: path.join(root, "state") }, { context: { wardmoteWorkspace: { cwd: localCwd, workspaceWorktreePath: localCwd } }, executionTarget: { kind: "remote", transport: "ssh", remoteCwd } });
|
|
2090
2086
|
const env = sessionInputs[0].sessionOptions.env;
|
|
2091
2087
|
expect(env.WARDMOTE_WORKSPACE_CWD).toBe(localCwd);
|
|
2092
2088
|
// The ssh remote transport is NOT the runner-backed process-session lane, so
|
|
@@ -2357,7 +2353,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
2357
2353
|
await expect(fs.readFile(path.join(stateDir, "run-stderr", "run-warm-1.log"), "utf8")).rejects.toThrow();
|
|
2358
2354
|
await expect(fs.readFile(path.join(stateDir, "run-stderr", "run-warm-2.log"), "utf8")).resolves.toContain("current-run-stderr");
|
|
2359
2355
|
});
|
|
2360
|
-
it("passes
|
|
2356
|
+
it("passes Wardmote env through ACPX session options instead of process.env", async () => {
|
|
2361
2357
|
let observedSessionEnv;
|
|
2362
2358
|
const execute = createAcpxEngineExecutor({
|
|
2363
2359
|
createRuntime: () => ({
|
|
@@ -2397,27 +2393,27 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
2397
2393
|
process.env.WARDMOTE_API_KEY = previousApiKey;
|
|
2398
2394
|
}
|
|
2399
2395
|
});
|
|
2400
|
-
it("writes a
|
|
2396
|
+
it("writes a Wardmote-managed .claude/settings.local.json for the claude agent so it can reach the Wardmote API", async () => {
|
|
2401
2397
|
const root = await makeTempRoot();
|
|
2402
2398
|
const stateDir = path.join(root, "state");
|
|
2403
2399
|
const cwd = path.join(root, "worktree");
|
|
2404
2400
|
await fs.mkdir(cwd, { recursive: true });
|
|
2405
|
-
const { meta } = await runExecutor({ agent: "claude", stateDir, cwd }, { context: {
|
|
2401
|
+
const { meta } = await runExecutor({ agent: "claude", stateDir, cwd }, { context: { wardmoteWorkspace: { cwd, agentHome: path.join(root, "agent-home") } } });
|
|
2406
2402
|
const settingsPath = path.join(cwd, ".claude", "settings.local.json");
|
|
2407
2403
|
const written = JSON.parse(await fs.readFile(settingsPath, "utf8"));
|
|
2408
2404
|
expect(written.permissions?.defaultMode).toBe("default");
|
|
2409
2405
|
const allow = written.permissions?.allow;
|
|
2410
2406
|
expect(Array.isArray(allow)).toBe(true);
|
|
2411
2407
|
expect(allow).toContain("Bash(curl:*)");
|
|
2412
|
-
expect(allow).toContain(`Bash(${cwd}/scripts/
|
|
2408
|
+
expect(allow).toContain(`Bash(${cwd}/scripts/wardmote-issue-update.sh:*)`);
|
|
2413
2409
|
const additionalDirectories = written.permissions?.additionalDirectories;
|
|
2414
2410
|
expect(Array.isArray(additionalDirectories)).toBe(true);
|
|
2415
2411
|
expect(additionalDirectories).toContain(stateDir);
|
|
2416
2412
|
expect(additionalDirectories).toContain(path.join(root, "agent-home"));
|
|
2417
|
-
const note = meta[0]?.commandNotes?.find((entry) => entry.includes("
|
|
2413
|
+
const note = meta[0]?.commandNotes?.find((entry) => entry.includes("Wardmote-managed Claude settings"));
|
|
2418
2414
|
expect(note).toBeTruthy();
|
|
2419
2415
|
});
|
|
2420
|
-
it("merges
|
|
2416
|
+
it("merges Wardmote allowlist into an existing .claude/settings.local.json without losing user entries", async () => {
|
|
2421
2417
|
const root = await makeTempRoot();
|
|
2422
2418
|
const stateDir = path.join(root, "state");
|
|
2423
2419
|
const cwd = path.join(root, "worktree");
|
|
@@ -2430,7 +2426,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
2430
2426
|
defaultMode: "acceptEdits",
|
|
2431
2427
|
},
|
|
2432
2428
|
}, null, 2), "utf8");
|
|
2433
|
-
await runExecutor({ agent: "claude", stateDir, cwd }, { context: {
|
|
2429
|
+
await runExecutor({ agent: "claude", stateDir, cwd }, { context: { wardmoteWorkspace: { cwd } } });
|
|
2434
2430
|
const written = JSON.parse(await fs.readFile(path.join(cwd, ".claude", "settings.local.json"), "utf8"));
|
|
2435
2431
|
expect(written.statusLine).toEqual({ type: "command", command: "preserve-me" });
|
|
2436
2432
|
expect(written.permissions?.defaultMode).toBe("acceptEdits");
|
|
@@ -2445,7 +2441,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
2445
2441
|
const cwd = path.join(root, "worktree");
|
|
2446
2442
|
await fs.mkdir(path.join(cwd, ".claude"), { recursive: true });
|
|
2447
2443
|
await fs.writeFile(path.join(cwd, ".claude", "settings.local.json"), JSON.stringify({ permissions: { defaultMode: "dontAsk" } }, null, 2), "utf8");
|
|
2448
|
-
const { meta } = await runExecutor({ agent: "claude", stateDir, cwd }, { context: {
|
|
2444
|
+
const { meta } = await runExecutor({ agent: "claude", stateDir, cwd }, { context: { wardmoteWorkspace: { cwd } } });
|
|
2449
2445
|
const written = JSON.parse(await fs.readFile(path.join(cwd, ".claude", "settings.local.json"), "utf8"));
|
|
2450
2446
|
expect(written.permissions?.defaultMode).toBe("default");
|
|
2451
2447
|
const overrideNote = meta[0]?.commandNotes?.find((entry) => entry.includes("overrode user dontAsk"));
|
|
@@ -2471,7 +2467,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
2471
2467
|
config: agent === "custom"
|
|
2472
2468
|
? { agent, agentCommand: "node ./fake-acp.js", stateDir: path.join(root, `state-${agent}`), cwd }
|
|
2473
2469
|
: { agent, stateDir: path.join(root, `state-${agent}`), cwd },
|
|
2474
|
-
context: {
|
|
2470
|
+
context: { wardmoteWorkspace: { cwd } },
|
|
2475
2471
|
onLog: async () => { },
|
|
2476
2472
|
onMeta: async () => { },
|
|
2477
2473
|
});
|
|
@@ -2487,7 +2483,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
2487
2483
|
const stateDir = path.join(root, "state");
|
|
2488
2484
|
const cwd = path.join(root, "worktree");
|
|
2489
2485
|
await fs.mkdir(cwd, { recursive: true });
|
|
2490
|
-
await runExecutor({ agent: "codex", stateDir, cwd }, { context: {
|
|
2486
|
+
await runExecutor({ agent: "codex", stateDir, cwd }, { context: { wardmoteWorkspace: { cwd } } });
|
|
2491
2487
|
expect(await pathExists(path.join(cwd, ".claude", "settings.local.json"))).toBe(false);
|
|
2492
2488
|
});
|
|
2493
2489
|
it("changes the ACPX session fingerprint when the resolved secret manifest rotates", async () => {
|
|
@@ -2499,7 +2495,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
2499
2495
|
};
|
|
2500
2496
|
const first = await runExecutor(baseConfig, {
|
|
2501
2497
|
context: {
|
|
2502
|
-
|
|
2498
|
+
wardmoteSecrets: {
|
|
2503
2499
|
manifest: [
|
|
2504
2500
|
{
|
|
2505
2501
|
configPath: "env.API_TOKEN",
|
|
@@ -2516,7 +2512,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
2516
2512
|
});
|
|
2517
2513
|
const second = await runExecutor(baseConfig, {
|
|
2518
2514
|
context: {
|
|
2519
|
-
|
|
2515
|
+
wardmoteSecrets: {
|
|
2520
2516
|
manifest: [
|
|
2521
2517
|
{
|
|
2522
2518
|
configPath: "env.API_TOKEN",
|
|
@@ -2539,7 +2535,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
2539
2535
|
const root = await makeTempRoot();
|
|
2540
2536
|
// This fixture injects its runtime. Keep session identity independent of
|
|
2541
2537
|
// host CLI discovery/version probes while testing MCP credential changes.
|
|
2542
|
-
const config = { agent, agentCommand: "node ./fake-acp.js", cwd: root, stateDir: path.join(root, "state"),
|
|
2538
|
+
const config = { agent, agentCommand: "node ./fake-acp.js", cwd: root, stateDir: path.join(root, "state"), wardmoteRuntimeSkills: [], wardmoteSkillSync: { desiredSkills: [] } };
|
|
2543
2539
|
const first = await runExecutor(config);
|
|
2544
2540
|
const server = { name: "github", url: "https://example.test/github/mcp", connectionId: "github", token: "current-token" };
|
|
2545
2541
|
const second = await runExecutor(config, {
|
|
@@ -2563,7 +2559,7 @@ describe("shared ACPX engine runtime behavior", () => {
|
|
|
2563
2559
|
};
|
|
2564
2560
|
const server = {
|
|
2565
2561
|
name: "github",
|
|
2566
|
-
url: "https://
|
|
2562
|
+
url: "https://wardmote.example/api/tool-gateway/gateways/github/mcp",
|
|
2567
2563
|
connectionId: "connection-1",
|
|
2568
2564
|
};
|
|
2569
2565
|
const first = await runExecutor(baseConfig, {
|
|
@@ -2706,7 +2702,7 @@ describe("gemini ACP flag selection", () => {
|
|
|
2706
2702
|
// timeout is diagnosable from the run log alone.
|
|
2707
2703
|
const startLine = logs.find((entry) => entry.stream === "stderr" && entry.text.includes("Adapter execution timeout:"));
|
|
2708
2704
|
expect(startLine).toBeTruthy();
|
|
2709
|
-
expect(startLine.text).toContain(`[
|
|
2705
|
+
expect(startLine.text).toContain(`[wardmote] Adapter execution timeout: timeoutSec=${DEFAULT_REMOTE_SANDBOX_ADAPTER_TIMEOUT_SEC} ` +
|
|
2710
2706
|
"(sandbox default; set adapterConfig.timeoutSec to override).");
|
|
2711
2707
|
});
|
|
2712
2708
|
it("keeps local execution unlimited by default and logs the unlimited timeout", async () => {
|
|
@@ -2787,8 +2783,6 @@ describe("gemini ACP flag selection", () => {
|
|
|
2787
2783
|
runtimeSessionName: "runtime-session",
|
|
2788
2784
|
}),
|
|
2789
2785
|
startTurn: () => ({
|
|
2790
|
-
// Never yields on its own: only the Paperclip wall-clock timer's
|
|
2791
|
-
// cancel unblocks the turn, simulating a hung run.
|
|
2792
2786
|
events: (async function* () {
|
|
2793
2787
|
await turnCancelled;
|
|
2794
2788
|
})(),
|
|
@@ -3050,12 +3044,12 @@ describe("ACPX engine remote sandbox staging seam (PR 1: workspace + cwd)", () =
|
|
|
3050
3044
|
expect(stageArgs.assets ?? []).toEqual([]);
|
|
3051
3045
|
expect(stageArgs.installCommand ?? null).toBeNull();
|
|
3052
3046
|
// Both bridges receive the real (non-null) runtimeRootDir from staging.
|
|
3053
|
-
const
|
|
3047
|
+
const wardmoteArgs = vi.mocked(startAdapterExecutionTargetWardmoteBridge).mock.calls[0][0];
|
|
3054
3048
|
const processArgs = vi.mocked(startAdapterExecutionTargetProcessSessionBridge).mock.calls[0][0];
|
|
3055
|
-
expect(
|
|
3049
|
+
expect(wardmoteArgs.runtimeRootDir).toBeTruthy();
|
|
3056
3050
|
expect(processArgs.runtimeRootDir).toBeTruthy();
|
|
3057
|
-
expect(String(
|
|
3058
|
-
expect(processArgs.runtimeRootDir).toBe(
|
|
3051
|
+
expect(String(wardmoteArgs.runtimeRootDir)).toContain(".wardmote-runtime");
|
|
3052
|
+
expect(processArgs.runtimeRootDir).toBe(wardmoteArgs.runtimeRootDir);
|
|
3059
3053
|
// The workspace really landed in the sandbox workspace dir.
|
|
3060
3054
|
await expect(fs.readFile(path.join(remoteCwd, "hello.txt"), "utf8")).resolves.toBe("hi");
|
|
3061
3055
|
// And session/new is created on the in-sandbox workspace cwd.
|
|
@@ -3064,12 +3058,12 @@ describe("ACPX engine remote sandbox staging seam (PR 1: workspace + cwd)", () =
|
|
|
3064
3058
|
it.skipIf(process.platform === "win32")("never seeds a remote Codex run from a host API key", async () => {
|
|
3065
3059
|
const { root, stateDir, localCwd, executionTarget } = await setupRemoteSandbox();
|
|
3066
3060
|
const sourceCodexHome = path.join(root, "source-codex-home");
|
|
3067
|
-
const
|
|
3061
|
+
const wardmoteHome = path.join(root, "paperclip-home");
|
|
3068
3062
|
await fs.mkdir(sourceCodexHome, { recursive: true });
|
|
3069
3063
|
const sourceAuth = path.join(sourceCodexHome, "auth.json");
|
|
3070
3064
|
await fs.writeFile(sourceAuth, JSON.stringify({ tokens: "host-login" }), "utf8");
|
|
3071
3065
|
vi.stubEnv("CODEX_HOME", sourceCodexHome);
|
|
3072
|
-
vi.stubEnv("WARDMOTE_HOME",
|
|
3066
|
+
vi.stubEnv("WARDMOTE_HOME", wardmoteHome);
|
|
3073
3067
|
vi.stubEnv("WARDMOTE_INSTANCE_ID", "test-instance");
|
|
3074
3068
|
vi.stubEnv("OPENAI_API_KEY", "sk-host-only-key");
|
|
3075
3069
|
try {
|
|
@@ -3077,14 +3071,14 @@ describe("ACPX engine remote sandbox staging seam (PR 1: workspace + cwd)", () =
|
|
|
3077
3071
|
agent: "codex",
|
|
3078
3072
|
stateDir,
|
|
3079
3073
|
cwd: localCwd,
|
|
3080
|
-
|
|
3081
|
-
|
|
3074
|
+
wardmoteRuntimeSkills: [],
|
|
3075
|
+
wardmoteSkillSync: { desiredSkills: [] },
|
|
3082
3076
|
}, { authToken: "real-run-jwt", executionTarget });
|
|
3083
3077
|
}
|
|
3084
3078
|
finally {
|
|
3085
3079
|
vi.unstubAllEnvs();
|
|
3086
3080
|
}
|
|
3087
|
-
const instanceRoot = path.join(
|
|
3081
|
+
const instanceRoot = path.join(wardmoteHome, "instances", "test-instance", "companies", "company-1");
|
|
3088
3082
|
const subscriptionAuth = path.join(instanceRoot, "codex-home", "auth.json");
|
|
3089
3083
|
expect((await fs.lstat(subscriptionAuth)).isSymbolicLink()).toBe(true);
|
|
3090
3084
|
await expect(fs.readFile(path.join(instanceRoot, "acp-engine", "agents", "agent-1", "codex-home", "auth.json"), "utf8")).rejects.toMatchObject({ code: "ENOENT" });
|
|
@@ -3105,15 +3099,8 @@ describe("ACPX engine remote sandbox staging seam (PR 1: workspace + cwd)", () =
|
|
|
3105
3099
|
}
|
|
3106
3100
|
});
|
|
3107
3101
|
await runExecutor({ agent: "custom", agentCommand: "node ./fake-acp.js", stateDir, cwd: localCwd }, { authToken: "real-run-jwt", executionTarget });
|
|
3108
|
-
// The process-session bridge receives its launch env as a DEFERRED thunk —
|
|
3109
|
-
// the seam that lets its env-independent setup overlap the paperclip bridge
|
|
3110
|
-
// start instead of running strictly after it.
|
|
3111
3102
|
const processArgs = vi.mocked(startAdapterExecutionTargetProcessSessionBridge).mock.calls[0][0];
|
|
3112
3103
|
expect(typeof processArgs.env).toBe("function");
|
|
3113
|
-
// ...and despite the overlap the launch still observes the MERGED paperclip
|
|
3114
|
-
// env: the paperclip-`env` → process-session-launch hand-off stays sequenced
|
|
3115
|
-
// under concurrency (bridge base URL + minted bridge token both present, and
|
|
3116
|
-
// the token is NOT the host run JWT).
|
|
3117
3104
|
const payloadEnv = (launchPayload?.env ?? {});
|
|
3118
3105
|
expect(payloadEnv).toMatchObject({ WARDMOTE_API_BRIDGE_MODE: "queue_v1" });
|
|
3119
3106
|
expect(String(payloadEnv.WARDMOTE_API_URL ?? "")).toMatch(/^http:\/\/127\.0\.0\.1:\d+$/);
|
|
@@ -3144,7 +3131,7 @@ describe("ACPX engine remote sandbox staging seam (PR 1: workspace + cwd)", () =
|
|
|
3144
3131
|
context: {
|
|
3145
3132
|
taskId: "issue-1",
|
|
3146
3133
|
wakeReason: "issue_assigned",
|
|
3147
|
-
|
|
3134
|
+
wardmoteWorkspace: {
|
|
3148
3135
|
cwd: localCwd,
|
|
3149
3136
|
realization: {
|
|
3150
3137
|
additional: [
|
|
@@ -3160,7 +3147,7 @@ describe("ACPX engine remote sandbox staging seam (PR 1: workspace + cwd)", () =
|
|
|
3160
3147
|
},
|
|
3161
3148
|
// The plural workspace-hints channel the agent reads. The referenced hint points at the
|
|
3162
3149
|
// host path today; on a remote target the run must repoint it at the staged directory.
|
|
3163
|
-
|
|
3150
|
+
wardmoteWorkspaces: [
|
|
3164
3151
|
{
|
|
3165
3152
|
workspaceId: "ws-a",
|
|
3166
3153
|
cwd: referencedProjectDir,
|
|
@@ -3183,11 +3170,8 @@ describe("ACPX engine remote sandbox staging seam (PR 1: workspace + cwd)", () =
|
|
|
3183
3170
|
});
|
|
3184
3171
|
it("stops the process-session bridge when the paperclip bridge fails under concurrency", async () => {
|
|
3185
3172
|
const { stateDir, localCwd, executionTarget } = await setupRemoteSandbox();
|
|
3186
|
-
// The paperclip bridge fails; the process-session bridge — started CONCURRENTLY
|
|
3187
|
-
// with it — still resolves a live handle. The abandon path must stop that
|
|
3188
|
-
// handle so no started bridge leaks on partial failure.
|
|
3189
3173
|
const stop = vi.fn(async () => { });
|
|
3190
|
-
vi.mocked(
|
|
3174
|
+
vi.mocked(startAdapterExecutionTargetWardmoteBridge).mockImplementationOnce(async () => {
|
|
3191
3175
|
throw new Error("paperclip bridge boom");
|
|
3192
3176
|
});
|
|
3193
3177
|
vi.mocked(startAdapterExecutionTargetProcessSessionBridge).mockImplementationOnce(async () => ({ agentCommand: null, stop }));
|
|
@@ -3276,7 +3260,7 @@ describe("ACPX engine remote sandbox staging seam (PR 1: workspace + cwd)", () =
|
|
|
3276
3260
|
// A local (non-remote) run never crosses the staging seam or starts a
|
|
3277
3261
|
// bridge, and session/new stays on the HOST cwd — byte-identical to today.
|
|
3278
3262
|
expect(vi.mocked(prepareAdapterExecutionTargetRuntime)).not.toHaveBeenCalled();
|
|
3279
|
-
expect(vi.mocked(
|
|
3263
|
+
expect(vi.mocked(startAdapterExecutionTargetWardmoteBridge)).not.toHaveBeenCalled();
|
|
3280
3264
|
expect(vi.mocked(startAdapterExecutionTargetProcessSessionBridge)).not.toHaveBeenCalled();
|
|
3281
3265
|
expect(sessionInputs[0]?.cwd).toBe(localCwd);
|
|
3282
3266
|
expect(runtimeOptions[0]?.cwd).toBe(localCwd);
|
|
@@ -3378,7 +3362,7 @@ describe("ACPX engine remote managed-home seam (PR 2: per-adapter home seed)", (
|
|
|
3378
3362
|
await expect(fs.readFile(path.join(remoteAssetDir, "config.json"), "utf8")).resolves.toBe("{}");
|
|
3379
3363
|
// ...the staged asset dir resolves under the run's managed runtime root (an
|
|
3380
3364
|
// in-sandbox path), not the host managed-home dir.
|
|
3381
|
-
expect(remoteAssetDir).toContain(".
|
|
3365
|
+
expect(remoteAssetDir).toContain(".wardmote-runtime");
|
|
3382
3366
|
expect(remoteAssetDir).not.toBe(managedHomeDir);
|
|
3383
3367
|
expect(path.isAbsolute(remoteAssetDir)).toBe(true);
|
|
3384
3368
|
});
|
|
@@ -3460,7 +3444,7 @@ describe("ACPX engine remote managed-home seam (PR 2: per-adapter home seed)", (
|
|
|
3460
3444
|
]);
|
|
3461
3445
|
// The run log gains one stderr line that names the project id and the reason.
|
|
3462
3446
|
const failureLine = logs.find((entry) => entry.stream === "stderr" && entry.text.includes("proj-x"));
|
|
3463
|
-
expect(failureLine?.text).toBe("[
|
|
3447
|
+
expect(failureLine?.text).toBe("[wardmote] Referenced project proj-x failed to stage; the run continues without it: extract failed: boom\n");
|
|
3464
3448
|
});
|
|
3465
3449
|
});
|
|
3466
3450
|
describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
@@ -3502,18 +3486,18 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3502
3486
|
const cwd = path.join(root, "worktree");
|
|
3503
3487
|
const stateDir = path.join(root, "state");
|
|
3504
3488
|
await fs.mkdir(cwd, { recursive: true });
|
|
3505
|
-
const skill = await createSkill(path.join(root, "sources"), "
|
|
3506
|
-
"---", "description: >-", " Use for
|
|
3489
|
+
const skill = await createSkill(path.join(root, "sources"), "wardmote--versioned", [
|
|
3490
|
+
"---", "description: >-", " Use for Wardmote-managed tasks", " and durable task documents.",
|
|
3507
3491
|
"---", "PRIVATE_SKILL_BODY_RECIPE", "",
|
|
3508
3492
|
].join("\n"));
|
|
3509
3493
|
const { meta, result } = await runExecutor({
|
|
3510
3494
|
agent: "claude", agentCommand: "node ./fake-acp.js", stateDir, cwd,
|
|
3511
|
-
|
|
3495
|
+
wardmoteRuntimeSkills: [skill], wardmoteSkillSync: { desiredSkills: [skill.key] },
|
|
3512
3496
|
});
|
|
3513
3497
|
const bundle = await onlyChildDir(path.join(stateDir, "runtime-skills", "claude"));
|
|
3514
3498
|
const stagedFile = path.join(bundle, ".claude", "skills", skill.runtimeName, "SKILL.md");
|
|
3515
3499
|
const prompt = String(meta[0]?.prompt ?? "");
|
|
3516
|
-
expect(prompt).toContain(`- ${skill.runtimeName}: Use for
|
|
3500
|
+
expect(prompt).toContain(`- ${skill.runtimeName}: Use for Wardmote-managed tasks and durable task documents. (file: ${stagedFile})`);
|
|
3517
3501
|
expect(prompt).not.toContain("PRIVATE_SKILL_BODY_RECIPE");
|
|
3518
3502
|
expect(prompt).not.toContain(skill.source);
|
|
3519
3503
|
expect(result.sessionParams?.skills).toMatchObject({ selectedSkills: [skill.runtimeName] });
|
|
@@ -3531,7 +3515,7 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3531
3515
|
const skills = [bounded, absent, malformed];
|
|
3532
3516
|
const { meta } = await runExecutor({
|
|
3533
3517
|
agent: "claude", agentCommand: "node ./fake-acp.js", stateDir, cwd,
|
|
3534
|
-
|
|
3518
|
+
wardmoteRuntimeSkills: skills, wardmoteSkillSync: { desiredSkills: skills.map((skill) => skill.key) },
|
|
3535
3519
|
});
|
|
3536
3520
|
const prompt = String(meta[0]?.prompt ?? "");
|
|
3537
3521
|
expect(prompt).toContain(`- bounded: ${"x".repeat(512)} (file: `);
|
|
@@ -3549,8 +3533,8 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3549
3533
|
agentCommand: "node ./fake-acp.js",
|
|
3550
3534
|
stateDir,
|
|
3551
3535
|
cwd: localCwd,
|
|
3552
|
-
|
|
3553
|
-
|
|
3536
|
+
wardmoteRuntimeSkills: [skill],
|
|
3537
|
+
wardmoteSkillSync: { desiredSkills: [skill.key] },
|
|
3554
3538
|
}, { authToken: "real-run-jwt", executionTarget, prepareRemoteManagedHome: stagingClaudeSeam() });
|
|
3555
3539
|
const hostBundleDir = await onlyChildDir(path.join(stateDir, "runtime-skills", "claude"));
|
|
3556
3540
|
const hostSkillsHome = path.join(hostBundleDir, ".claude", "skills");
|
|
@@ -3576,8 +3560,8 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3576
3560
|
agentCommand: "node ./fake-acp.js",
|
|
3577
3561
|
stateDir,
|
|
3578
3562
|
cwd: localCwd,
|
|
3579
|
-
|
|
3580
|
-
|
|
3563
|
+
wardmoteRuntimeSkills: [skill],
|
|
3564
|
+
wardmoteSkillSync: { desiredSkills: [skill.key] },
|
|
3581
3565
|
};
|
|
3582
3566
|
const seamWithOverriddenSkillsDir = (overridePath) => async (input) => {
|
|
3583
3567
|
const stagedRuntime = await input.stage(input.skillsBundleDir
|
|
@@ -3609,8 +3593,8 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3609
3593
|
agentCommand: "node ./fake-acp.js",
|
|
3610
3594
|
stateDir,
|
|
3611
3595
|
cwd: localCwd,
|
|
3612
|
-
|
|
3613
|
-
|
|
3596
|
+
wardmoteRuntimeSkills: [],
|
|
3597
|
+
wardmoteSkillSync: { desiredSkills: [] },
|
|
3614
3598
|
}, { authToken: "real-run-jwt", executionTarget, prepareRemoteManagedHome: stagingClaudeSeam() });
|
|
3615
3599
|
const stageArgs = vi.mocked(prepareAdapterExecutionTargetRuntime).mock.calls[0][0];
|
|
3616
3600
|
expect((stageArgs.assets ?? []).some((asset) => asset.key === "skills")).toBe(false);
|
|
@@ -3620,7 +3604,7 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3620
3604
|
const { stateDir, localCwd, executionTarget } = await setupRemoteSandbox();
|
|
3621
3605
|
const skillsRoot = path.join(localCwd, "skills");
|
|
3622
3606
|
const review = await createSkill(skillsRoot, "review");
|
|
3623
|
-
// A skill whose source is a symlink. `
|
|
3607
|
+
// A skill whose source is a symlink. `materializeWardmoteSkillCopy`
|
|
3624
3608
|
// refuses a symlinked skill root, so this skill's copy fails while its
|
|
3625
3609
|
// source still exists (it does not hit the separate missing-source
|
|
3626
3610
|
// filter).
|
|
@@ -3630,7 +3614,7 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3630
3614
|
const brokenSource = path.join(skillsRoot, "broken");
|
|
3631
3615
|
await fs.symlink(linkedTarget, brokenSource, "dir");
|
|
3632
3616
|
const broken = {
|
|
3633
|
-
key: "
|
|
3617
|
+
key: "tickernelz/test/broken",
|
|
3634
3618
|
runtimeName: "broken",
|
|
3635
3619
|
source: brokenSource,
|
|
3636
3620
|
required: false,
|
|
@@ -3640,8 +3624,8 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3640
3624
|
agentCommand: "node ./fake-acp.js",
|
|
3641
3625
|
stateDir,
|
|
3642
3626
|
cwd: localCwd,
|
|
3643
|
-
|
|
3644
|
-
|
|
3627
|
+
wardmoteRuntimeSkills: [review, broken],
|
|
3628
|
+
wardmoteSkillSync: { desiredSkills: [review.key, broken.key] },
|
|
3645
3629
|
}, { authToken: "real-run-jwt", executionTarget, prepareRemoteManagedHome: stagingClaudeSeam() });
|
|
3646
3630
|
const prompt = String(meta[0]?.prompt ?? "");
|
|
3647
3631
|
expect(prompt).toContain("Selected skills: review");
|
|
@@ -3661,7 +3645,7 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3661
3645
|
const brokenSource = path.join(skillsRoot, "broken");
|
|
3662
3646
|
await fs.symlink(linkedTarget, brokenSource, "dir");
|
|
3663
3647
|
const broken = {
|
|
3664
|
-
key: "
|
|
3648
|
+
key: "tickernelz/test/broken",
|
|
3665
3649
|
runtimeName: "broken",
|
|
3666
3650
|
source: brokenSource,
|
|
3667
3651
|
required: false,
|
|
@@ -3671,8 +3655,8 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3671
3655
|
agentCommand: "node ./fake-acp.js",
|
|
3672
3656
|
stateDir,
|
|
3673
3657
|
cwd: localCwd,
|
|
3674
|
-
|
|
3675
|
-
|
|
3658
|
+
wardmoteRuntimeSkills: [broken],
|
|
3659
|
+
wardmoteSkillSync: { desiredSkills: [broken.key] },
|
|
3676
3660
|
}, { authToken: "real-run-jwt", executionTarget, prepareRemoteManagedHome: stagingClaudeSeam() });
|
|
3677
3661
|
const stageArgs = vi.mocked(prepareAdapterExecutionTargetRuntime).mock.calls[0][0];
|
|
3678
3662
|
expect((stageArgs.assets ?? []).some((asset) => asset.key === "skills")).toBe(false);
|
|
@@ -3683,7 +3667,7 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3683
3667
|
const skillsRoot = path.join(localCwd, "skills");
|
|
3684
3668
|
const review = await createSkill(skillsRoot, "review");
|
|
3685
3669
|
// A skill root that is a real directory (so the copy itself does not
|
|
3686
|
-
// throw), but whose `SKILL.md` is a symlink. `
|
|
3670
|
+
// throw), but whose `SKILL.md` is a symlink. `materializeWardmoteSkillCopy`
|
|
3687
3671
|
// skips a symlinked file entry instead of copying it, so the staged
|
|
3688
3672
|
// directory ends up with no `SKILL.md`.
|
|
3689
3673
|
const linkedSkillMdTarget = path.join(skillsRoot, "linked-skill-md-target.md");
|
|
@@ -3692,7 +3676,7 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3692
3676
|
await fs.mkdir(symlinkedSkillMdSource, { recursive: true });
|
|
3693
3677
|
await fs.symlink(linkedSkillMdTarget, path.join(symlinkedSkillMdSource, "SKILL.md"), "file");
|
|
3694
3678
|
const symlinkedSkillMd = {
|
|
3695
|
-
key: "
|
|
3679
|
+
key: "tickernelz/test/symlinked-skill-md",
|
|
3696
3680
|
runtimeName: "symlinked-skill-md",
|
|
3697
3681
|
source: symlinkedSkillMdSource,
|
|
3698
3682
|
required: false,
|
|
@@ -3702,7 +3686,7 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3702
3686
|
await fs.mkdir(noSkillMdSource, { recursive: true });
|
|
3703
3687
|
await fs.writeFile(path.join(noSkillMdSource, "notes.md"), "# notes\n", "utf8");
|
|
3704
3688
|
const noSkillMd = {
|
|
3705
|
-
key: "
|
|
3689
|
+
key: "tickernelz/test/no-skill-md",
|
|
3706
3690
|
runtimeName: "no-skill-md",
|
|
3707
3691
|
source: noSkillMdSource,
|
|
3708
3692
|
required: false,
|
|
@@ -3712,8 +3696,8 @@ describe("ACPX engine Claude skill bundle staging (remote ACP lane)", () => {
|
|
|
3712
3696
|
agentCommand: "node ./fake-acp.js",
|
|
3713
3697
|
stateDir,
|
|
3714
3698
|
cwd: localCwd,
|
|
3715
|
-
|
|
3716
|
-
|
|
3699
|
+
wardmoteRuntimeSkills: [review, symlinkedSkillMd, noSkillMd],
|
|
3700
|
+
wardmoteSkillSync: { desiredSkills: [review.key, symlinkedSkillMd.key, noSkillMd.key] },
|
|
3717
3701
|
}, { authToken: "real-run-jwt", executionTarget, prepareRemoteManagedHome: stagingClaudeSeam() });
|
|
3718
3702
|
const prompt = String(meta[0]?.prompt ?? "");
|
|
3719
3703
|
expect(prompt).toContain("Selected skills: review");
|
|
@@ -4255,7 +4239,7 @@ describe("ACPX engine remote session-lifecycle re-staging (PR 3: stage once / re
|
|
|
4255
4239
|
expect(disposeCalls).toBe(0);
|
|
4256
4240
|
// Run B resumes the same session and borrows the cached staged runtime, but a
|
|
4257
4241
|
// bridge fails during bring-up.
|
|
4258
|
-
vi.mocked(
|
|
4242
|
+
vi.mocked(startAdapterExecutionTargetWardmoteBridge).mockImplementationOnce(async () => {
|
|
4259
4243
|
throw new Error("paperclip bridge boom");
|
|
4260
4244
|
});
|
|
4261
4245
|
await expect(execute({ runId: "run-b", runtime: { sessionParams: first.sessionParams }, ...base })).rejects.toThrow("paperclip bridge boom");
|
|
@@ -4563,8 +4547,8 @@ describe("ACPX engine sandbox-start spans (opt-in root + child parenting)", () =
|
|
|
4563
4547
|
expect(runSpan.status).toBeNull();
|
|
4564
4548
|
// The run id rides only as a non-reversible hash; the raw run id never rides
|
|
4565
4549
|
// the span.
|
|
4566
|
-
expect(runSpan.attributes["
|
|
4567
|
-
expect(String(runSpan.attributes["
|
|
4550
|
+
expect(runSpan.attributes["wardmote.task.run.run_id"]).toMatch(/^[0-9a-f]{12}$/);
|
|
4551
|
+
expect(String(runSpan.attributes["wardmote.task.run.run_id"])).not.toContain("run-");
|
|
4568
4552
|
});
|
|
4569
4553
|
it("test_sandbox_startup_parents_to_task_run", async () => {
|
|
4570
4554
|
const root = await makeTempRoot();
|
|
@@ -5535,9 +5519,9 @@ describe("ACPX engine run lifecycle corrections (F1: settle every failure after
|
|
|
5535
5519
|
});
|
|
5536
5520
|
it("test_runtime_create_failure_stops_bridges_and_releases_staging_lease", async () => {
|
|
5537
5521
|
const { stateDir, localCwd, executionTarget } = await setupRemoteSandbox();
|
|
5538
|
-
const
|
|
5522
|
+
const wardmoteStop = vi.fn(async () => { });
|
|
5539
5523
|
const processStop = vi.fn(async () => { });
|
|
5540
|
-
vi.mocked(
|
|
5524
|
+
vi.mocked(startAdapterExecutionTargetWardmoteBridge).mockImplementationOnce(async () => ({ env: {}, stop: wardmoteStop }));
|
|
5541
5525
|
vi.mocked(startAdapterExecutionTargetProcessSessionBridge).mockImplementationOnce(async () => ({ agentCommand: null, stop: processStop }));
|
|
5542
5526
|
const stagingLocks = new Map();
|
|
5543
5527
|
const execute = createAcpxEngineExecutor({
|
|
@@ -5563,7 +5547,7 @@ describe("ACPX engine run lifecycle corrections (F1: settle every failure after
|
|
|
5563
5547
|
expect(result.exitCode).toBe(1);
|
|
5564
5548
|
expect(result.resultJson?.phase).toBe("create_runtime");
|
|
5565
5549
|
// Both live bridges stop exactly once.
|
|
5566
|
-
expect(
|
|
5550
|
+
expect(wardmoteStop).toHaveBeenCalledTimes(1);
|
|
5567
5551
|
expect(processStop).toHaveBeenCalledTimes(1);
|
|
5568
5552
|
// The per-session staging lease released, so the lock map does not strand the
|
|
5569
5553
|
// next same-session run.
|
|
@@ -5587,7 +5571,7 @@ describe("ACPX engine run lifecycle corrections (F1: settle every failure after
|
|
|
5587
5571
|
// A throwing accessor on a field only `buildPrompt` reads makes the prompt
|
|
5588
5572
|
// build fail after the session handshake succeeds.
|
|
5589
5573
|
const context = {};
|
|
5590
|
-
Object.defineProperty(context, "
|
|
5574
|
+
Object.defineProperty(context, "wardmoteSessionHandoffMarkdown", {
|
|
5591
5575
|
enumerable: false,
|
|
5592
5576
|
get() {
|
|
5593
5577
|
if (failure === "prompt")
|
|
@@ -5888,11 +5872,11 @@ describe("ACPX engine run lifecycle corrections (F3: one teardown error policy)"
|
|
|
5888
5872
|
// Stub both sandbox bridges with stop spies collected per start, so a test can
|
|
5889
5873
|
// assert the bridges stopped without running the real bridge transport.
|
|
5890
5874
|
function stubBridges() {
|
|
5891
|
-
const
|
|
5875
|
+
const wardmoteStops = [];
|
|
5892
5876
|
const processStops = [];
|
|
5893
|
-
vi.mocked(
|
|
5877
|
+
vi.mocked(startAdapterExecutionTargetWardmoteBridge).mockImplementation(async () => {
|
|
5894
5878
|
const stop = vi.fn(async () => { });
|
|
5895
|
-
|
|
5879
|
+
wardmoteStops.push(stop);
|
|
5896
5880
|
return { env: {}, stop };
|
|
5897
5881
|
});
|
|
5898
5882
|
vi.mocked(startAdapterExecutionTargetProcessSessionBridge).mockImplementation(async () => {
|
|
@@ -5902,11 +5886,11 @@ describe("ACPX engine run lifecycle corrections (F3: one teardown error policy)"
|
|
|
5902
5886
|
});
|
|
5903
5887
|
const anyStopped = (stops) => stops.some((stop) => stop.mock.calls.length > 0);
|
|
5904
5888
|
const stoppedCount = (stops) => stops.filter((stop) => stop.mock.calls.length > 0).length;
|
|
5905
|
-
return {
|
|
5889
|
+
return { wardmoteStops, processStops, anyStopped, stoppedCount };
|
|
5906
5890
|
}
|
|
5907
5891
|
function throwingHandoffContext() {
|
|
5908
5892
|
const context = {};
|
|
5909
|
-
Object.defineProperty(context, "
|
|
5893
|
+
Object.defineProperty(context, "wardmoteSessionHandoffMarkdown", {
|
|
5910
5894
|
enumerable: false,
|
|
5911
5895
|
get() {
|
|
5912
5896
|
throw new Error("prompt build boom");
|
|
@@ -5946,7 +5930,7 @@ describe("ACPX engine run lifecycle corrections (F3: one teardown error policy)"
|
|
|
5946
5930
|
}
|
|
5947
5931
|
it("collects instructions after confirmed close on a thrown provider turn, before workspace restore", async () => {
|
|
5948
5932
|
const { stateDir, localCwd, executionTarget } = await setupRemoteSandbox();
|
|
5949
|
-
const {
|
|
5933
|
+
const { wardmoteStops, anyStopped } = stubBridges();
|
|
5950
5934
|
const order = [];
|
|
5951
5935
|
const execute = createAcpxEngineExecutor({
|
|
5952
5936
|
stagingLocks: new Map(), warmHandles: new Map(), stagedRuntimes: new Map(),
|
|
@@ -5955,7 +5939,7 @@ describe("ACPX engine run lifecycle corrections (F3: one teardown error policy)"
|
|
|
5955
5939
|
});
|
|
5956
5940
|
const result = await execute({ runId: "instruction-stop-failure",
|
|
5957
5941
|
...remoteArgs(stateDir, localCwd, executionTarget, { onProviderStopped: async () => {
|
|
5958
|
-
expect(anyStopped(
|
|
5942
|
+
expect(anyStopped(wardmoteStops)).toBe(true);
|
|
5959
5943
|
order.push("collect");
|
|
5960
5944
|
} }),
|
|
5961
5945
|
});
|
|
@@ -5964,7 +5948,7 @@ describe("ACPX engine run lifecycle corrections (F3: one teardown error policy)"
|
|
|
5964
5948
|
});
|
|
5965
5949
|
it("test_teardown_continues_after_one_teardown_step_fails", async () => {
|
|
5966
5950
|
const { stateDir, localCwd, executionTarget } = await setupRemoteSandbox();
|
|
5967
|
-
const {
|
|
5951
|
+
const { wardmoteStops, processStops, anyStopped } = stubBridges();
|
|
5968
5952
|
const stagingLocks = new Map();
|
|
5969
5953
|
const collectInstructions = vi.fn(async () => { });
|
|
5970
5954
|
const logs = [];
|
|
@@ -5993,7 +5977,7 @@ describe("ACPX engine run lifecycle corrections (F3: one teardown error policy)"
|
|
|
5993
5977
|
expect(result.exitCode).toBe(1);
|
|
5994
5978
|
expect(collectInstructions).not.toHaveBeenCalled();
|
|
5995
5979
|
// The close failure did not stop the bridge stops or the lease release.
|
|
5996
|
-
expect(anyStopped(
|
|
5980
|
+
expect(anyStopped(wardmoteStops)).toBe(true);
|
|
5997
5981
|
expect(anyStopped(processStops)).toBe(true);
|
|
5998
5982
|
expect(stagingLocks.size).toBe(0);
|
|
5999
5983
|
// The close failure was recorded, not silently dropped.
|
|
@@ -6001,7 +5985,7 @@ describe("ACPX engine run lifecycle corrections (F3: one teardown error policy)"
|
|
|
6001
5985
|
});
|
|
6002
5986
|
it("restores managed home and releases the lease when instruction collection rejects", async () => {
|
|
6003
5987
|
const { stateDir, localCwd, executionTarget } = await setupRemoteSandbox();
|
|
6004
|
-
const {
|
|
5988
|
+
const { wardmoteStops, processStops, anyStopped } = stubBridges();
|
|
6005
5989
|
const stagingLocks = new Map();
|
|
6006
5990
|
const order = [];
|
|
6007
5991
|
const logs = [];
|
|
@@ -6022,7 +6006,7 @@ describe("ACPX engine run lifecycle corrections (F3: one teardown error policy)"
|
|
|
6022
6006
|
});
|
|
6023
6007
|
expect(result.exitCode).toBe(1);
|
|
6024
6008
|
expect(order).toEqual(["close", "collect", "restore"]);
|
|
6025
|
-
expect(anyStopped(
|
|
6009
|
+
expect(anyStopped(wardmoteStops)).toBe(true);
|
|
6026
6010
|
expect(anyStopped(processStops)).toBe(true);
|
|
6027
6011
|
expect(stagingLocks.size).toBe(0);
|
|
6028
6012
|
expect(logs.some(text => text.includes('teardown step "instruction-collection" failed: Instruction collection failed'))).toBe(true);
|
|
@@ -6097,7 +6081,7 @@ describe("ACPX engine run lifecycle corrections (F3: one teardown error policy)"
|
|
|
6097
6081
|
});
|
|
6098
6082
|
it("test_result_emission_failure_does_not_skip_teardown", async () => {
|
|
6099
6083
|
const { stateDir, localCwd, executionTarget } = await setupRemoteSandbox();
|
|
6100
|
-
const {
|
|
6084
|
+
const { wardmoteStops, processStops, anyStopped } = stubBridges();
|
|
6101
6085
|
const stagingLocks = new Map();
|
|
6102
6086
|
const execute = createAcpxEngineExecutor({
|
|
6103
6087
|
stagingLocks,
|
|
@@ -6119,13 +6103,13 @@ describe("ACPX engine run lifecycle corrections (F3: one teardown error policy)"
|
|
|
6119
6103
|
},
|
|
6120
6104
|
}),
|
|
6121
6105
|
}).catch(() => { });
|
|
6122
|
-
expect(anyStopped(
|
|
6106
|
+
expect(anyStopped(wardmoteStops)).toBe(true);
|
|
6123
6107
|
expect(anyStopped(processStops)).toBe(true);
|
|
6124
6108
|
expect(stagingLocks.size).toBe(0);
|
|
6125
6109
|
});
|
|
6126
6110
|
it("test_result_mapping_throw_after_close_does_not_rerun_teardown", async () => {
|
|
6127
6111
|
const { stateDir, localCwd, executionTarget } = await setupRemoteSandbox();
|
|
6128
|
-
const {
|
|
6112
|
+
const { wardmoteStops, processStops, stoppedCount } = stubBridges();
|
|
6129
6113
|
let closeCount = 0;
|
|
6130
6114
|
const execute = createAcpxEngineExecutor({
|
|
6131
6115
|
warmHandles: new Map(),
|
|
@@ -6158,7 +6142,7 @@ describe("ACPX engine run lifecycle corrections (F3: one teardown error policy)"
|
|
|
6158
6142
|
// The completed turn closed the runtime once; the mapping throw did not re-run
|
|
6159
6143
|
// the teardown through the turn catch.
|
|
6160
6144
|
expect(closeCount).toBe(1);
|
|
6161
|
-
expect(stoppedCount(
|
|
6145
|
+
expect(stoppedCount(wardmoteStops)).toBe(1);
|
|
6162
6146
|
expect(stoppedCount(processStops)).toBe(1);
|
|
6163
6147
|
});
|
|
6164
6148
|
it("test_teardown_failure_does_not_change_external_result", async () => {
|
|
@@ -6203,7 +6187,7 @@ describe("ACPX engine run lifecycle corrections (F3: one teardown error policy)"
|
|
|
6203
6187
|
];
|
|
6204
6188
|
for (const scenario of scenarios) {
|
|
6205
6189
|
const root = await makeTempRoot();
|
|
6206
|
-
const marker = `
|
|
6190
|
+
const marker = `wardmote-flush-probe-${scenario.name}`;
|
|
6207
6191
|
const execute = createAcpxEngineExecutor({
|
|
6208
6192
|
createRuntime: (options) => {
|
|
6209
6193
|
const opts = options;
|
|
@@ -6441,7 +6425,7 @@ describe("ACPX engine sandbox bridge run-disposition seam (fail-closed)", () =>
|
|
|
6441
6425
|
return { root, stateDir, localCwd, remoteCwd, executionTarget };
|
|
6442
6426
|
}
|
|
6443
6427
|
async function runRemote(handle, runtime, sandbox, deps = {}) {
|
|
6444
|
-
vi.mocked(
|
|
6428
|
+
vi.mocked(startAdapterExecutionTargetWardmoteBridge).mockImplementationOnce(async () => handle);
|
|
6445
6429
|
vi.mocked(startAdapterExecutionTargetProcessSessionBridge).mockImplementationOnce(async () => ({ agentCommand: null, stop: async () => { } }));
|
|
6446
6430
|
const execute = createAcpxEngineExecutor({
|
|
6447
6431
|
createRuntime: () => runtime,
|
|
@@ -7165,7 +7149,7 @@ describe("ACPX startup handshake guard and late-completion fence", () => {
|
|
|
7165
7149
|
markOrderlyCompletion: () => { },
|
|
7166
7150
|
stop: async () => { },
|
|
7167
7151
|
};
|
|
7168
|
-
vi.mocked(
|
|
7152
|
+
vi.mocked(startAdapterExecutionTargetWardmoteBridge).mockImplementationOnce(async () => bridgeHandle);
|
|
7169
7153
|
vi.mocked(startAdapterExecutionTargetProcessSessionBridge).mockImplementationOnce(async () => ({ agentCommand: null, stop: async () => { } }));
|
|
7170
7154
|
const logs = [];
|
|
7171
7155
|
const execute = createAcpxEngineExecutor({
|