Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ class AgentLogObserver implements TraceObserverV2, LogObserver {
def cached = stats?.cachedCount ?: 0
def completed = succeeded + failed

def status = failed > 0 ? 'FAILED' : 'SUCCESS'
def hasSessionError = session && !session.isSuccess()
def status = (failed > 0 || hasSessionError) ? 'FAILED' : 'SUCCESS'
printLine("\n[${status}] completed=${completed} failed=${failed} cached=${cached}")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ class AgentLogObserverTest extends Specification {
def statsObserver = Stub(WorkflowStatsObserver) {
getStats() >> stats
}
def session = Stub(Session) {
isSuccess() >> true
}
def observer = new TestAgentLogObserver(output)
observer.setStatsObserver(statsObserver)
observer.onFlowCreate(session)

when:
observer.onFlowComplete()
Expand All @@ -123,8 +127,12 @@ class AgentLogObserverTest extends Specification {
def statsObserver = Stub(WorkflowStatsObserver) {
getStats() >> stats
}
def session = Stub(Session) {
isSuccess() >> false
}
def observer = new TestAgentLogObserver(output)
observer.setStatsObserver(statsObserver)
observer.onFlowCreate(session)

when:
observer.onFlowComplete()
Expand All @@ -133,6 +141,30 @@ class AgentLogObserverTest extends Specification {
output[0] == '\n[FAILED] completed=7 failed=2 cached=0'
}

def 'should output failed summary when session has error but no task failures'() {
given:
def output = []
def stats = new WorkflowStats()
stats.succeededCount = 0
stats.failedCount = 0
stats.cachedCount = 0
def statsObserver = Stub(WorkflowStatsObserver) {
getStats() >> stats
}
def session = Stub(Session) {
isSuccess() >> false
}
def observer = new TestAgentLogObserver(output)
observer.setStatsObserver(statsObserver)
observer.onFlowCreate(session)

when:
observer.onFlowComplete()

then:
output[0] == '\n[FAILED] completed=0 failed=0 cached=0'
}

def 'should handle task complete for failed task'() {
given:
def output = []
Expand Down
Loading