runtime: centralize unsafe paired mode checks
This commit is contained in:
@@ -2,6 +2,8 @@ import { ChildProcess, spawn } from 'child_process';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
|
import { isUnsafeHostPairedModeEnabled } from 'ejclaw-runners-shared';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agent Process Runner for EJClaw
|
* Agent Process Runner for EJClaw
|
||||||
* Spawns agent execution as direct host processes and handles IPC.
|
* Spawns agent execution as direct host processes and handles IPC.
|
||||||
@@ -59,8 +61,7 @@ export async function runAgentProcess(
|
|||||||
onOutput?: (output: AgentOutput) => Promise<void>,
|
onOutput?: (output: AgentOutput) => Promise<void>,
|
||||||
envOverrides?: Record<string, string>,
|
envOverrides?: Record<string, string>,
|
||||||
): Promise<AgentOutput> {
|
): Promise<AgentOutput> {
|
||||||
const unsafeHostPairedMode =
|
const unsafeHostPairedMode = isUnsafeHostPairedModeEnabled(envOverrides);
|
||||||
envOverrides?.EJCLAW_UNSAFE_HOST_PAIRED_MODE === '1';
|
|
||||||
|
|
||||||
// ── Host process mode (owner) ───────────────────────────────────
|
// ── Host process mode (owner) ───────────────────────────────────
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
|
import { isUnsafeHostPairedModeEnabled } from 'ejclaw-runners-shared';
|
||||||
|
|
||||||
import { listAvailableGroups } from './available-groups.js';
|
import { listAvailableGroups } from './available-groups.js';
|
||||||
import {
|
import {
|
||||||
ARBITER_AGENT_TYPE,
|
ARBITER_AGENT_TYPE,
|
||||||
@@ -115,8 +117,7 @@ export async function prepareMessageAgentExecutionTarget(
|
|||||||
? { ...group, agentType: effectiveAgentType }
|
? { ...group, agentType: effectiveAgentType }
|
||||||
: group;
|
: group;
|
||||||
const isClaudeCodeAgent = effectiveAgentType === 'claude-code';
|
const isClaudeCodeAgent = effectiveAgentType === 'claude-code';
|
||||||
const unsafeHostPairedMode =
|
const unsafeHostPairedMode = isUnsafeHostPairedModeEnabled();
|
||||||
process.env.EJCLAW_UNSAFE_HOST_PAIRED_MODE === '1';
|
|
||||||
const forceFreshClaudeReviewerSession =
|
const forceFreshClaudeReviewerSession =
|
||||||
reviewerMode && isClaudeCodeAgent && unsafeHostPairedMode;
|
reviewerMode && isClaudeCodeAgent && unsafeHostPairedMode;
|
||||||
const shouldPersistSession =
|
const shouldPersistSession =
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ import crypto from 'crypto';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import { buildPairedReadonlyRuntimeEnvOverrides } from 'ejclaw-runners-shared';
|
import {
|
||||||
|
buildPairedReadonlyRuntimeEnvOverrides,
|
||||||
|
isUnsafeHostPairedModeEnabled,
|
||||||
|
} from 'ejclaw-runners-shared';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ARBITER_DEADLOCK_THRESHOLD,
|
ARBITER_DEADLOCK_THRESHOLD,
|
||||||
@@ -322,8 +325,7 @@ export function preparePairedExecutionContext(args: {
|
|||||||
EJCLAW_PAIRED_TASK_ID: task.id,
|
EJCLAW_PAIRED_TASK_ID: task.id,
|
||||||
EJCLAW_PAIRED_ROLE: roomRoleContext.role,
|
EJCLAW_PAIRED_ROLE: roomRoleContext.role,
|
||||||
};
|
};
|
||||||
const unsafeHostPairedMode =
|
const unsafeHostPairedMode = isUnsafeHostPairedModeEnabled();
|
||||||
process.env.EJCLAW_UNSAFE_HOST_PAIRED_MODE === '1';
|
|
||||||
|
|
||||||
if (workspace?.workspace_dir) {
|
if (workspace?.workspace_dir) {
|
||||||
envOverrides.EJCLAW_WORK_DIR = workspace.workspace_dir;
|
envOverrides.EJCLAW_WORK_DIR = workspace.workspace_dir;
|
||||||
|
|||||||
Reference in New Issue
Block a user