Repository navigation
fix(harness): retain classified stop cause before host cleanup - #608
Conversation
Capture a host's current halt cause during after_agent before finish_run clears its per-run latch. Preserve an existing AgentRun cause and keep cleanup behavior unchanged. Cover classified, existing, and unclassified finalization paths with owner-level regressions.
|
Warning Review limit reached
This review includes 3 billable files and costs up to $0.75. Or wait 14 minutes for your next included review. View limit details
|
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): fix(harness): retain classified stop cause before host cleanup. Tiny Sweeper completed its review; deterministic results follow. Review snapshot
Completeness: Complete Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
Summary
Supersedes #571 by @AmirrezaFarnamTaheri: their commit is cherry-picked onto current
mainwith their authorship kept. Thanks for the fix. #571 was a draft 1,400+ commits behindmain, so we're landing it from a fresh branch.A host stop-latch adapter can record a classified halt cause after the loop last looked at it.
FailureScopeMiddleware::after_agentthen callsfinish_run, which is allowed to clear that latch, so the cause was lost. This happens on exits that don't go through the loop's own pause copy, such as a deferred batch or aStopWithFinal/JumpTo(End)after the tools.after_agentnow copies the policy'scurrent_halt_causeintorun.failure_causebeforefinish_run, and only when nothing has recorded a cause yet. A cause set by the loop or another middleware stays authoritative.API Or Behavior Changes
AgentRun::failure_causeis now filled from the host policy's current halt cause at the end of a run when it would otherwise beNone. Thefinish_runcontract is unchanged; its doc now says the cause is captured first.Tests
Run on our Linux CI runner (2026-11-11) on 7a41be9, parent main 813a2e1. The branch also merges cleanly onto today's main.
cargo fmt --all -- --checkcargo clippy -p tinyagents-harness --all-targets -- -D warnings(0 items)cargo test -p tinyagents-harness --lib: 3311 passed, 0 failed, including the 3 finish tests from the original PRafter_agentremoved,classified_cause_survives_host_latch_cleanupfails (Noneinstead of theuncertain_side_effectcause).finish_preserves_an_already_recorded_causeandunclassified_finish_does_not_invent_a_causestill pass, as they should.--all-featuresbuilds and the full workspacecargo testwere not run here; the change is in tinyagents-harness only and is covered by CI.Documentation
middleware/library/README.md(from the original commit) describes the capture.