{"draft":null,"from":94,"to":95,"files":[{"path":"client/src/join-commands.ts","added":9,"removed":3,"diff":"--- a/client/src/join-commands.ts\n+++ b/client/src/join-commands.ts\n@@ -36,8 +36,8 @@\n \n const NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;\n \n-function agentFrom(args: Parsed): string {\n-\tconst agent = str(args, \"agent\");\n+function agentFrom(args: Parsed, named?: string): string {\n+\tconst agent = named ?? str(args, \"agent\");\n \tif (!agent) throw new UsageError(\"give this folder's agent name with --agent <name>\");\n \tif (!NAME.test(agent))\n \t\tthrow new UsageError(`agent names are letters, digits, dot, dash and underscore (got ${JSON.stringify(agent)})`);\n@@ -193,7 +193,13 @@\n \tlet minted: { key: string; id: string } | undefined;\n \tif (str(args, \"agent\") !== undefined) {\n \t\tagent = agentFrom(args);\n-\t\tminted = box && !hasKey ? await mintKey(box, project, agent) : undefined;\n+\t\tminted = box && !hasKey && !fromEnv(env.env, \"KEY_FILE\") ? await mintKey(box, project, agent) : undefined;\n+\t} else if (fromEnv(env.env, \"KEY_FILE\")) {\n+\t\t// A pipeline run's key (ABSO_KEY_FILE) belongs to one agent, which the runner names in ABSO_AGENT.\n+\t\tconst named = fromEnv(env.env, \"AGENT\");\n+\t\tif (!named)\n+\t\t\tthrow new UsageError(\"a pipeline run's key joins as its own agent: give it with --agent <name> or ABSO_AGENT\");\n+\t\tagent = agentFrom(args, named);\n \t} else {\n \t\t// No --agent: the box's name, or the next free -2, -3. Not signed in, --reader reads a public project signed out.\n \t\tif (!box && reader && !hasKey && (await isPublic(server, project)))"}],"unmatched":[]}