support merging from codex, fix docker (#234)
This commit is contained in:
committed by
pullfrog[bot]
parent
6deeea7032
commit
eab198748a
+7
-2
@@ -43,17 +43,23 @@ function writeCodexConfig(ctx: AgentRunContext): string {
|
|||||||
}
|
}
|
||||||
const featuresSection = features.length > 0 ? `[features]\n${features.join("\n")}` : "";
|
const featuresSection = features.length > 0 ? `[features]\n${features.join("\n")}` : "";
|
||||||
|
|
||||||
|
// trust the project so codex loads repo-level .codex/config.toml
|
||||||
|
const cwd = process.cwd();
|
||||||
|
const projectTrustSection = `[projects."${cwd}"]\ntrust_level = "trusted"`;
|
||||||
|
|
||||||
writeFileSync(
|
writeFileSync(
|
||||||
configPath,
|
configPath,
|
||||||
`# written by pullfrog
|
`# written by pullfrog
|
||||||
${featuresSection}
|
${featuresSection}
|
||||||
|
|
||||||
|
${projectTrustSection}
|
||||||
|
|
||||||
${mcpServerSections.join("\n\n")}
|
${mcpServerSections.join("\n\n")}
|
||||||
`.trim() + "\n"
|
`.trim() + "\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
log.info(
|
log.info(
|
||||||
`» Codex config written to ${configPath} (shell: ${bash === "enabled" ? "enabled" : "disabled"})`
|
`» Codex config written to ${configPath} (shell: ${bash === "enabled" ? "enabled" : "disabled"}, project trusted: ${cwd})`
|
||||||
);
|
);
|
||||||
|
|
||||||
return codexDir;
|
return codexDir;
|
||||||
@@ -133,7 +139,6 @@ export const codex = agent({
|
|||||||
|
|
||||||
const env: NodeJS.ProcessEnv = {
|
const env: NodeJS.ProcessEnv = {
|
||||||
...process.env,
|
...process.env,
|
||||||
HOME: ctx.tmpdir,
|
|
||||||
CODEX_HOME: codexDir,
|
CODEX_HOME: codexDir,
|
||||||
CODEX_API_KEY: apiKey,
|
CODEX_API_KEY: apiKey,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -144457,16 +144457,21 @@ url = "${ctx.mcpServerUrl}"`];
|
|||||||
}
|
}
|
||||||
const featuresSection = features.length > 0 ? `[features]
|
const featuresSection = features.length > 0 ? `[features]
|
||||||
${features.join("\n")}` : "";
|
${features.join("\n")}` : "";
|
||||||
|
const cwd = process.cwd();
|
||||||
|
const projectTrustSection = `[projects."${cwd}"]
|
||||||
|
trust_level = "trusted"`;
|
||||||
writeFileSync7(
|
writeFileSync7(
|
||||||
configPath,
|
configPath,
|
||||||
`# written by pullfrog
|
`# written by pullfrog
|
||||||
${featuresSection}
|
${featuresSection}
|
||||||
|
|
||||||
|
${projectTrustSection}
|
||||||
|
|
||||||
${mcpServerSections.join("\n\n")}
|
${mcpServerSections.join("\n\n")}
|
||||||
`.trim() + "\n"
|
`.trim() + "\n"
|
||||||
);
|
);
|
||||||
log.info(
|
log.info(
|
||||||
`\xBB Codex config written to ${configPath} (shell: ${bash === "enabled" ? "enabled" : "disabled"})`
|
`\xBB Codex config written to ${configPath} (shell: ${bash === "enabled" ? "enabled" : "disabled"}, project trusted: ${cwd})`
|
||||||
);
|
);
|
||||||
return codexDir;
|
return codexDir;
|
||||||
}
|
}
|
||||||
@@ -144522,7 +144527,6 @@ var codex = agent({
|
|||||||
const commandExecutionIds = /* @__PURE__ */ new Set();
|
const commandExecutionIds = /* @__PURE__ */ new Set();
|
||||||
const env3 = {
|
const env3 = {
|
||||||
...process.env,
|
...process.env,
|
||||||
HOME: ctx.tmpdir,
|
|
||||||
CODEX_HOME: codexDir,
|
CODEX_HOME: codexDir,
|
||||||
CODEX_API_KEY: apiKey
|
CODEX_API_KEY: apiKey
|
||||||
};
|
};
|
||||||
|
|||||||
+14
-60
@@ -2,27 +2,15 @@ import type { AgentResult, TestRunnerOptions, ValidationCheck } from "../utils.t
|
|||||||
import { defineFixture, generateAgentUuids, getStructuredOutput } from "../utils.ts";
|
import { defineFixture, generateAgentUuids, getStructuredOutput } from "../utils.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MCP merge tests - validate MCP server configuration with repo-level MCP configs present.
|
* MCP merge test - validates repo-level MCP servers merge correctly with gh_pullfrog.
|
||||||
*
|
*
|
||||||
* uses GITHUB_REPOSITORY=pullfrog/test-repo-mcp which has robinMCP server.
|
* uses GITHUB_REPOSITORY=pullfrog/test-repo-mcp which has robinMCP server.
|
||||||
*
|
* all agents should auto-discover repo-level MCP configs and merge them with gh_pullfrog.
|
||||||
* two variants:
|
|
||||||
* - mcpmerge-full: validates repo-level MCP servers merge correctly with gh_pullfrog
|
|
||||||
* (claude, cursor, gemini, opencode - agents that auto-discover repo MCPs)
|
|
||||||
* - mcpmerge-pullfrog-only: validates gh_pullfrog remains available when repo has MCP config
|
|
||||||
* (codex - doesn't auto-discover repo MCPs)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// shared env for both tests
|
const testUuids = generateAgentUuids(["PULLFROG_MCP_TEST"]);
|
||||||
const sharedEnv = {
|
|
||||||
GITHUB_REPOSITORY: "pullfrog/test-repo-mcp",
|
|
||||||
};
|
|
||||||
|
|
||||||
// --- mcpmerge-full: test repo-level MCP discovery ---
|
const fixture = defineFixture(
|
||||||
|
|
||||||
const fullTestUuids = generateAgentUuids(["PULLFROG_MCP_TEST"]);
|
|
||||||
|
|
||||||
const fullFixture = defineFixture(
|
|
||||||
{
|
{
|
||||||
prompt: `Call the get_test_value tool from the robinMCP server, then call set_output with the exact value returned.`,
|
prompt: `Call the get_test_value tool from the robinMCP server, then call set_output with the exact value returned.`,
|
||||||
effort: "mini",
|
effort: "mini",
|
||||||
@@ -30,10 +18,10 @@ const fullFixture = defineFixture(
|
|||||||
{ localOnly: true }
|
{ localOnly: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
function fullValidator(result: AgentResult): ValidationCheck[] {
|
function validator(result: AgentResult): ValidationCheck[] {
|
||||||
const output = getStructuredOutput(result);
|
const output = getStructuredOutput(result);
|
||||||
const setOutputCalled = output !== null;
|
const setOutputCalled = output !== null;
|
||||||
const expectedUuid = fullTestUuids.getUuid(result.agent, "PULLFROG_MCP_TEST");
|
const expectedUuid = testUuids.getUuid(result.agent, "PULLFROG_MCP_TEST");
|
||||||
const correctValue = setOutputCalled && output === expectedUuid;
|
const correctValue = setOutputCalled && output === expectedUuid;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -42,46 +30,12 @@ function fullValidator(result: AgentResult): ValidationCheck[] {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- mcpmerge-pullfrog-only: test gh_pullfrog availability only ---
|
export const test: TestRunnerOptions = {
|
||||||
|
name: "mcpmerge",
|
||||||
const baseFixture = defineFixture(
|
fixture,
|
||||||
{
|
validator,
|
||||||
prompt: `Call set_output with "PULLFROG_MCP_WORKS".`,
|
tags: ["mcpmerge"],
|
||||||
effort: "mini",
|
env: { GITHUB_REPOSITORY: "pullfrog/test-repo-mcp" },
|
||||||
},
|
agentEnv: testUuids.agentEnv,
|
||||||
{ localOnly: true }
|
fileAgentEnv: testUuids.agentEnv,
|
||||||
);
|
|
||||||
|
|
||||||
function baseValidator(result: AgentResult): ValidationCheck[] {
|
|
||||||
const output = getStructuredOutput(result);
|
|
||||||
const setOutputCalled = output !== null;
|
|
||||||
const correctValue = setOutputCalled && output === "PULLFROG_MCP_WORKS";
|
|
||||||
|
|
||||||
return [
|
|
||||||
{ name: "set_output", passed: setOutputCalled },
|
|
||||||
{ name: "correct_value", passed: correctValue },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- exports ---
|
|
||||||
|
|
||||||
export const tests: Record<string, TestRunnerOptions> = {
|
|
||||||
"mcpmerge-full": {
|
|
||||||
name: "mcpmerge-full",
|
|
||||||
fixture: fullFixture,
|
|
||||||
validator: fullValidator,
|
|
||||||
tags: ["mcpmerge"],
|
|
||||||
agents: ["claude", "cursor", "gemini", "opencode"],
|
|
||||||
env: sharedEnv,
|
|
||||||
agentEnv: fullTestUuids.agentEnv,
|
|
||||||
fileAgentEnv: fullTestUuids.agentEnv,
|
|
||||||
},
|
|
||||||
"mcpmerge-pullfrog-only": {
|
|
||||||
name: "mcpmerge-pullfrog-only",
|
|
||||||
fixture: baseFixture,
|
|
||||||
validator: baseValidator,
|
|
||||||
tags: ["mcpmerge"],
|
|
||||||
agents: ["codex"],
|
|
||||||
env: sharedEnv,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -202,6 +202,9 @@ export function buildDockerRunArgs(config: DockerRunArgsContext): string[] {
|
|||||||
const setupCmd = [
|
const setupCmd = [
|
||||||
// install sudo (node:24 is Debian-based) - check if already installed first
|
// install sudo (node:24 is Debian-based) - check if already installed first
|
||||||
`which sudo > /dev/null 2>&1 || (apt-get update -qq && apt-get install -qq -y sudo > /dev/null 2>&1)`,
|
`which sudo > /dev/null 2>&1 || (apt-get update -qq && apt-get install -qq -y sudo > /dev/null 2>&1)`,
|
||||||
|
// remove any existing user/group with the same uid/gid (e.g. node:24 has "node" at 1000:1000)
|
||||||
|
`existing_user=$(getent passwd ${config.ctx.uid} | cut -d: -f1) && [ -n "$existing_user" ] && [ "$existing_user" != "testuser" ] && userdel "$existing_user" 2>/dev/null || true`,
|
||||||
|
`existing_group=$(getent group ${config.ctx.gid} | cut -d: -f1) && [ -n "$existing_group" ] && [ "$existing_group" != "testuser" ] && groupdel "$existing_group" 2>/dev/null || true`,
|
||||||
// create user matching host uid/gid for file permissions
|
// create user matching host uid/gid for file permissions
|
||||||
`id testuser > /dev/null 2>&1 || (groupadd -g ${config.ctx.gid} testuser 2>/dev/null || true; useradd -u ${config.ctx.uid} -g ${config.ctx.gid} -m -s /bin/bash testuser 2>/dev/null || true)`,
|
`id testuser > /dev/null 2>&1 || (groupadd -g ${config.ctx.gid} testuser 2>/dev/null || true; useradd -u ${config.ctx.uid} -g ${config.ctx.gid} -m -s /bin/bash testuser 2>/dev/null || true)`,
|
||||||
// configure passwordless sudo (like GHA runners) - check if already configured
|
// configure passwordless sudo (like GHA runners) - check if already configured
|
||||||
|
|||||||
Reference in New Issue
Block a user