diff --git a/crates/tui/src/tui/ui.rs b/crates/tui/src/tui/ui.rs index 61cb195c..1512c5bb 100644 --- a/crates/tui/src/tui/ui.rs +++ b/crates/tui/src/tui/ui.rs @@ -1491,6 +1491,27 @@ async fn run_event_loop( // Generate post-turn receipt for completed turns. if status == crate::core::events::TurnOutcomeStatus::Completed { + // SlopLedger completion-gate: after every completed + // turn, check whether there are unresolved slop entries + // the agent should address before claiming the task is + // done (#2127). This runs autonomously — no tool call + // required — so the agent can't forget to check. + if let Ok(ledger) = crate::slop_ledger::SlopLedger::load() + && ledger.has_open_entries() + { + if let Some(gate_msg) = ledger.completion_gate_summary() { + let short = gate_msg + .lines() + .nth(4) + .unwrap_or("review before done"); + app.push_status_toast( + format!("⚠️ SlopLedger: {short}"), + crate::tui::app::StatusToastLevel::Warning, + Some(12_000), + ); + } + } + let tool_count = app.tool_evidence.len(); let mut receipt = "✓ turn completed".to_string(); if tool_count > 0 {