fix(telegram): close Agent99 lifecycle ack
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Failing after 1m24s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Failing after 1m24s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
This commit is contained in:
@@ -769,6 +769,67 @@ async def test_lifecycle_reconciles_pending_send_without_duplicate_provider_mess
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_lifecycle_reconciles_provider_sent_pending_ack_without_resend(
|
||||
monkeypatch,
|
||||
) -> None:
|
||||
send_calls: list[dict] = []
|
||||
reconcile_calls: list[dict] = []
|
||||
|
||||
class Gateway:
|
||||
async def send_agent99_lifecycle_receipt(self, **kwargs):
|
||||
send_calls.append(kwargs)
|
||||
return {
|
||||
"ok": True,
|
||||
"result": {"message_id": 9129},
|
||||
"_awooop_outbound_mirror_acknowledged": False,
|
||||
"_awooop_delivery_status": (
|
||||
"provider_sent_durable_receipt_pending"
|
||||
),
|
||||
"_awooop_provider_send_performed": True,
|
||||
"_awooop_delivery_context": {
|
||||
"destination_binding_verified": True,
|
||||
"destination_binding": "a" * 64,
|
||||
},
|
||||
}
|
||||
|
||||
async def reconcile_agent99_lifecycle_receipt(self, **kwargs):
|
||||
reconcile_calls.append(kwargs)
|
||||
return {
|
||||
"ok": True,
|
||||
"result": {"message_id": 9129},
|
||||
"_awooop_outbound_mirror_acknowledged": True,
|
||||
"_awooop_delivery_status": "sent_reused",
|
||||
"_awooop_provider_send_performed": False,
|
||||
"_awooop_delivery_context": {
|
||||
"destination_binding_verified": True,
|
||||
},
|
||||
}
|
||||
|
||||
async def no_sleep(_delay: float) -> None:
|
||||
return None
|
||||
|
||||
monkeypatch.setattr(
|
||||
lifecycle_service,
|
||||
"get_telegram_gateway",
|
||||
lambda: Gateway(),
|
||||
)
|
||||
monkeypatch.setattr(lifecycle_service.asyncio, "sleep", no_sleep)
|
||||
|
||||
receipt = await lifecycle_service.deliver_agent99_telegram_lifecycle(
|
||||
Agent99TelegramLifecycleRequest.model_validate(payload())
|
||||
)
|
||||
|
||||
assert receipt["ok"] is True
|
||||
assert receipt["delivery_status"] == "sent_reused"
|
||||
assert receipt["provider_send_performed"] is True
|
||||
assert receipt["durable_reconciliation_attempts"] == 1
|
||||
assert len(send_calls) == 1
|
||||
assert len(reconcile_calls) == 1
|
||||
assert reconcile_calls[0]["expected_provider_message_id"] == "9129"
|
||||
assert reconcile_calls[0]["expected_destination_binding"] == "a" * 64
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_lifecycle_follower_only_reads_inflight_durable_delivery(
|
||||
monkeypatch,
|
||||
|
||||
Reference in New Issue
Block a user