mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-29 15:52:36 +01:00
Merge master into SSH agent account support
Keep the SSH base branch current so the dependent Tailscale migration can be regenerated after the newly landed upstream migration. Preserve the managed SSH account selection and remote session cleanup changes. Verified the focused SSH, routing, and account probe tests, server typecheck, and adapter-utils, Codex, and Claude package typechecks. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
commit
d59f9bbcee
191 files changed
+15683
-4374
No files matched your search
@@ -1571,6 +1571,7 @@ describe("sandbox callback bridge", () => {
|
||||
{ method: "GET", path: "/api/companies/co-1/approvals" },
|
||||
{ method: "GET", path: "/api/companies/co-1/routines" },
|
||||
{ method: "GET", path: "/api/companies/co-1/skills" },
|
||||
{ method: "GET", path: "/api/agents/me/mcp-skills/skill-1/files" },
|
||||
{ method: "GET", path: "/api/companies/co-1/email/inboxes" },
|
||||
{ method: "GET", path: "/api/companies/co-1/email/tasks/issue-1" },
|
||||
{ method: "GET", path: "/api/companies/co-1/email/deliveries/send-1" },
|
||||
|
||||
@@ -153,6 +153,9 @@ export const DEFAULT_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST: readonly SandboxCa
|
||||
{ method: "GET", path: /^\/api\/companies\/[^/]+\/skills$/ },
|
||||
{ method: "GET", path: /^\/api\/companies\/[^/]+\/skills\/[^/]+$/ },
|
||||
{ method: "GET", path: /^\/api\/companies\/[^/]+\/skills\/[^/]+\/files$/ },
|
||||
// Supporting files of approved skills from connected apps (MCP Skills). The
|
||||
// controller checks the run, the app grant and the approved file manifest.
|
||||
{ method: "GET", path: /^\/api\/agents\/me\/mcp-skills\/[^/]+\/files$/ },
|
||||
{ method: "GET", path: /^\/api\/projects\/[^/]+$/ },
|
||||
{ method: "GET", path: /^\/api\/goals\/[^/]+$/ },
|
||||
|
||||
|
||||
@@ -789,6 +789,49 @@ describe("runChildProcess", () => {
|
||||
expect(finishedAt - startedAt).toBeGreaterThanOrEqual(spawnDelayMs);
|
||||
});
|
||||
|
||||
it("strips systemd service-manager vars (NOTIFY_SOCKET/LISTEN_FDS/LISTEN_PID/LISTEN_FDNAMES) from both inherited and caller-supplied env", async () => {
|
||||
const SERVICE_MANAGER_VARS = ["NOTIFY_SOCKET", "LISTEN_FDS", "LISTEN_PID", "LISTEN_FDNAMES"] as const;
|
||||
const originalValues: Record<string, string | undefined> = {};
|
||||
for (const key of SERVICE_MANAGER_VARS) {
|
||||
originalValues[key] = process.env[key];
|
||||
process.env[key] = `inherited-${key}`;
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await runChildProcess(
|
||||
randomUUID(),
|
||||
process.execPath,
|
||||
["-e", "process.stdout.write(JSON.stringify(process.env))"],
|
||||
{
|
||||
cwd: process.cwd(),
|
||||
env: {
|
||||
NOTIFY_SOCKET: "/run/caller-supplied.sock",
|
||||
LISTEN_FDS: "1",
|
||||
LISTEN_PID: "12345",
|
||||
LISTEN_FDNAMES: "caller",
|
||||
},
|
||||
timeoutSec: 5,
|
||||
graceSec: 1,
|
||||
onLog: async () => {},
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.exitCode).toBe(0);
|
||||
const childEnv = JSON.parse(result.stdout) as Record<string, string | undefined>;
|
||||
for (const key of SERVICE_MANAGER_VARS) {
|
||||
expect(childEnv[key]).toBeUndefined();
|
||||
}
|
||||
} finally {
|
||||
for (const key of SERVICE_MANAGER_VARS) {
|
||||
if (originalValues[key] === undefined) {
|
||||
delete process.env[key];
|
||||
} else {
|
||||
process.env[key] = originalValues[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"kills descendant processes on timeout via the process group",
|
||||
async () => {
|
||||
|
||||
@@ -4831,6 +4831,22 @@ export async function runChildProcess(
|
||||
delete rawMerged[key];
|
||||
}
|
||||
|
||||
// Strip systemd service-manager vars so the spawned agent process can't
|
||||
// reach the Paperclip server's own readiness/socket-activation channel.
|
||||
// NOTIFY_SOCKET in particular lets any process with it in its env call
|
||||
// sd_notify on the server's readiness socket; systemd only accepts
|
||||
// notifications from the service's registered main PID, so an agent
|
||||
// subprocess inheriting it just spams "reception only permitted for
|
||||
// main PID" warnings, but it's still an unintended channel and must not
|
||||
// be handed to child processes. These vars can arrive either via
|
||||
// process.env (systemd sets them on the server process) or via
|
||||
// opts.env (adapters that build their env as `{ ...process.env, ... }`),
|
||||
// so strip them after the merge, not just from the process.env side.
|
||||
const SERVICE_MANAGER_VARS = ["NOTIFY_SOCKET", "LISTEN_FDS", "LISTEN_PID", "LISTEN_FDNAMES"] as const;
|
||||
for (const key of SERVICE_MANAGER_VARS) {
|
||||
delete rawMerged[key];
|
||||
}
|
||||
|
||||
const mergedEnv = ensurePathInEnv(rawMerged);
|
||||
if (opts.localProcessSandbox?.homeDir) {
|
||||
mergedEnv.HOME = opts.localProcessSandbox.homeDir;
|
||||
|
||||
Reference in new issue
Block a user