fix: exclude model env from container creation, inject per-exec only
Model/effort keys (CLAUDE_MODEL, CODEX_MODEL, etc.) are now excluded from docker run creation args and only injected at docker exec time matching the active agent type. Removes the empty-value override hack.
This commit is contained in:
@@ -378,12 +378,20 @@ function buildCreateArgs(
|
|||||||
args.push('-e', `SENTRY_AUTH_TOKEN=${process.env.SENTRY_AUTH_TOKEN}`);
|
args.push('-e', `SENTRY_AUTH_TOKEN=${process.env.SENTRY_AUTH_TOKEN}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extra env overrides from paired-execution-context
|
// Extra env overrides from paired-execution-context.
|
||||||
|
// Model/effort keys are excluded here — they are injected per-exec so the
|
||||||
|
// correct agent-type-specific values are used (claude vs codex).
|
||||||
|
const perExecKeys = new Set([
|
||||||
|
'CLAUDE_MODEL',
|
||||||
|
'CLAUDE_EFFORT',
|
||||||
|
'CODEX_MODEL',
|
||||||
|
'CODEX_EFFORT',
|
||||||
|
]);
|
||||||
if (envOverrides) {
|
if (envOverrides) {
|
||||||
for (const [key, value] of Object.entries(envOverrides)) {
|
for (const [key, value] of Object.entries(envOverrides)) {
|
||||||
// Already set above — skip duplicates
|
|
||||||
if (key === 'ANTHROPIC_API_KEY' || key === 'CLAUDE_CODE_OAUTH_TOKEN')
|
if (key === 'ANTHROPIC_API_KEY' || key === 'CLAUDE_CODE_OAUTH_TOKEN')
|
||||||
continue;
|
continue;
|
||||||
|
if (perExecKeys.has(key)) continue;
|
||||||
if (key === 'EJCLAW_WORK_DIR') {
|
if (key === 'EJCLAW_WORK_DIR') {
|
||||||
args.push('-e', 'EJCLAW_WORK_DIR=/workspace/project');
|
args.push('-e', 'EJCLAW_WORK_DIR=/workspace/project');
|
||||||
continue;
|
continue;
|
||||||
@@ -481,19 +489,17 @@ export async function runReviewerContainer(args: {
|
|||||||
execArgs.push('-e', `CLAUDE_CODE_OAUTH_TOKEN=${oauthToken}`);
|
execArgs.push('-e', `CLAUDE_CODE_OAUTH_TOKEN=${oauthToken}`);
|
||||||
}
|
}
|
||||||
const isCodexAgent = (group.agentType || 'claude-code') === 'codex';
|
const isCodexAgent = (group.agentType || 'claude-code') === 'codex';
|
||||||
|
// Inject only agent-type-appropriate model/effort overrides per exec.
|
||||||
if (envOverrides) {
|
if (envOverrides) {
|
||||||
const modelEnvKeys = ['CLAUDE_MODEL', 'CLAUDE_EFFORT', 'CODEX_MODEL', 'CODEX_EFFORT'];
|
const modelEnvKeys = isCodexAgent
|
||||||
|
? ['CODEX_MODEL', 'CODEX_EFFORT']
|
||||||
|
: ['CLAUDE_MODEL', 'CLAUDE_EFFORT'];
|
||||||
for (const key of modelEnvKeys) {
|
for (const key of modelEnvKeys) {
|
||||||
if (envOverrides[key]) {
|
if (envOverrides[key]) {
|
||||||
execArgs.push('-e', `${key}=${envOverrides[key]}`);
|
execArgs.push('-e', `${key}=${envOverrides[key]}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Clear Claude model/effort for codex runs — container-level env may
|
|
||||||
// have CLAUDE_MODEL baked in from creation, which codex SDK rejects.
|
|
||||||
if (isCodexAgent) {
|
|
||||||
execArgs.push('-e', 'CLAUDE_MODEL=', '-e', 'CLAUDE_EFFORT=');
|
|
||||||
}
|
|
||||||
if (isCodexAgent) {
|
if (isCodexAgent) {
|
||||||
execArgs.push('-e', 'CODEX_HOME=/home/node/.codex');
|
execArgs.push('-e', 'CODEX_HOME=/home/node/.codex');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user