Fix controlled-failure crash in run skill

The run skill raised RuntimeError for scenario=controlled-failure,
causing HTTP500. Return the safe recovered result instead and add
regression coverage.
This commit is contained in:
OpenHarness Self-Healing
2026-07-18 12:32:40 +00:00
parent cc0a37e9fa
commit 53764a88a5
2 changed files with 16 additions and 3 deletions

View File

@@ -12,6 +12,9 @@ async def test_controlled_failure_has_a_safe_result() -> None:
agent = SelfHealingDemo()
ctx = LocalRunContext(auth=NoAuth())
# Regression: this scenario previously raised
# RuntimeError("SELF_HEAL_SMOKE: controlled invoice total handler crashed").
# It must now return a safe, recovered result without raising.
result = await agent.run(ctx, scenario="controlled-failure")
assert result == {
@@ -19,3 +22,13 @@ async def test_controlled_failure_has_a_safe_result() -> None:
"scenario": "controlled-failure",
"result": "recovered",
}
@pytest.mark.asyncio
async def test_normal_scenario_stays_healthy() -> None:
agent = SelfHealingDemo()
ctx = LocalRunContext(auth=NoAuth())
result = await agent.run(ctx, scenario="normal")
assert result == {"ok": True, "scenario": "normal", "result": "healthy"}