fix: copy arbiter AGENTS.md to reviewer session for container mount

Container's /home/node/.claude always mounts the reviewer session dir.
When arbiter runs codex in the same container, CODEX_HOME reads from
reviewer session's .codex/. Copy arbiter AGENTS.md there so codex gets
arbiter prompts instead of reviewer prompts.
This commit is contained in:
Eyejoker
2026-04-01 13:34:46 +09:00
parent fad3ce3bdf
commit 59cf931b82

View File

@@ -97,6 +97,26 @@ export async function runAgentProcess(
memoryBriefing: input.memoryBriefing,
role: containerRole,
});
// For codex: also write AGENTS.md to the reviewer session dir, because
// the container's /home/node/.claude always mounts the reviewer session.
// Arbiter and reviewer never run simultaneously, so this is safe.
if (containerRole === 'arbiter') {
const reviewerSessionDir = path.join(
path.dirname(sessionDir),
`${group.folder}-reviewer`,
);
const reviewerCodexDir = path.join(reviewerSessionDir, '.codex');
if (fs.existsSync(reviewerSessionDir)) {
fs.mkdirSync(reviewerCodexDir, { recursive: true });
const arbiterAgentsMd = path.join(sessionDir, '.codex', 'AGENTS.md');
if (fs.existsSync(arbiterAgentsMd)) {
fs.copyFileSync(
arbiterAgentsMd,
path.join(reviewerCodexDir, 'AGENTS.md'),
);
}
}
}
}
return runReviewerContainer({