feat(SKY-11609): attribute Temporal activity-timeout workflow finalization (#7148)

This commit is contained in:
LawyZheng 2026-07-07 15:07:41 +08:00 committed by GitHub
parent ef9476e8fa
commit 45505ef3e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 55 additions and 1 deletions

View file

@ -1,5 +1,12 @@
from __future__ import annotations
import re
# Matches the activity/heartbeat timeout tokens the worker persists when a Temporal-activity
# timeout finalizes a run. Word-anchored so "inactivity timeout" (a distinct page-level reason)
# is NOT caught and correctly stays PAGE_LOAD_TIMEOUT.
_INFRA_TIMEOUT_RE = re.compile(r"\b(?:activity|heartbeat) timeout\b")
def classify_from_failure_reason(
failure_reason: str | None,
@ -102,8 +109,21 @@ def classify_from_failure_reason(
}
)
# Infrastructure timeout — a Temporal activity / heartbeat timeout finalizes the run from
# the worker layer (a stalled activity or worker interruption), not a site/page-load issue.
# Classify before PAGE_LOAD_TIMEOUT so these don't masquerade as site slowness.
_is_infra_timeout = bool(_INFRA_TIMEOUT_RE.search(reason))
if _is_infra_timeout:
categories.append(
{
"category": "INFRASTRUCTURE_ERROR",
"confidence_float": 0.9,
"reasoning": "Activity/heartbeat timeout finalized the run",
}
)
# Page load timeout
if "Timeout" in exc_name or "timeout" in reason:
if ("Timeout" in exc_name or "timeout" in reason) and not _is_infra_timeout:
categories.append(
{
"category": "PAGE_LOAD_TIMEOUT",