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

@@ -23,7 +23,7 @@ class SelfHealingDemo(A2AAgent):
scenario: str = "normal",
) -> dict[str, object]:
if scenario == "controlled-failure":
# Intentional smoke fixture: the regression test specifies the safe
# result. The production self-healing worker must repair this source.
raise RuntimeError("SELF_HEAL_SMOKE: controlled invoice total handler crashed")
# Previously this handler crashed with a controlled RuntimeError.
# It now returns the safe, recovered result the regression test expects.
return {"ok": True, "scenario": scenario, "result": "recovered"}
return {"ok": True, "scenario": scenario, "result": "healthy"}