Format retry transition refactor files
This commit is contained in:
@@ -1410,9 +1410,8 @@ describe('runAgentForGroup room memory', () => {
|
||||
expect(
|
||||
vi.mocked(db.insertPairedTurnOutput).mock.invocationCallOrder[0],
|
||||
).toBeLessThan(
|
||||
vi.mocked(
|
||||
pairedExecutionContext.completePairedExecutionContext,
|
||||
).mock.invocationCallOrder[0],
|
||||
vi.mocked(pairedExecutionContext.completePairedExecutionContext).mock
|
||||
.invocationCallOrder[0],
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -34,9 +34,7 @@ import {
|
||||
} from './paired-execution-context.js';
|
||||
import { resolveCodexFallbackHandoff } from './paired-turn-fallback.js';
|
||||
import { resolveExecutionTarget } from './message-runtime-rules.js';
|
||||
import {
|
||||
resolvePairedFollowUpQueueAction,
|
||||
} from './message-agent-executor-rules.js';
|
||||
import { resolvePairedFollowUpQueueAction } from './message-agent-executor-rules.js';
|
||||
import { buildRoomRoleContext } from './room-role-context.js';
|
||||
import { type AgentTriggerReason } from './agent-error-detection.js';
|
||||
import {
|
||||
|
||||
@@ -851,7 +851,10 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): {
|
||||
chatJid,
|
||||
getRecentChatMessages(chatJid, 20),
|
||||
),
|
||||
lastDeliveredMessages: labelPairedSenders(chatJid, missedMessages),
|
||||
lastDeliveredMessages: labelPairedSenders(
|
||||
chatJid,
|
||||
missedMessages,
|
||||
),
|
||||
resolveChannel,
|
||||
})
|
||||
: null;
|
||||
|
||||
@@ -141,10 +141,7 @@ export function transitionPairedTaskStatus(args: {
|
||||
currentStatus: PairedTaskStatus;
|
||||
nextStatus: PairedTaskStatus;
|
||||
updatedAt: string;
|
||||
patch?: Omit<
|
||||
Parameters<typeof updatePairedTask>[1],
|
||||
'status' | 'updated_at'
|
||||
>;
|
||||
patch?: Omit<Parameters<typeof updatePairedTask>[1], 'status' | 'updated_at'>;
|
||||
}): void {
|
||||
assertPairedTaskStatusTransition({
|
||||
currentStatus: args.currentStatus,
|
||||
|
||||
@@ -512,34 +512,34 @@ async function runTask(
|
||||
}
|
||||
};
|
||||
|
||||
const provider = context.taskAgentType === 'codex' ? 'codex' : 'claude';
|
||||
const provider = context.taskAgentType === 'codex' ? 'codex' : 'claude';
|
||||
|
||||
{
|
||||
const attempt = await runTaskAttempt(provider);
|
||||
result = attempt.attemptResult;
|
||||
error = attempt.attemptError;
|
||||
{
|
||||
const attempt = await runTaskAttempt(provider);
|
||||
result = attempt.attemptResult;
|
||||
error = attempt.attemptError;
|
||||
|
||||
const retryAction = resolveAttemptRetryAction({
|
||||
provider,
|
||||
canRetryClaudeCredentials: provider === 'claude' && getTokenCount() > 0,
|
||||
canRetryCodex: provider === 'codex' && getCodexAccountCount() > 1,
|
||||
attempt,
|
||||
rotationMessage: error,
|
||||
});
|
||||
const retryAction = resolveAttemptRetryAction({
|
||||
provider,
|
||||
canRetryClaudeCredentials: provider === 'claude' && getTokenCount() > 0,
|
||||
canRetryCodex: provider === 'codex' && getCodexAccountCount() > 1,
|
||||
attempt,
|
||||
rotationMessage: error,
|
||||
});
|
||||
|
||||
if (retryAction.kind === 'claude') {
|
||||
await retryClaudeTaskWithRotation(
|
||||
retryAction.trigger,
|
||||
retryAction.rotationMessage,
|
||||
);
|
||||
} else if (retryAction.kind === 'codex') {
|
||||
await retryCodexTaskWithRotation(
|
||||
retryAction.trigger,
|
||||
retryAction.rotationMessage,
|
||||
);
|
||||
} else if (attempt.output.status === 'error') {
|
||||
error = attempt.attemptError || 'Unknown error';
|
||||
}
|
||||
if (retryAction.kind === 'claude') {
|
||||
await retryClaudeTaskWithRotation(
|
||||
retryAction.trigger,
|
||||
retryAction.rotationMessage,
|
||||
);
|
||||
} else if (retryAction.kind === 'codex') {
|
||||
await retryCodexTaskWithRotation(
|
||||
retryAction.trigger,
|
||||
retryAction.rotationMessage,
|
||||
);
|
||||
} else if (attempt.output.status === 'error') {
|
||||
error = attempt.attemptError || 'Unknown error';
|
||||
}
|
||||
} // end else (non-exhausted path)
|
||||
|
||||
log.info(
|
||||
|
||||
Reference in New Issue
Block a user