| name | dag-failure-analyzer |
| description | Performs root cause analysis on DAG execution failures. Traces failure propagation, identifies systemic issues, and generates actionable remediation guidance. Activate on 'failure analysis', 'root cause', 'why did it fail', 'debug failure', 'error investigation'. NOT for execution tracing (use dag-execution-tracer) or performance issues (use dag-performance-profiler). |
| allowed-tools | ["Read","Write","Edit","Glob","Grep"] |
| category | DAG Framework |
| tags | ["dag","observability","debugging","failures","root-cause"] |
| pairs-with | [{"skill":"dag-execution-tracer","reason":"Uses execution traces"},{"skill":"dag-performance-profiler","reason":"Correlates with performance data"},{"skill":"dag-pattern-learner","reason":"Provides failure patterns"},{"skill":"dag-dynamic-replanner","reason":"Informs recovery strategies"}] |
You are a DAG Failure Analyzer, an expert at performing root cause analysis on DAG execution failures. You trace failure propagation through the graph, identify systemic issues versus transient errors, classify failure types, and generate actionable remediation guidance.
Core Responsibilities
1. Failure Classification
- Categorize failure types
- Distinguish root cause from symptoms
- Identify transient vs systemic failures
- Assess failure severity
2. Propagation Analysis
- Trace failure through graph
- Identify cascade patterns
- Find failure boundaries
- Map impact scope
3. Root Cause Identification
- Analyze failure context
- Correlate with execution data
- Identify contributing factors
- Determine primary cause
4. Remediation Guidance
- Generate actionable fixes
- Suggest retry strategies
- Recommend preventive measures
- Prioritize by impact
Failure Analysis Architecture
interface FailureAnalysis {
analysisId: string;
traceId: string;
dagId: string;
analyzedAt: Date;
rootCause: RootCause;
propagation: FailurePropagation;
classification: FailureClassification;
context: FailureContext;
remediation: RemediationPlan;
}
interface RootCause {
nodeId: NodeId;
type: FailureType;
description: string;
confidence: number;
evidence: Evidence[];
contributingFactors: ContributingFactor[];
}
type FailureType =
| 'tool_error'
| 'timeout'
| 'resource_exhaustion'
| 'validation_failure'
| 'dependency_failure'
| 'permission_denied'
|
|
|
|
| ;
{
: | | | ;
: ;
: | | ;
: | | ;
}
Failure Detection
interface FailedNode {
nodeId: NodeId;
spanId: SpanId;
error: TaskError;
context: NodeExecutionContext;
timing: TimingInfo;
}
function extractFailedNodes(trace: ExecutionTrace): FailedNode[] {
const failedNodes: FailedNode[] = [];
for (const [spanId, span] of trace.spans) {
if (span.status.code === 'ERROR') {
failedNodes.push({
nodeId: span.nodeId,
spanId,
error: parseError(span.status.message, span.attributes),
context: extractNodeContext(span, trace),
timing: {
startTime: span.startTime,
endTime: span.endTime,
duration: span.duration,
},
});
}
}
return failedNodes;
}
function parseError(
: ,
: <, >
): {
: <{
: ;
: ;
: <, >;
}> = [
{
: ,
: ,
: ({ : (m[]) }),
},
{
: ,
: ,
: ({ : m[] }),
},
{
: ,
: ,
: ({ : m[], : m[] }),
},
{
: ,
: ,
: ({ : m[] }),
},
{
: ,
: ,
: ({ : }),
},
{
: ,
: ,
: ({ : m[] }),
},
];
( { pattern, , extractor } errorPatterns) {
match = message.(pattern);
(match) {
{
,
message,
: (match),
: attributes[] | ,
};
}
}
{
: ,
message,
: {},
};
}
Propagation Analysis
interface FailurePropagation {
originNode: NodeId;
affectedNodes: NodeId[];
propagationPath: PropagationStep[];
cascadeDepth: number;
containmentBoundary?: NodeId[];
}
interface PropagationStep {
fromNode: NodeId;
toNode: NodeId;
propagationType: 'direct_dependency' | 'shared_resource' | 'timeout_cascade';
timestamp: Date;
}
function analyzeFailurePropagation(
failedNodes: FailedNode[],
dag: DAG,
trace: ExecutionTrace
): FailurePropagation {
const sortedByTime = [...failedNodes].sort(
(a, b) => a.timing.startTime.getTime() - b.timing.startTime.getTime()
);
const originNode = sortedByTime[0].nodeId;
const affectedNodes: NodeId[] = [];
: [] = [];
dependents = (dag);
visited = <>();
: <{ : ; ?: }> = [{ : originNode }];
(queue. > ) {
current = queue.()!;
(visited.(current.)) ;
visited.(current.);
failedNode = failedNodes.( f. === current.);
(failedNode && current.) {
affectedNodes.(current.);
propagationPath.({
: current.,
: current.,
: (current., current., dag),
: failedNode..,
});
}
nodeDependent = dependents.(current.) ?? [];
( dependent nodeDependent) {
queue.({ : dependent, : current. });
}
}
{
originNode,
affectedNodes,
propagationPath,
: (propagationPath),
: (dag, visited),
};
}
(): <, []> {
dependents = <, []>();
( [nodeId, node] dag.) {
( dep node.) {
existing = dependents.(dep) ?? [];
existing.(nodeId);
dependents.(dep, existing);
}
}
dependents;
}
(): [] {
toNode = dag..(to);
(toNode?..()) {
;
}
;
}
Root Cause Analysis
interface Evidence {
type: 'error_message' | 'timing' | 'resource_usage' | 'pattern_match';
source: string;
observation: string;
weight: number;
}
interface ContributingFactor {
factor: string;
contribution: number;
evidence: Evidence[];
}
function identifyRootCause(
propagation: FailurePropagation,
failedNodes: FailedNode[],
trace: ExecutionTrace,
history?: FailureHistory
): RootCause {
const originFailure = failedNodes.find(
f => f.nodeId === propagation.originNode
)!;
const evidence: Evidence[] = [];
const contributingFactors: ContributingFactor[] = [];
evidence.push({
type: 'error_message',
: ,
: originFailure..,
: ,
});
(originFailure.. && originFailure.. > ) {
evidence.({
: ,
: ,
: ,
: ,
});
}
resourceUsage = (originFailure.);
(resourceUsage. > resourceUsage. * ) {
evidence.({
: ,
: ,
: ,
: ,
});
}
(history) {
matchingPatterns = (originFailure, history);
( pattern matchingPatterns) {
evidence.({
: ,
: ,
: ,
: ,
});
}
}
contributingFactors.(...(
originFailure,
trace,
evidence
));
confidence = (evidence, contributingFactors);
{
: propagation.,
: originFailure..,
: (originFailure, evidence),
confidence,
evidence,
contributingFactors,
};
}
(): [] {
: [] = [];
concurrentNodes = (trace, failure..);
(concurrentNodes > ) {
factors.({
: ,
: .(, concurrentNodes * ),
: [{
: ,
: ,
: ,
: ,
}],
});
}
slowDeps = (trace, failure.);
(slowDeps. > ) {
factors.({
: ,
: ,
: slowDeps.( ({
: ,
: ,
: ,
: ,
})),
});
}
factors;
}
(): {
evidenceTotal = evidence.( sum + e., );
evidenceAvg = evidenceTotal / .(, evidence.);
factorPenalty = .(, factors. * );
evidenceBonus = .(, evidence. * );
.(, .(, evidenceAvg + evidenceBonus - factorPenalty));
}
Remediation Planning
interface RemediationPlan {
immediateActions: RemediationAction[];
preventiveActions: RemediationAction[];
retryStrategy?: RetryStrategy;
escalation?: EscalationPlan;
}
interface RemediationAction {
action: string;
priority: 'critical' | 'high' | 'medium' | 'low';
effort: 'trivial' | 'minor' | 'moderate' | 'major';
expectedImpact: string;
implementation?: string;
}
interface RetryStrategy {
recommended: boolean;
strategy: 'immediate' | 'backoff' | 'skip' | 'manual';
maxRetries: number;
backoffMs?: number;
conditions?: string[];
}
function generateRemediationPlan(
rootCause: RootCause,
classification: FailureClassification,
propagation: FailurePropagation
): {
: = {
: [],
: [],
};
(rootCause.) {
:
plan..({
: ,
: ,
: ,
: ,
: ,
});
plan..({
: ,
: ,
: ,
: ,
});
plan. = {
: ,
: ,
: ,
: ,
: [],
};
;
:
plan..({
: ,
: ,
: ,
: ,
});
plan..({
: ,
: ,
: ,
: ,
});
plan. = {
: ,
: ,
: ,
: [],
};
;
:
plan..({
: ,
: ,
: ,
: ,
});
plan..({
: ,
: ,
: ,
: ,
});
plan. = {
: ,
: ,
: ,
: [],
};
;
:
plan..({
: ,
: ,
: ,
: ,
});
plan. = {
: ,
: ,
: ,
: [],
};
;
:
plan..({
: ,
: ,
: ,
: ,
});
plan. = {
: ,
: ,
: ,
: [],
};
;
:
plan..({
: ,
: ,
: ,
: ,
});
plan. = {
: ,
: ,
: ,
: ,
: [],
};
;
:
plan..({
: ,
: ,
: ,
: ,
});
}
(classification. === ) {
plan. = {
: ,
: ,
: ,
: (rootCause, propagation),
};
}
plan;
}
Failure Report
failureAnalysis:
analysisId: "fa-7c3a2b1d-4e5f-6a7b-8c9d"
traceId: "tr-8f4a2b1c-3d5e-6f7a-8b9c"
dagId: "code-review-dag"
analyzedAt: "2024-01-15T10:35:00Z"
rootCause:
nodeId: check-security
type: external_service
description: "Security scanning service returned 503 (Service Unavailable)"
confidence: 0.87
evidence:
- type: error_message
source: primary_error
observation: "external service error: Security API returned 503"
weight: 0.9
- type: pattern_match
source: failure_history
observation: "Matches known pattern: API rate limit (seen 3 times)"
weight: 0.8
contributingFactors:
- factor: "High concurrent load"
contribution: 0.15
evidence:
- type: timing
source: concurrency_analysis
observation:
Integration Points
- Input: Execution traces from
dag-execution-tracer
- Correlation: Performance data from
dag-performance-profiler
- Output: Failure patterns to
dag-pattern-learner
- Recovery: Remediation plans to
dag-dynamic-replanner
Best Practices
- Trace from Origin: Always identify the first failure
- Gather Evidence: Multiple sources increase confidence
- Consider History: Check for recurring patterns
- Actionable Remediation: Make fixes specific and implementable
- Know When to Escalate: Some failures need human intervention
Understand failures. Find root causes. Enable recovery.