Bugfix/Iteration blocks execution after resuming from human input (#5359)
Fix iteration blocks execution after resuming from human input
This commit is contained in:
parent
f3f2eabb89
commit
62d34066c9
|
|
@ -1235,7 +1235,8 @@ const executeNode = async ({
|
|||
index: i,
|
||||
value: item,
|
||||
isFirst: i === 0,
|
||||
isLast: i === results.input.iterationInput.length - 1
|
||||
isLast: i === results.input.iterationInput.length - 1,
|
||||
sessionId: sessionId
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
@ -1503,7 +1504,7 @@ export const executeAgentFlow = async ({
|
|||
const uploads = incomingInput.uploads
|
||||
const userMessageDateTime = new Date()
|
||||
const chatflowid = chatflow.id
|
||||
const sessionId = overrideConfig.sessionId || chatId
|
||||
const sessionId = iterationContext?.sessionId || overrideConfig.sessionId || chatId
|
||||
const humanInput: IHumanInput | undefined = incomingInput.humanInput
|
||||
|
||||
// Validate history schema if provided
|
||||
|
|
@ -1655,7 +1656,8 @@ export const executeAgentFlow = async ({
|
|||
}
|
||||
|
||||
// If it is human input, find the last checkpoint and resume
|
||||
if (humanInput) {
|
||||
// Skip human input resumption for recursive iteration calls - they should start fresh
|
||||
if (humanInput && !(isRecursive && iterationContext)) {
|
||||
if (!previousExecution) {
|
||||
throw new Error(`No previous execution found for session ${sessionId}`)
|
||||
}
|
||||
|
|
@ -1766,7 +1768,7 @@ export const executeAgentFlow = async ({
|
|||
})
|
||||
|
||||
if (parentExecution) {
|
||||
logger.debug(` 📝 Using parent execution ID: ${parentExecutionId} for recursive call`)
|
||||
logger.debug(` 📝 Using parent execution ID: ${parentExecutionId} for recursive call (iteration: ${!!iterationContext})`)
|
||||
newExecution = parentExecution
|
||||
} else {
|
||||
console.warn(` ⚠️ Parent execution ID ${parentExecutionId} not found, will create new execution`)
|
||||
|
|
@ -1861,6 +1863,11 @@ export const executeAgentFlow = async ({
|
|||
let iterations = 0
|
||||
let currentHumanInput = humanInput
|
||||
|
||||
// For iteration calls, clear human input since they should start fresh
|
||||
if (isRecursive && iterationContext && humanInput) {
|
||||
currentHumanInput = undefined
|
||||
}
|
||||
|
||||
let analyticHandlers: AnalyticHandler | undefined
|
||||
let parentTraceIds: ICommonObject | undefined
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue