Skip to content

Commit 237faba

Browse files
authored
Merge pull request #282 from satti-hari-krishna-reddy/main
Prevent duplicate ask decisions when one is already running
2 parents dea5d84 + 3f391ea commit 237faba

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

ai.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6764,6 +6764,21 @@ SINGUL ACTIONS:
67646764
previousAnswers := ""
67656765
relevantDecisions := []AgentDecision{}
67666766

6767+
// Check for existing RUNNING ask decisions - if found, return existing state without creating new decisions
6768+
hasRunningAsk := false
6769+
for _, mappedDecision := range mappedResult.Decisions {
6770+
if mappedDecision.RunDetails.Status == "RUNNING" && (mappedDecision.Action == "ask" || mappedDecision.Action == "question") {
6771+
log.Printf("[DEBUG][%s] Found existing RUNNING ask decision at index %d - returning existing state", execution.ExecutionId, mappedDecision.I)
6772+
hasRunningAsk = true
6773+
break
6774+
}
6775+
}
6776+
6777+
// If there's a running ask decision, return the existing agent output without modification
6778+
if hasRunningAsk {
6779+
return startNode, nil
6780+
}
6781+
67676782
hasFailure := false
67686783
for _, mappedDecision := range mappedResult.Decisions {
67696784
if mappedDecision.RunDetails.Status == "FAILURE" {

0 commit comments

Comments
 (0)