fix(heartbeat): skip when HEARTBEAT.md has no tasks and fail closed on delivery (#4111)

This commit is contained in:
04cb
2026-05-31 15:15:37 +08:00
committed by Xubin Ren
parent 2b4c984e9a
commit e3df310309
7 changed files with 134 additions and 23 deletions
+18
View File
@@ -61,3 +61,21 @@ async def test_no_tool_call_fallback() -> None:
provider = DummyProvider([LLMResponse(content="I think you should notify", tool_calls=[])])
result = await evaluate_response("some response", "some task", provider, "m")
assert result is True
@pytest.mark.asyncio
async def test_fail_closed_on_error() -> None:
class FailingProvider(DummyProvider):
async def chat(self, *args, **kwargs) -> LLMResponse:
raise RuntimeError("provider down")
provider = FailingProvider([])
result = await evaluate_response("some", "task", provider, "m", default_notify=False)
assert result is False
@pytest.mark.asyncio
async def test_fail_closed_on_no_tool_call() -> None:
provider = DummyProvider([LLMResponse(content="text only", tool_calls=[])])
result = await evaluate_response("some", "task", provider, "m", default_notify=False)
assert result is False