fix: restore provider workflow fixes and persist ACP resource errors

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-06 11:12:17 -05:00
1 parent a259543902
commit 797e578452
10 files changed
+269 -105

No files matched your search

@@ -52,6 +52,7 @@ import {
const tempRoots: string[] = [];
let defaultGeminiTestHome: string | undefined;
async function makeTempRoot() {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-acpx-skills-"));
@@ -60,6 +61,7 @@ async function makeTempRoot() {
}
afterEach(async () => {
defaultGeminiTestHome = undefined;
// A remote run stages a process-session bridge whose detached event writer can
// still be flushing a trailing event file into `.../process-sessions/<id>/events`
// when the run's own best-effort `client.remove(sessionDir)` (which production
@@ -178,6 +180,13 @@ async function runExecutor(
startupTraceContext?: AdapterExecutionContext["startupTraceContext"];
} = {},
) {
// Skill reconciliation must never inspect or modify the developer's real
// Gemini home. Keep one private home across this test's resumed turns.
const configuredEnv = config.env as Record<string, unknown> | undefined;
if (config.agent === "gemini" && !(typeof configuredEnv?.HOME === "string" && configuredEnv.HOME.trim())) {
defaultGeminiTestHome ??= await makeTempRoot();
config = { ...config, env: { ...configuredEnv, HOME: defaultGeminiTestHome } };
}
const runtimeOptions: Record<string, unknown>[] = [];
const configOptions: Array<{ key: string; value: string }> = [];
const sessionInputs: Record<string, unknown>[] = [];
@@ -603,7 +612,7 @@ describe("shared ACPX engine runtime behavior", () => {
});
});
it("keeps Claude startup model handling and Gemini session config handling unchanged", async () => {
it("sets Claude and Gemini models at startup without unsupported picker calls", async () => {
const claude = await runExecutor({ agent: "claude", model: "claude-opus-4-7" });
expect((claude.meta[0]?.env as Record<string, string>).ANTHROPIC_MODEL).toBe(
"claude-opus-4-7",
@@ -614,9 +623,10 @@ describe("shared ACPX engine runtime behavior", () => {
agent: "gemini",
model: "gemini-2.5-pro",
thinkingEffort: "high",
env: { GEMINI_MODEL: "stale-model" },
});
expect((gemini.meta[0]?.env as Record<string, string>).GEMINI_MODEL).toBe("gemini-2.5-pro");
expect(gemini.configOptions).toEqual([
{ key: "model", value: "gemini-2.5-pro" },
{ key: "effort", value: "high" },
]);
});
@@ -1584,6 +1594,29 @@ describe("shared ACPX engine runtime behavior", () => {
expect(await pathExists(path.join(codexHome, "skills", operational.runtimeName, "SKILL.md"))).toBe(true);
});
it.each(["codex", "gemini"])("refreshes the %s skill root when a connection home changes between turns", async (agent) => {
const root = await makeTempRoot();
const operational = {
...await createSkill(path.join(root, "skills"), "paperclip"),
key: "paperclipai/paperclip/paperclip",
};
const homes = [path.join(root, "first-home"), path.join(root, "next-home")];
for (const home of homes) {
const { meta } = await runExecutor({
agent,
stateDir: path.join(root, "state"),
env: agent === "codex" ? { CODEX_HOME: home } : { HOME: home },
paperclipRuntimeSkills: [operational],
paperclipSkillSync: { desiredSkills: [] },
});
const skillsHome = agent === "codex" ? path.join(home, "skills") : path.join(home, ".gemini", "skills");
expect(String(meta[0]?.prompt ?? "")).toContain(`Skill root for this run: ${skillsHome}`);
expect(String(meta[0]?.prompt ?? "")).toContain("Resolve referenced scripts and files relative to that skill");
if (home === homes[1]) expect(String(meta[0]?.prompt ?? "")).not.toContain(homes[0]!);
await fs.rm(home, { recursive: true, force: true });
}
});
it.skipIf(process.platform === "win32")("removes legacy ACPX Codex skill symlinks when a skill is no longer desired", async () => {
const root = await makeTempRoot();
const skillRoot = path.join(root, "skills");
@@ -2870,6 +2903,21 @@ describe("findAncestorBin", () => {
});
describe("gemini ACP flag selection", () => {
it("uses the canonical local Gemini workspace for ACP filesystem requests", async () => {
const root = await makeTempRoot();
const workspace = path.join(root, "workspace");
const alias = path.join(root, "workspace-alias");
await fs.mkdir(workspace);
await fs.symlink(workspace, alias, process.platform === "win32" ? "junction" : "dir");
const { runtimeOptions, sessionInputs } = await runExecutor({
agent: "gemini", agentCommand: "node ./fake-acp.js", cwd: alias,
stateDir: path.join(root, "state"),
});
const canonical = await fs.realpath(workspace);
expect(runtimeOptions[0]!.cwd).toBe(canonical);
expect(sessionInputs[0]!.cwd).toBe(canonical);
});
it("parses semantic version parts from gemini --version output", () => {
expect(parseGeminiVersionParts("0.30.0")).toEqual([0, 30, 0]);
expect(parseGeminiVersionParts("gemini-cli v1.2.3\n")).toEqual([1, 2, 3]);
@@ -3526,6 +3574,16 @@ describe("ACPX engine remote sandbox staging seam (PR 1: workspace + cwd)", () =
expect(sessionInputs[0]?.cwd).not.toBe(localCwd);
});
it("preserves Gemini's in-sandbox workspace without host canonicalization", async () => {
const { stateDir, localCwd, remoteCwd, executionTarget } = await setupRemoteSandbox();
const { sessionInputs, runtimeOptions } = await runExecutor(
{ agent: "gemini", agentCommand: "node ./fake-acp.js", stateDir, cwd: localCwd },
{ authToken: "real-run-jwt", executionTarget },
);
expect(runtimeOptions[0]?.cwd).toBe(remoteCwd);
expect(sessionInputs[0]?.cwd).toBe(remoteCwd);
});
it("test_remote_warm_handle_reused_after_cwd_change", async () => {
const { stateDir, localCwd, remoteCwd, executionTarget } = await setupRemoteSandbox();
const ensureInputs: Array<Record<string, unknown>> = [];
@@ -2039,6 +2039,12 @@ async function buildRuntime(input: {
if (requestedModel && acpxAgent === "claude" && !env.ANTHROPIC_MODEL) {
env.ANTHROPIC_MODEL = requestedModel;
}
// Gemini CLI reads GEMINI_MODEL when creating each ACP session. Its ACP
// implementation supports set_model, but not set_config_option; configure
// the selected model before startup without changing the transport.
if (requestedModel && acpxAgent === "gemini") {
env.GEMINI_MODEL = requestedModel;
}
if (acpxAgent === "codex") {
const codexStartupConfig = buildCodexStartupConfig({
existingConfig: env.CODEX_CONFIG,
@@ -2184,8 +2190,9 @@ async function buildRuntime(input: {
// (fingerprint, compat, persist, ensureSession, error) bind to THIS single
// value so a warm/resumable session created with the in-sandbox cwd is reused
// — not invalidated — on the next run. Remote runner-backed → the in-sandbox
// workspace dir; local and the runner-less fallback → the HOST cwd,
// byte-identical to today.
// workspace dir; local and the runner-less fallback → the HOST cwd.
// Local Gemini resolves tool paths through realpath. Give its ACP filesystem
// client the same canonical root so workspace aliases stay within that root.
//
// PR 3: the staging transport derives the in-sandbox workspace dir
// deterministically from the target's `remoteCwd` (it is exactly `remoteCwd`
@@ -2198,7 +2205,9 @@ async function buildRuntime(input: {
const sessionCwd =
useRemoteProcessSession && executionTarget?.kind === "remote"
? executionTarget.remoteCwd
: cwd;
: acpxAgent === "gemini" && !executionTargetIsRemote
? await fs.realpath(cwd)
: cwd;
// The 17 fields the session fingerprint hashes. Company, agent, and task
// identifiers are NOT here; they scope the outer session key only (see
// `keyIdentity`). The fingerprint builder accepts only this identity.
@@ -2542,6 +2551,28 @@ async function buildRuntime(input: {
await emitRunPhaseTiming(input.ctx, "start_transport", nowMs() - startTransportStart, "failed");
throw err;
}
const currentSkillRoot = acpxAgent === "codex" && runtimeEnv.CODEX_HOME
? path.join(runtimeEnv.CODEX_HOME, "skills")
: acpxAgent === "gemini" && !executionTargetIsRemote && typeof skillsIdentity.skillsHome === "string"
? skillsIdentity.skillsHome
: null;
if (currentSkillRoot && Array.isArray(skillsIdentity.selectedSkills) && skillsIdentity.selectedSkills.length > 0) {
// Managed connection homes are disposable. A resumed conversation may
// remember a previous home's skill paths; supply the current root on every
// turn, after the remote launch environment has rebased CODEX_HOME.
skillPromptInstructions = [
`Paperclip has materialized selected runtime skills for this ACPX ${acpxAgent === "codex" ? "Codex" : "Gemini"} run.`,
`Skill root for this run: ${currentSkillRoot}`,
`Selected skills: ${skillsIdentity.selectedSkills.join(", ")}`,
"When a task calls for one of these skills, read its SKILL.md from this root and follow it. Resolve referenced scripts and files relative to that skill. Use this run's root even when an earlier turn used a different path.",
...(acpxAgent === "gemini" && skillsIdentity.selectedSkills.includes("paperclip")
? [
"Before calling Paperclip APIs or delivering task artifacts, read the selected paperclip skill's SKILL.md and its referenced artifact workflow. A completion comment does not upload an artifact or change task status.",
"Gemini's shell tool rejects command substitution. Write JSON request bodies to a workspace file and use curl --data-binary @file, or use the selected skill's helpers, instead of constructing a body with command substitution.",
]
: []),
].join("\n");
}
// The relay runs on the host with the sanitized remote launch environment.
// Its /usr/bin/env node shebang cannot rely on that environment's PATH.
const overrideCommand = processSessionBridge?.agentCommand
@@ -2609,13 +2640,14 @@ async function buildRuntime(input: {
function sessionConfigOptions(prepared: AcpxPreparedRuntime): Array<{ key: string; value: string }> {
const options: Array<{ key: string; value: string }> = [];
// Claude and Codex runtime config is pre-set via startup env vars; skip
// Claude, Codex and Gemini runtime config is pre-set via startup env vars; skip
// set_config_option to avoid ACP-server picker validation rejecting valid
// backend model IDs that are not advertised by the local ACP server.
if (
prepared.requestedModel &&
prepared.acpxAgent !== "claude" &&
prepared.acpxAgent !== "codex"
prepared.acpxAgent !== "codex" &&
prepared.acpxAgent !== "gemini"
) {
options.push({ key: "model", value: prepared.requestedModel });
}
@@ -4761,6 +4793,8 @@ export function createAcpxEngineExecutor(deps: AcpxEngineExecutorOptions = {}) {
? `Requested ACPX model: ${prepared.requestedModel} (set via ANTHROPIC_MODEL env at startup).`
: prepared.acpxAgent === "codex"
? `Requested ACPX model: ${prepared.requestedModel} (set via CODEX_CONFIG at startup).`
: prepared.acpxAgent === "gemini"
? `Requested ACPX model: ${prepared.requestedModel} (set via GEMINI_MODEL at startup).`
: `Requested ACPX model: ${prepared.requestedModel}.`,
]
: []),
@@ -2,9 +2,16 @@ import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { afterEach, expect, it } from "vitest";
import { createRequire } from "node:module";
import { afterEach, describe, expect, it } from "vitest";
import { createAcpRuntime, createAgentRegistry, createRuntimeStore } from "acpx/runtime";
const runnerRuntimePath = createRequire(new URL("../../../paperclip-runner/package.json", import.meta.url)).resolve("acpx/runtime");
const nativeRuntime = await import(runnerRuntimePath) as typeof import("acpx/runtime");
const runtimes = [
{ version: "0.12.0", api: { createAcpRuntime, createAgentRegistry, createRuntimeStore } },
{ version: "0.13.1", api: nativeRuntime },
];
const roots: string[] = [];
const fixture = fileURLToPath(new URL("../../../../scripts/mcp-fixtures/servers/acp-filesystem-agent.mjs", import.meta.url));
afterEach(async () => {
@@ -19,17 +26,17 @@ async function workspace() {
return { root, cwd: await fs.realpath(cwd) };
}
async function drive(input: {
async function drive(api: (typeof runtimes)[number]["api"], input: {
cwd: string;
root: string;
permissionMode?: "approve-all" | "deny-all";
operations: Array<{ method: string; path: string; content?: string }>;
}) {
let stderr = "";
const runtime = createAcpRuntime({
const runtime = api.createAcpRuntime({
cwd: input.cwd,
sessionStore: createRuntimeStore({ stateDir: path.join(input.root, "state") }),
agentRegistry: createAgentRegistry({ overrides: { custom: `${JSON.stringify(process.execPath.replaceAll("\\", "/"))} ${JSON.stringify(fixture.replaceAll("\\", "/"))}` } }),
sessionStore: api.createRuntimeStore({ stateDir: path.join(input.root, "state") }),
agentRegistry: api.createAgentRegistry({ overrides: { custom: `${JSON.stringify(process.execPath.replaceAll("\\", "/"))} ${JSON.stringify(fixture.replaceAll("\\", "/"))}` } }),
permissionMode: input.permissionMode ?? "approve-all",
nonInteractivePermissions: "deny",
inheritProcessEnv: false,
@@ -51,50 +58,53 @@ async function drive(input: {
}
}
it("reports a missing file as an ACP resource error and then creates and reads it", async () => {
const input = await workspace();
const file = path.join(input.cwd, "new.json");
const content = '{"proof":"synthetic"}\n';
const receipts = await drive({ ...input, operations: [
{ method: "fs/read_text_file", path: file },
{ method: "fs/write_text_file", path: file, content },
{ method: "fs/read_text_file", path: file },
] });
expect(receipts).toHaveLength(3);
expect(receipts[0].error).toMatchObject({ code: -32002, message: expect.stringContaining("Resource not found") });
expect(receipts[1].error).toBeUndefined();
expect(receipts[2].result.content).toBe(content);
expect(await fs.readFile(file, "utf8")).toBe(content);
});
describe.each(runtimes)("ACPX $version filesystem protocol", ({ api }) => {
it("reports a missing file as an ACP resource error and then creates and reads it", async () => {
const input = await workspace();
const file = path.join(input.cwd, "new.json");
const content = '{"proof":"synthetic"}\n';
const receipts = await drive(api, { ...input, operations: [
{ method: "fs/read_text_file", path: file },
{ method: "fs/write_text_file", path: file, content },
{ method: "fs/read_text_file", path: file },
] });
expect(receipts).toHaveLength(3);
expect(receipts[0].error).toMatchObject({ code: -32002, message: expect.stringContaining("Resource not found") });
expect(receipts[1].error).toBeUndefined();
expect(receipts[2].result.content).toBe(content);
expect(await fs.readFile(file, "utf8")).toBe(content);
});
it("keeps unrelated paths denied for both reads and writes", async () => {
const input = await workspace();
const outside = path.join(await fs.realpath(input.root), "outside.json");
await fs.writeFile(outside, "unchanged");
const receipts = await drive({ ...input, operations: [
{ method: "fs/read_text_file", path: outside },
{ method: "fs/write_text_file", path: outside, content: "changed" },
] });
expect(receipts).toHaveLength(2);
expect(receipts.every((receipt) => receipt.error && receipt.error.code !== -32002)).toBe(true);
expect(await fs.readFile(outside, "utf8")).toBe("unchanged");
});
it("keeps unrelated paths denied for both reads and writes", async () => {
const input = await workspace();
const outside = path.join(await fs.realpath(input.root), "outside.json");
await fs.writeFile(outside, "unchanged");
const receipts = await drive(api, { ...input, operations: [
{ method: "fs/read_text_file", path: outside },
{ method: "fs/write_text_file", path: outside, content: "changed" },
] });
expect(receipts).toHaveLength(2);
expect(receipts.every((receipt) => receipt.error && receipt.error.code !== -32002)).toBe(true);
expect(await fs.readFile(outside, "utf8")).toBe("unchanged");
});
it("preserves deny-all permissions instead of converting denials into missing files", async () => {
const input = await workspace();
const file = path.join(input.cwd, "denied.json");
const receipts = await drive({ ...input, permissionMode: "deny-all", operations: [
{ method: "fs/read_text_file", path: file },
{ method: "fs/write_text_file", path: file, content: "denied" },
] });
expect(receipts).toHaveLength(2);
expect(receipts.every((receipt) => receipt.error && receipt.error.code !== -32002)).toBe(true);
await expect(fs.stat(file)).rejects.toMatchObject({ code: "ENOENT" });
});
it("preserves deny-all permissions instead of converting denials into missing files", async () => {
const input = await workspace();
const file = path.join(input.cwd, "denied.json");
const receipts = await drive(api, { ...input, permissionMode: "deny-all", operations: [
{ method: "fs/read_text_file", path: file },
{ method: "fs/write_text_file", path: file, content: "denied" },
] });
expect(receipts).toHaveLength(2);
expect(receipts.every((receipt) => receipt.error && receipt.error.code !== -32002)).toBe(true);
await expect(fs.stat(file)).rejects.toMatchObject({ code: "ENOENT" });
});
it.skipIf(process.platform === "win32")("keeps other filesystem failures distinct from missing files", async () => {
const input = await workspace();
const receipts = await drive(api, { ...input, operations: [{ method: "fs/read_text_file", path: input.cwd }] });
expect(receipts).toHaveLength(1);
expect(receipts[0].error.code).not.toBe(-32002);
});
it.skipIf(process.platform === "win32")("keeps other filesystem failures distinct from missing files", async () => {
const input = await workspace();
const receipts = await drive({ ...input, operations: [{ method: "fs/read_text_file", path: input.cwd }] });
expect(receipts).toHaveLength(1);
expect(receipts[0].error.code).not.toBe(-32002);
});
@@ -60,6 +60,10 @@ Operational fields:
- graceSec (number, optional): SIGTERM grace period in seconds
Notes:
- Explicit ACP models are set via \`GEMINI_MODEL\` before startup; this avoids unsupported \`session/set_config_option\` calls while preserving the ACP transport. Auto continues to use the installed CLI's model selection.
- Local turns include the current selected skill root and Paperclip artifact workflow guidance, including after a disposable connection home changes.
- Local ACP workspaces use their canonical directory so Gemini's resolved file paths match the client boundary. Missing files retain ACP resource-not-found semantics. Gemini CLI 0.58.0 still mishandles the plain error object during native new-file creation; the installed-CLI compatibility smoke documents this remaining limitation.
- Gemini shell commands may reject command substitution. Build JSON request bodies in workspace files and pass them with \`curl --data-binary @file\`, or use the selected skill's helpers.
- Gemini ACP is the preferred auto lane when Node >=24.11.0 and the local Gemini CLI command is available. It runs Gemini CLI's native \`gemini --acp\` server through Paperclip's shared ACP engine, including selected skill links, Paperclip runtime prompt/env guidance, model config, and persistent ACP session state. Missing prerequisites fail both default and explicit ACP runs with an actionable setup error; the adapter never switches engines automatically.
- Runs use --prompt for non-interactive execution, not stdin.
- The adapter sets a headless-safe terminal/browser environment for Gemini CLI child processes so unattended runs do not wait on browser auth or 256-color terminal prompts.
@@ -53,4 +53,5 @@ Notes:
- Use \`grok models\` to inspect authentication and available models on the host.
- Local subscription runs use the host \`grok login\` (\`~/.grok\`) until the company Grok home has a usable \`auth.json\` (sandbox device login). \`XAI_API_KEY\` authenticates without a home. Remote/sandbox runs never fall back to the host login.
- Without a usable company login, local runs preserve an inherited or configured \`GROK_HOME\`. Managed AI connections keep their selected home. An explicit empty \`XAI_API_KEY\` clears an inherited key and selects subscription authentication.
- Managed local connections retain private session transcripts separately from disposable credentials, scoped to company, agent and connection identity. Missing local history starts a fresh task handoff without attempting remote subscription recovery.
`;
@@ -163,6 +163,18 @@ async function makeCtx(runId: string, cwd: string): Promise<AdapterExecutionCont
}
describe("grok_local execute", () => {
it.each([false, true])("resumes a managed connection only when its isolated history exists (%s)", async present => {
const root = await makeTempRoot();
const ctx = await makeCtx("managed-resume", root);
ctx.config.managedAiConnection = true;
ctx.config.env = { GROK_HOME: path.join(root, "home"), XAI_API_KEY: "fixture-key" };
ctx.runtime.sessionParams = { sessionId: "fixture-session", cwd: root };
if (present) await fs.mkdir(path.join(root, "home", "sessions", "encoded-cwd", "fixture-session"), { recursive: true });
runProcessMock.mockResolvedValue(makeSuccessfulRunResult({ sessionId: "next-session" }));
const result = await execute(ctx);
expect((runProcessMock.mock.calls[0][3] as string[]).includes("--resume")).toBe(present);
expect(result.sessionParams?.sessionId).toBe("next-session");
});
it("resumes the conversation while rotating runtime tool access", async () => {
const root = await makeTempRoot();
runProcessMock.mockResolvedValue(makeSuccessfulRunResult({ sessionId: "existing-session" }));
@@ -180,6 +192,19 @@ describe("grok_local execute", () => {
expect(result.sessionParams?.sessionId).toBe("existing-session");
});
it("clears an unavailable managed session when the fresh turn provides no replacement ID", async () => {
const root = await makeTempRoot();
const ctx = await makeCtx("missing-history", root);
ctx.config.managedAiConnection = true;
ctx.config.env = { GROK_HOME: path.join(root, "home"), XAI_API_KEY: "fixture-key" };
ctx.runtime.sessionParams = { sessionId: "discarded-session", cwd: root };
runProcessMock.mockResolvedValue({ ...makeSuccessfulRunResult(), stdout: JSON.stringify({ type: "end", stopReason: "EndTurn" }) });
const result = await execute(ctx);
expect((runProcessMock.mock.calls[0][3] as string[]).includes("--resume")).toBe(false);
expect(result.sessionParams).toBeNull();
expect(result.clearSession).toBe(true);
});
it.each(["grok-4.7", "grok-4.6"])("forwards the explicit %s model and xhigh effort", async (model) => {
const root = await makeTempRoot();
const ctx = await makeCtx("model-selection", root);
@@ -47,7 +47,7 @@ import {
} from "@paperclipai/adapter-utils/server-utils";
import { DEFAULT_GROK_LOCAL_MODEL } from "../index.js";
import { copyBackGrokAuth } from "./grok-auth-copyback.js";
import { grokHomeHasUsableAuth, resolveManagedGrokHomeDir, stageGrokHomeForSync } from "./grok-home.js";
import { grokHomeHasSession, grokHomeHasUsableAuth, resolveManagedGrokHomeDir, stageGrokHomeForSync } from "./grok-home.js";
import { isGrokUnknownSessionError, parseGrokJsonl } from "./parse.js";
const __moduleDir = path.dirname(fileURLToPath(import.meta.url));
@@ -501,12 +501,17 @@ async function executeTurn(ctx: AdapterExecutionContext): Promise<AdapterExecuti
const runtimeSessionId = asString(runtimeSessionParams.sessionId, runtime.sessionId ?? "");
const runtimeSessionCwd = asString(runtimeSessionParams.cwd, "");
const runtimeRemoteExecution = parseObject(runtimeSessionParams.remoteExecution);
const missingManagedSession = !executionTargetIsRemote && Boolean(config.managedAiConnection) &&
Boolean(runtimeSessionId) && !await grokHomeHasSession(asString(env.GROK_HOME, ""), runtimeSessionId);
const canResumeSession =
runtimeSessionId.length > 0 &&
!missingManagedSession &&
(runtimeSessionCwd.length === 0 || path.resolve(runtimeSessionCwd) === path.resolve(effectiveExecutionCwd)) &&
adapterExecutionTargetSessionMatches(runtimeRemoteExecution, runtimeExecutionTarget);
const sessionId = canResumeSession ? runtimeSessionId : null;
if (executionTargetIsRemote && runtimeSessionId && !canResumeSession) {
if (missingManagedSession) {
await onLog("stdout", "[paperclip] Selected Grok session history is unavailable. Starting a fresh session with the task handoff instead of remote subscription recovery.\n");
} else if (executionTargetIsRemote && runtimeSessionId && !canResumeSession) {
await onLog(
"stdout",
`[paperclip] Grok session "${runtimeSessionId}" does not match the current remote execution identity and will not be resumed in "${effectiveExecutionCwd}". Starting a fresh remote session.\n`,
@@ -653,7 +658,7 @@ async function executeTurn(ctx: AdapterExecutionContext): Promise<AdapterExecuti
stderrLine ||
`Grok exited with code ${attempt.proc.exitCode ?? -1}`;
const canFallbackToRuntimeSession = !isRetry;
const canFallbackToRuntimeSession = !isRetry && !missingManagedSession;
const resolvedSessionId = attempt.parsed.sessionId
?? (canFallbackToRuntimeSession ? (runtimeSessionId ?? runtime.sessionId ?? null) : null);
const resolvedSessionParams = resolvedSessionId
@@ -722,7 +727,7 @@ async function executeTurn(ctx: AdapterExecutionContext): Promise<AdapterExecuti
return toResult(retry, true, true);
}
return toResult(initial);
return toResult(initial, missingManagedSession);
};
try {
+19 -10
View File
@@ -1,8 +1,7 @@
diff --git a/dist/live-checkpoint-ClPCSdrW.js b/dist/live-checkpoint-ClPCSdrW.js
index 243c9d13bcba520923b63adfddad75cf2d94362d..e2a254d4e57fb2e246ccb742f2e9de5a8a461d20 100644
--- a/dist/live-checkpoint-ClPCSdrW.js
+++ b/dist/live-checkpoint-ClPCSdrW.js
@@ -1532,7 +1532,7 @@ const ZED_TAG_KEYS = /* @__PURE__ */ new Set([
@@ -1532,7 +1532,7 @@
"RedactedThinking",
"ToolUse"
]);
@@ -11,7 +10,7 @@ index 243c9d13bcba520923b63adfddad75cf2d94362d..e2a254d4e57fb2e246ccb742f2e9de5a
const OPAQUE_VALUE_PATHS = /* @__PURE__ */ new Set([
"agent_capabilities",
"messages.Agent.content.ToolUse.input",
@@ -2557,7 +2557,7 @@ function readCommandLineChar(state) {
@@ -2557,7 +2557,7 @@
escaping: false,
hasPart: true
};
@@ -20,7 +19,7 @@ index 243c9d13bcba520923b63adfddad75cf2d94362d..e2a254d4e57fb2e246ccb742f2e9de5a
current: state.current,
quote: state.quote,
escaping: true,
@@ -2912,8 +2912,8 @@ function promotePrefixedAuthEnvironment(env) {
@@ -2912,8 +2912,8 @@
}
return protectedKeys;
}
@@ -31,7 +30,7 @@ index 243c9d13bcba520923b63adfddad75cf2d94362d..e2a254d4e57fb2e246ccb742f2e9de5a
const protectedAuthEnvKeys = promotePrefixedAuthEnvironment(env);
if (authCredentials) for (const [methodId, credential] of Object.entries(authCredentials)) {
addAuthCredentialEnvKeys(protectedAuthEnvKeys, methodId, credential);
@@ -2955,10 +2955,10 @@ function resolveConfiguredAuthCredential(methodId, authCredentials) {
@@ -2955,10 +2955,10 @@
const configCredentials = authCredentials ?? {};
return configCredentials[methodId] ?? configCredentials[toEnvToken(methodId)];
}
@@ -44,7 +43,7 @@ index 243c9d13bcba520923b63adfddad75cf2d94362d..e2a254d4e57fb2e246ccb742f2e9de5a
stdio: [
"pipe",
"pipe",
@@ -3724,10 +3724,13 @@ function resolveClientCapabilities(params) {
@@ -3724,10 +3724,13 @@
},
terminal: params.terminal
};
@@ -60,7 +59,7 @@ index 243c9d13bcba520923b63adfddad75cf2d94362d..e2a254d4e57fb2e246ccb742f2e9de5a
};
}
function isDevinRequestDiagnosticsMethod(method) {
@@ -3957,9 +3960,26 @@ var AcpClient = class {
@@ -3957,9 +3960,26 @@
this.lastAgentExit = void 0;
this.lastKnownPid = child.pid ?? void 0;
this.attachAgentLifecycleObservers(child);
@@ -87,7 +86,7 @@ index 243c9d13bcba520923b63adfddad75cf2d94362d..e2a254d4e57fb2e246ccb742f2e9de5a
if (!this.options.verbose) return;
process.stderr.write(chunk);
});
@@ -3994,7 +4014,7 @@ var AcpClient = class {
@@ -3994,7 +4014,7 @@
geminiAcp: isGeminiAcpCommand(spawnCommand, args),
copilotAcp: isCopilotAcpCommand(spawnCommand, args),
claudeAcp: isClaudeAcpCommand(spawnCommand, args),
@@ -96,7 +95,17 @@ index 243c9d13bcba520923b63adfddad75cf2d94362d..e2a254d4e57fb2e246ccb742f2e9de5a
};
}
logAgentLaunch(plan) {
@@ -6070,6 +6090,27 @@ async function withConnectedSession(options) {
@@ -4729,6 +4749,9 @@
return await this.filesystem.readTextFile(params);
} catch (error) {
this.recordPermissionError(params.sessionId, error);
+ // Keep ENOENT distinct from permission and other filesystem failures.
+ // The ACP peer must receive a resource error before it creates a file.
+ if (error && typeof error === "object" && error.code === "ENOENT") throw RequestError.resourceNotFound(params.path);
throw error;
}
}
@@ -6070,6 +6093,27 @@
//#region src/runtime/engine/prompt-turn.ts
const SESSION_REPLY_IDLE_MS = 1e3;
const SESSION_REPLY_DRAIN_TIMEOUT_MS = 5e3;
@@ -124,7 +133,7 @@ index 243c9d13bcba520923b63adfddad75cf2d94362d..e2a254d4e57fb2e246ccb742f2e9de5a
async function runPromptTurn(params) {
try {
const promptPromise = params.client.prompt(params.sessionId, params.prompt);
@@ -6079,6 +6120,20 @@ async function runPromptTurn(params) {
@@ -6079,6 +6123,20 @@
idleMs: SESSION_REPLY_IDLE_MS,
timeoutMs: SESSION_REPLY_DRAIN_TIMEOUT_MS
}).catch(() => {});
+52 -34
View File
@@ -11,10 +11,18 @@ index 5e2113ac0a1a92c99322cf01e5c106760a0b0dbf..b7b5151f3da45b5e0d12aea55e9f3b07
private setSessionModelThroughConfig;
private setSessionModelThroughLegacyMethod;
diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js
index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d2e777e9e 100644
--- a/dist/live-checkpoint-BSIrfgVo.js
+++ b/dist/live-checkpoint-BSIrfgVo.js
@@ -1068,6 +1068,7 @@ function serializeSessionRecordForDisk(record) {
@@ -6,7 +6,7 @@
import { randomUUID } from "node:crypto";
import { execFile, spawn } from "node:child_process";
import { Readable, Writable } from "node:stream";
-import { PROTOCOL_VERSION, client, methods } from "@agentclientprotocol/sdk";
+import { PROTOCOL_VERSION, RequestError, client, methods } from "@agentclientprotocol/sdk";
import readline from "node:readline/promises";
//#region src/errors.ts
var AcpxOperationalError = class extends Error {
@@ -1068,6 +1068,7 @@
last_agent_disconnect_reason: canonical.lastAgentDisconnectReason,
protocol_version: canonical.protocolVersion,
agent_capabilities: canonical.agentCapabilities,
@@ -22,7 +30,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
title: canonical.title,
messages: canonical.messages,
updated_at: canonical.updated_at,
@@ -1239,7 +1240,8 @@ function parseRequestTokenUsage(raw) {
@@ -1239,7 +1240,8 @@
for (const [key, value] of Object.entries(record)) {
const parsed = parseTokenUsage(value);
if (parsed == null) return null;
@@ -32,7 +40,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
}
return usage;
}
@@ -1541,6 +1543,7 @@ function parseSessionRecord(raw) {
@@ -1541,6 +1543,7 @@
lastAgentDisconnectReason: optionals.lastAgentDisconnectReason,
protocolVersion: typeof record.protocol_version === "number" ? record.protocol_version : void 0,
agentCapabilities: asRecord$4(record.agent_capabilities),
@@ -40,7 +48,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
title: conversation.title,
messages: conversation.messages,
updated_at: conversation.updated_at,
@@ -1661,7 +1664,7 @@ const ZED_TAG_KEYS = /* @__PURE__ */ new Set([
@@ -1661,7 +1664,7 @@
"RedactedThinking",
"ToolUse"
]);
@@ -49,7 +57,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
const OPAQUE_VALUE_PATHS = /* @__PURE__ */ new Set([
"agent_capabilities",
"messages.Agent.content.ToolUse.input",
@@ -3104,10 +3107,10 @@ function authEnvKey(methodId) {
@@ -3104,10 +3107,10 @@
authEnvKeyCache.set(methodId, key);
return key;
}
@@ -62,7 +70,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
if (typeof value === "string" && value.trim().length > 0) return value;
}
function protectedEnvKey(key) {
@@ -3135,8 +3138,21 @@ function promotePrefixedAuthEnvironment(env) {
@@ -3135,8 +3138,21 @@
}
return protectedKeys;
}
@@ -86,7 +94,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
const protectedAuthEnvKeys = promotePrefixedAuthEnvironment(env);
if (authCredentials) for (const [methodId, credential] of Object.entries(authCredentials)) {
addAuthCredentialEnvKeys(protectedAuthEnvKeys, methodId, credential);
@@ -3178,10 +3194,10 @@ function resolveConfiguredAuthCredential(methodId, authCredentials) {
@@ -3178,10 +3194,10 @@
const configCredentials = authCredentials ?? {};
return configCredentials[methodId] ?? configCredentials[toEnvToken(methodId)];
}
@@ -99,7 +107,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
stdio: [
"pipe",
"pipe",
@@ -3961,10 +3977,13 @@ function resolveClientCapabilities(params) {
@@ -3961,10 +3977,13 @@
...params.elicitationModes.includes("url") ? { url: {} } : {}
} } : {}
};
@@ -115,7 +123,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
};
}
function hasResponseField(response, field) {
@@ -4067,6 +4086,27 @@ function createNdJsonMessageStream(agentCommand, output, input) {
@@ -4067,6 +4086,27 @@
} })
};
}
@@ -143,7 +151,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
var AcpClient = class {
options;
connection;
@@ -4105,7 +4145,9 @@ var AcpClient = class {
@@ -4105,7 +4145,9 @@
cwd: asAbsoluteCwd(options.cwd),
authPolicy: options.authPolicy ?? "skip",
permissionPolicy: snapshotPermissionPolicy(options.permissionPolicy),
@@ -154,7 +162,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
};
this.eventHandlers = {
onAcpMessage: this.options.onAcpMessage,
@@ -4216,9 +4258,21 @@ var AcpClient = class {
@@ -4216,9 +4258,21 @@
this.lastAgentExit = void 0;
this.lastKnownPid = child.pid ?? void 0;
this.attachAgentLifecycleObservers(child);
@@ -176,7 +184,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
if (!this.options.verbose) return;
process.stderr.write(chunk);
});
@@ -4226,6 +4280,7 @@ var AcpClient = class {
@@ -4226,6 +4280,7 @@
const output = Readable.toWeb(child.stdout);
const stream = this.createTappedStream(createNdJsonMessageStream(this.options.agentCommand, input, output));
const connection = this.createConnection(stream, launch);
@@ -184,7 +192,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
connection.signal.addEventListener("abort", () => {
this.recordAgentExit("connection_close", child.exitCode ?? null, child.signalCode ?? null);
}, { once: true });
@@ -4253,7 +4308,12 @@ var AcpClient = class {
@@ -4253,7 +4308,12 @@
geminiAcp: isGeminiAcpCommand(spawnCommand, args),
copilotAcp: isCopilotAcpCommand(spawnCommand, args),
claudeAcp: isClaudeAcpCommand(spawnCommand, args),
@@ -198,7 +206,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
};
}
logAgentLaunch(plan) {
@@ -4279,10 +4339,17 @@ var AcpClient = class {
@@ -4279,10 +4339,17 @@
}
async spawnAgentProcess(plan) {
const spawnCommand = buildAgentSpawnCommand(plan.spawnCommand, plan.args, process.platform, plan.spawnOptions.env);
@@ -218,7 +226,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
try {
await waitForSpawn$1(spawnedChild);
} catch (error) {
@@ -4293,10 +4360,10 @@ var AcpClient = class {
@@ -4293,10 +4360,10 @@
createConnection(stream, launch) {
const app = client({ name: "acpx" }).onNotification(methods.client.session.update, async ({ params }) => {
await this.handleSessionUpdate(params);
@@ -232,7 +240,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
}).onRequest(methods.client.fs.readTextFile, async ({ params }) => {
return await this.handleReadTextFile(params);
}).onRequest(methods.client.fs.writeTextFile, async ({ params }) => {
@@ -4312,6 +4379,11 @@ var AcpClient = class {
@@ -4312,6 +4379,11 @@
}).onRequest(methods.client.terminal.release, async ({ params }) => {
return await this.handleReleaseTerminal(params);
});
@@ -244,7 +252,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
if (launch.devinAcp) app.onRequest("_cognition.ai/request_diagnostics", (params) => {
return params && typeof params === "object" && !Array.isArray(params) ? params : {};
}, async () => ({}));
@@ -4333,12 +4405,12 @@ var AcpClient = class {
@@ -4333,12 +4405,12 @@
async initializeProtocolConnection(connection, launch) {
const initializePromise = connection.initialize({
protocolVersion: PROTOCOL_VERSION,
@@ -259,7 +267,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
clientInfo: resolveClientInfo(launch.devinAcp)
});
const initialized = launch.geminiAcp ? await withTimeout(initializePromise, resolveGeminiAcpStartupTimeoutMs()) : await initializePromise;
@@ -4358,6 +4430,36 @@ var AcpClient = class {
@@ -4358,6 +4430,36 @@
throw normalizedError;
}
createTappedStream(base) {
@@ -296,7 +304,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
const onAcpMessage = () => this.eventHandlers.onAcpMessage;
const onAcpOutputMessage = () => this.eventHandlers.onAcpOutputMessage;
const elicitationRequestIds = /* @__PURE__ */ new Set();
@@ -4367,8 +4469,9 @@ var AcpClient = class {
@@ -4367,8 +4469,9 @@
const shouldSuppressInboundReplaySessionUpdate = (message) => {
return this.suppressReplaySessionUpdateMessages && isSessionUpdateNotification(message);
};
@@ -307,7 +315,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
if (requestId !== void 0) {
elicitationRequestIds.add(requestId);
return;
@@ -4379,6 +4482,7 @@ var AcpClient = class {
@@ -4379,6 +4482,7 @@
}
};
return {
@@ -315,7 +323,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
readable: new ReadableStream({ async start(controller) {
const reader = base.readable.getReader();
try {
@@ -4387,10 +4491,16 @@ var AcpClient = class {
@@ -4387,10 +4491,16 @@
if (done) break;
if (!value) continue;
observeInbound(value);
@@ -333,7 +341,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
reader.releaseLock();
controller.close();
}
@@ -4403,10 +4513,20 @@ var AcpClient = class {
@@ -4403,10 +4513,20 @@
onAcpOutputMessage()?.("outbound", message);
onAcpMessage()?.("outbound", message);
}
@@ -354,7 +362,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
writer.releaseLock();
}
} })
@@ -4422,7 +4542,10 @@ var AcpClient = class {
@@ -4422,7 +4542,10 @@
const createPromise = this.runConnectionRequest(() => connection.newSession({
cwd: sessionCwd,
mcpServers: this.options.mcpServers ?? [],
@@ -366,7 +374,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
}));
result = claudeAcp ? await withTimeout(createPromise, resolveClaudeAcpSessionCreateTimeoutMs()) : await createPromise;
} catch (error) {
@@ -4864,7 +4987,7 @@ var AcpClient = class {
@@ -4864,7 +4987,7 @@
}
selectAuthMethod(methods) {
for (const method of methods) {
@@ -375,7 +383,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
if (envCredential) return {
methodId: method.id,
credential: envCredential,
@@ -4890,7 +5013,7 @@ var AcpClient = class {
@@ -4890,7 +5013,7 @@
}
readAgentSpecificEnvCredential(methodId) {
if (!this.isGrokBuildAcpCommand() || methodId !== "xai.api_key") return;
@@ -384,7 +392,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
}
selectAgentManagedAuthMethod(methodId) {
@@ -4915,9 +5038,9 @@ var AcpClient = class {
@@ -4915,9 +5038,9 @@
await connection.authenticate({ methodId: selected.methodId });
this.log(`authenticated with method ${selected.methodId} (${selected.source})`);
}
@@ -396,7 +404,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
if (hostResponse) return hostResponse;
const { response, recorded } = await this.resolvePermissionRequestFromMode(params);
if (!recorded) {
@@ -4926,14 +5049,49 @@ var AcpClient = class {
@@ -4926,14 +5049,49 @@
}
return response;
}
@@ -448,7 +456,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
})).then((response) => ({
kind: "response",
response
@@ -4970,7 +5128,7 @@ var AcpClient = class {
@@ -4970,7 +5128,7 @@
isElicitationSessionCancelling(sessionId) {
return this.closing || this.cancellingSessionIds.has(sessionId);
}
@@ -457,7 +465,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
if (!this.options.onPermissionRequest) return;
const signal = this.cancellationSignalForSession(params.sessionId);
try {
@@ -4978,7 +5136,7 @@ var AcpClient = class {
@@ -4978,7 +5136,7 @@
sessionId: params.sessionId,
raw: params,
inferredKind: inferToolKind(params)
@@ -466,7 +474,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
return this.hostPermissionDecisionResponse(params, signal, decision);
} catch (error) {
return this.hostPermissionErrorResponse(params, signal, error);
@@ -5028,6 +5186,12 @@ var AcpClient = class {
@@ -5028,6 +5186,12 @@
attachAgentLifecycleObservers(child) {
child.once("exit", (exitCode, signal) => {
this.recordAgentExit("process_exit", exitCode, signal);
@@ -479,7 +487,17 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
});
child.once("close", (exitCode, signal) => {
this.recordAgentExit("process_close", exitCode, signal);
@@ -5771,10 +5935,20 @@ function recordSessionUpdate(conversation, state, notification, timestamp = isoN
@@ -5100,6 +5264,9 @@
return await this.filesystem.readTextFile(params);
} catch (error) {
this.recordPermissionError(params.sessionId, error);
+ // Keep ENOENT distinct from permission and other filesystem failures.
+ // The ACP peer must receive a resource error before it creates a file.
+ if (error && typeof error === "object" && error.code === "ENOENT") throw RequestError.resourceNotFound(params.path);
throw error;
}
}
@@ -5771,10 +5938,20 @@
trimConversationForRuntime(conversation);
return acpx;
}
@@ -502,7 +520,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
updateConversationTimestamp(conversation, timestamp);
trimConversationForRuntime(conversation);
return true;
@@ -6435,6 +6609,27 @@ async function withConnectedSession(options) {
@@ -6435,6 +6612,27 @@
//#region src/runtime/engine/prompt-turn.ts
const SESSION_REPLY_IDLE_MS = 1e3;
const SESSION_REPLY_DRAIN_TIMEOUT_MS = 5e3;
@@ -530,7 +548,7 @@ index d454fd7c5bf742b469be75eb8c3988b694a0ffaa..e3a4989473bba20e6dcdccbac086bb6d
async function runPromptTurn(params) {
try {
const promptPromise = params.client.prompt(params.sessionId, params.prompt, params.onPromptRequestStarted, params.onElicitation);
@@ -6444,7 +6639,22 @@ async function runPromptTurn(params) {
@@ -6444,7 +6642,22 @@
idleMs: SESSION_REPLY_IDLE_MS,
timeoutMs: SESSION_REPLY_DRAIN_TIMEOUT_MS
}).catch(() => {});
@@ -99,9 +99,9 @@ describe(`durable file delivery (${liveDaytona ? "Daytona" : "local processes"})
enableSandboxDuplexBridge: duplex,
});
expect(bridge?.env.PAPERCLIP_API_BRIDGE_MODE).toBe(duplex ? "http2_v1" : "queue_v1");
const env = { ...bridge!.env, PAPERCLIP_RUN_ID: fixture.runId,
const env = { ...bridge!.env, TMPDIR: path.join(remote.workspace, ".unavailable-controller-temp"), PAPERCLIP_RUN_ID: fixture.runId,
PAPERCLIP_COMPANY_ID: fixture.companyId, PAPERCLIP_TASK_ID: fixture.issueId,
PAPERCLIP_HELPER_STATE_DIR: path.join(remote.workspace, ".helper-state") };
PAPERCLIP_WORKSPACE_CWD: remote.workspace };
const headers = { authorization: `Bearer ${bridge!.env.PAPERCLIP_API_KEY}` };
const receipts: Array<{ attachment: { id: string; contentPath: string; downloadPath: string } }> = [];
try {