Add consensus failure handling with fallback options for multi-agent pipelines

Implements detection and recovery for when agents fail to reach consensus:
- Orchestrator exits with code 2 on consensus failure (distinct from error=1)
- Records failed run context (proposals, agent states, conflicts) to Dragonfly
- Provides fallback options: rerun same, rerun with GAMMA, escalate tier, accept partial
- Adds UI alert with action buttons for user-driven recovery
- Adds failure details modal and downloadable failure report
- Only marks pipeline complete when consensus achieved or user accepts fallback

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
profit
2026-01-24 18:24:19 -05:00
co-authored by Claude Opus 4.5
parent 8561d13728
commit 09be7eff4b
3 changed files with 923 additions and 6 deletions
+21
View File
@@ -448,6 +448,27 @@ The solution should consider fault tolerance, data consistency, and cost optimiz
analyzePerformance(metrics);
// Output special marker for server to parse consensus status
// Format: ORCHESTRATION_RESULT:{"consensus":true/false,"metrics":{...}}
console.log("\nORCHESTRATION_RESULT:" + JSON.stringify({
consensus: metrics.final_consensus,
task_id: metrics.task_id,
metrics: metrics
}));
// Exit with code 2 for consensus failure (distinct from error=1, success=0)
if (!metrics.final_consensus) {
console.log("\n[ORCHESTRATOR] Consensus NOT achieved - exiting with code 2");
exitCode = 2;
// Report consensus failure to observability
const pipelineId = process.env.PIPELINE_ID;
if (pipelineId) {
await reportErrorToObservability(pipelineId, "consensus_failure", "high",
`Agents failed to reach consensus. Conflicts: ${metrics.conflicts_detected}, Resolved: ${metrics.conflicts_resolved}`);
}
}
} catch (e: any) {
console.error("Orchestrator error:", e.message);
exitCode = 1;