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,
|
index: i,
|
||||||
value: item,
|
value: item,
|
||||||
isFirst: i === 0,
|
isFirst: i === 0,
|
||||||
isLast: i === results.input.iterationInput.length - 1
|
isLast: i === results.input.iterationInput.length - 1,
|
||||||
|
sessionId: sessionId
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -1503,7 +1504,7 @@ export const executeAgentFlow = async ({
|
||||||
const uploads = incomingInput.uploads
|
const uploads = incomingInput.uploads
|
||||||
const userMessageDateTime = new Date()
|
const userMessageDateTime = new Date()
|
||||||
const chatflowid = chatflow.id
|
const chatflowid = chatflow.id
|
||||||
const sessionId = overrideConfig.sessionId || chatId
|
const sessionId = iterationContext?.sessionId || overrideConfig.sessionId || chatId
|
||||||
const humanInput: IHumanInput | undefined = incomingInput.humanInput
|
const humanInput: IHumanInput | undefined = incomingInput.humanInput
|
||||||
|
|
||||||
// Validate history schema if provided
|
// 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 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) {
|
if (!previousExecution) {
|
||||||
throw new Error(`No previous execution found for session ${sessionId}`)
|
throw new Error(`No previous execution found for session ${sessionId}`)
|
||||||
}
|
}
|
||||||
|
|
@ -1766,7 +1768,7 @@ export const executeAgentFlow = async ({
|
||||||
})
|
})
|
||||||
|
|
||||||
if (parentExecution) {
|
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
|
newExecution = parentExecution
|
||||||
} else {
|
} else {
|
||||||
console.warn(` ⚠️ Parent execution ID ${parentExecutionId} not found, will create new execution`)
|
console.warn(` ⚠️ Parent execution ID ${parentExecutionId} not found, will create new execution`)
|
||||||
|
|
@ -1861,6 +1863,11 @@ export const executeAgentFlow = async ({
|
||||||
let iterations = 0
|
let iterations = 0
|
||||||
let currentHumanInput = humanInput
|
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 analyticHandlers: AnalyticHandler | undefined
|
||||||
let parentTraceIds: ICommonObject | undefined
|
let parentTraceIds: ICommonObject | undefined
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue