Repository navigation
fix(harness): retain classified stop cause before host cleanup - #571
Draft
AmirrezaFarnamTaheri wants to merge 1 commit into
Draft
AmirrezaFarnamTaheri wants to merge 1 commit into
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 |
AmirrezaFarnamTaheri
added a commit
to AmirrezaFarnamTaheri/tinyagents
that referenced
this pull request
Oct 23, 2026
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
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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