fix: skip role model override on failover handoffs

When forcedAgentType is set (failover), the role's configured model
(e.g. claude-opus-4-6 for reviewer) was injected as CODEX_MODEL,
causing codex SDK to reject it. Now model overrides are only injected
for the primary agent type, not failover runs.
This commit is contained in:
Eyejoker
2026-04-01 05:31:02 +09:00
parent 9b71bc5878
commit bfd781c552
2 changed files with 8 additions and 3 deletions

View File

@@ -494,7 +494,9 @@ export async function runReviewerContainer(args: {
containerName,
groupAgentType: group.agentType,
isCodexAgent,
runnerPath: isCodexAgent ? '/app/codex/dist/index.js' : '/app/agent/dist/index.js',
runnerPath: isCodexAgent
? '/app/codex/dist/index.js'
: '/app/agent/dist/index.js',
},
'Container exec runner selection',
);

View File

@@ -194,8 +194,11 @@ export async function runAgentForGroup(
roomRoleContext,
hasHumanMessage: args.hasHumanMessage,
});
// Inject role-specific model overrides into envOverrides
if (pairedExecutionContext) {
// Inject role-specific model overrides into envOverrides.
// When running a forced agent type (failover), skip the role's configured
// model — it belongs to the primary agent type (e.g. claude-opus-4-6 for
// a claude-code reviewer) and would be rejected by the fallback runtime.
if (pairedExecutionContext && !args.forcedAgentType) {
const roleConfig = getRoleModelConfig(activeRole);
if (roleConfig.model) {
const modelKey = isClaudeCodeAgent ? 'CLAUDE_MODEL' : 'CODEX_MODEL';