Repository navigation
fix(harness): retain classified stop cause before host cleanup - #571
AmirrezaFarnamTaheri wants to merge 1 commit into
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.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
Backport the owner fix proposed in tinyhumansai#571 so host finish_run cleanup cannot erase AgentRun.failure_cause. Keep an existing cause authoritative and retain latch cleanup. Source-commit: 83b4604 Source-PR: tinyhumansai#571
|
Thanks. This is the right place for this fix. OpenHuman currently carries the same capture-before-finish_run on the host side (#8146), and this lets it go away. On current main the branch merges cleanly, and on our build of it fmt and clippy are clean, the harness lib passes (3311/0), and all 3 new finish tests pass. |
|
Thanks @AmirrezaFarnamTaheri, this is the right fix. To get it landed we've carried your commit over unchanged, with your authorship kept, in #608, rebased onto current main. On our Linux CI runner it passes the full harness suite (3311/0), including your three finish tests, and removing the capture makes classified_cause_survives_host_latch_cleanup fail as expected. Closing this draft in favour of #608; the credit stays with you. |
Problem
FailureScopeMiddleware::after_agentcalls the host policy'sfinish_runhook before retaining the current classified stop cause. A host may legitimately clear its stop latch in that hook, so a classified failure recorded by a host callback can disappear fromAgentRun::failure_causeat the end of the run. OpenHuman'sclassified_stop_cause_survives_the_latch_cleanup_on_agent_finishregression test exposes this ordering bug.Change
Capture
current_halt_causebeforefinish_runclears per-run evidence, only when the run does not already carry a cause. Keep an already recorded loop/middleware cause authoritative, and retain the existing cleanup behavior.The new owner tests cover latch cleanup, preserving an existing cause, and an unclassified run. The middleware documentation now states the finish ordering.
Validation
rustfmt --edition 2024 --config skip_children=trueon both changed Rust files: passed.git diff --check: passed.a5b4d0f6b8b962b28c4288a8518773743e252343.cargo test --manifest-path vendor/tinyagents/Cargo.toml --locked -p tinyagents-harness --no-default-features --lib failure_scope::finish_tests, against the exact patch in the public downstream integration266ab91419ed55f111aed97313ba1d0e52f7d010.No host-side fallback or change to failure classification, stop budgets, or latch ownership is introduced.
Downstream regression: AmirrezaFarnamTaheri/openhuman#17