fix: prevent DONE↔DONE infinite loop and add AGENT_LANGUAGE setting

- Fix source_ref mismatch: update to workspace HEAD on first owner run
  so change detection compares against the correct repo
- Treat hasNewChanges === null as "no changes" at finalize to prevent
  infinite re-review when source_ref is unresolvable
- Add AGENT_LANGUAGE env var: when set, appends language instruction to
  all paired room prompts (owner, reviewer, arbiter)
This commit is contained in:
Eyejoker
2026-03-31 13:55:41 +09:00
parent 47d532e869
commit 757e33c58e
3 changed files with 39 additions and 14 deletions

View File

@@ -1,8 +1,14 @@
import fs from 'fs';
import path from 'path';
import { AGENT_LANGUAGE } from './config.js';
import type { AgentType } from './types.js';
function appendLanguageInstruction(prompt: string): string {
if (!AGENT_LANGUAGE) return prompt;
return `${prompt}\n\n## Language\n\nAlways respond in ${AGENT_LANGUAGE}.`;
}
const PLATFORM_PROMPT_FILES: Record<AgentType, string> = {
'claude-code': 'claude-platform.md',
codex: 'codex-platform.md',
@@ -60,7 +66,7 @@ export function readPairedRoomPrompt(
if (!fs.existsSync(promptPath)) return undefined;
const prompt = fs.readFileSync(promptPath, 'utf-8').trim();
return prompt || undefined;
return prompt ? appendLanguageInstruction(prompt) : undefined;
}
export function getArbiterPromptPath(projectRoot = process.cwd()): string {
@@ -74,5 +80,5 @@ export function readArbiterPrompt(
if (!fs.existsSync(promptPath)) return undefined;
const prompt = fs.readFileSync(promptPath, 'utf-8').trim();
return prompt || undefined;
return prompt ? appendLanguageInstruction(prompt) : undefined;
}