From 4db4476eab9c562aa9b2dba73f5bf025e36a1203 Mon Sep 17 00:00:00 2001 From: Afloat Date: Wed, 2 Dec 2026 17:12:34 +0800 Subject: [PATCH] fix: distinguish authentication statuses from numeric substrings --- meta_harness/failure_policy.py | 10 +++++- tests/test_failure_status_boundaries.py | 44 +++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 tests/test_failure_status_boundaries.py diff --git a/meta_harness/failure_policy.py b/meta_harness/failure_policy.py index f4575db..d680a04 100644 --- a/meta_harness/failure_policy.py +++ b/meta_harness/failure_policy.py @@ -4,6 +4,7 @@ import hashlib import json +import re from dataclasses import dataclass, field from typing import Any, Mapping @@ -189,7 +190,14 @@ def classify_failure( return code if "cuda out of memory" in text or "cublas_status_alloc_failed" in text: return "cuda_oom" - if "401" in text or "403" in text or "authentication" in text or "gated repo" in text: + # A duration, package name, or model identifier can contain these digits + # without being an HTTP status. Misreading one disables ordinary recovery + # and asks for credentials that cannot fix the underlying failure. + if ( + re.search(r"(?