diff --git a/AGENTS.md b/AGENTS.md index d2fc5e7..034bb8d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -145,6 +145,13 @@ describe('auth/login', () => { - Types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore` - Keep commits atomic and focused +### Blind Review + +- After implementation, send the full diff to two independent reviewers. Give them only the requirements, acceptance criteria, and task boundaries; do not reveal the implementation intent or the other reviewer's findings. +- Fix confirmed issues with scoped changes, then repeat the two independent reviews. +- Once reviews converge and only small corrections remain, use one blind reviewer. +- If review and fixes stop converging, pause patching and reconsider the design as a whole. Stop and report the unresolved issue if redesign does not resolve it. + ## Project Structure ``` diff --git a/src/agent/availability.ts b/src/agent/availability.ts index 193d4b1..6e6c7c6 100644 --- a/src/agent/availability.ts +++ b/src/agent/availability.ts @@ -36,3 +36,9 @@ export function detectAgentsOnPath(env: NodeJS.ProcessEnv = process.env): Set { + const agents = detectAgentsOnPath(env); + if (env.CODEX_THREAD_ID?.trim()) agents.add('codex'); + return agents; +} diff --git a/src/commands/agent/setup.ts b/src/commands/agent/setup.ts index ce8578e..b07e023 100644 --- a/src/commands/agent/setup.ts +++ b/src/commands/agent/setup.ts @@ -6,7 +6,7 @@ import { prepareAgentConfigurations, withAgentSetupLock, } from '../../agent/configurator'; -import { detectAgentsOnPath } from '../../agent/availability'; +import { detectAvailableAgents } from '../../agent/availability'; import { getAgentInstallCommand, getAgentInstallIssue, @@ -412,7 +412,7 @@ export default defineCommand({ 'mmx agent setup --agent opencode --api-key --region cn --dry-run', ], async run(config: Config, flags: GlobalFlags) { - const detectedAgents = detectAgentsOnPath(); + const detectedAgents = detectAvailableAgents(); const interactive = isInteractiveInvocation(flags); const options = interactive ? await interactiveOptions(config, detectedAgents) diff --git a/test/agent/availability.test.ts b/test/agent/availability.test.ts index 44a2fe9..3123a55 100644 --- a/test/agent/availability.test.ts +++ b/test/agent/availability.test.ts @@ -3,7 +3,7 @@ import { chmodSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'fs'; import { tmpdir } from 'os'; import { join } from 'path'; -import { detectAgentsOnPath } from '../../src/agent/availability'; +import { detectAgentsOnPath, detectAvailableAgents } from '../../src/agent/availability'; describe('agent availability', () => { const roots: string[] = []; @@ -60,4 +60,26 @@ describe('agent availability', () => { expect(detectAgentsOnPath({ Path: root })).toEqual(new Set()); }); + + it('recognizes the active Codex runtime without a Codex executable on PATH', () => { + expect(detectAvailableAgents({ CODEX_THREAD_ID: 'thread-id' })).toEqual(new Set(['codex'])); + }); + + it('keeps PATH detection when recognizing the active Codex runtime', () => { + const root = executableDirectory('pi'); + expect(detectAvailableAgents({ + PATH: root, + PATHEXT: '.COM;.EXE;.BAT;.CMD', + CODEX_THREAD_ID: 'thread-id', + })).toEqual(new Set(['codex', 'pi'])); + }); + + it('does not recognize a Codex runtime when its marker is missing', () => { + expect(detectAvailableAgents({})).toEqual(new Set()); + }); + + it('ignores empty and whitespace-only Codex runtime markers', () => { + expect(detectAvailableAgents({ CODEX_THREAD_ID: '' })).toEqual(new Set()); + expect(detectAvailableAgents({ CODEX_THREAD_ID: ' ' })).toEqual(new Set()); + }); });