fix: detect Conductor via actual env vars (CONDUCTOR_WORKSPACE_NAME)

Previous detection checked CONDUCTOR_WORKSPACE_ID which doesn't exist.
Conductor sets CONDUCTOR_WORKSPACE_NAME, CONDUCTOR_BIN_DIR, CONDUCTOR_PORT,
and __CFBundleIdentifier=com.conductor.app. Check these FIRST because
Conductor sessions also have ANTHROPIC_API_KEY (which was matching claude-code).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-21 11:29:28 -07:00
parent 6b6fb16eb0
commit 10847933b6
+7 -10
View File
@@ -127,16 +127,13 @@ export type RuntimeEnv = 'conductor' | 'claude-code' | 'codex' | 'terminal';
* due to macOS App Management security restrictions.
*/
export function detectRuntime(): RuntimeEnv {
// Conductor sets these env vars for workspace subprocesses
if (process.env.CONDUCTOR_WORKSPACE_ID || process.env.CONDUCTOR_APP) return 'conductor';
// Check if parent process is Conductor (Electron app)
try {
const ppid = process.ppid;
if (ppid) {
const parentInfo = execSync(`ps -p ${ppid} -o comm= 2>/dev/null`, { stdio: 'pipe' }).toString().trim();
if (parentInfo.includes('Conductor') || parentInfo.includes('Electron')) return 'conductor';
}
} catch {}
// Conductor detection — check FIRST because Conductor also has ANTHROPIC_API_KEY
if (
process.env.CONDUCTOR_WORKSPACE_NAME ||
process.env.CONDUCTOR_BIN_DIR ||
process.env.CONDUCTOR_PORT ||
process.env.__CFBundleIdentifier === 'com.conductor.app'
) return 'conductor';
// Claude Code terminal detection
if (process.env.CLAUDE_CODE || process.env.ANTHROPIC_API_KEY) return 'claude-code';
// Codex CLI detection