test(docker): a stalled docker exec is one failed poll attempt, not the verdict

poll_container and the dashboard probe loop let a single docker exec that
outlived its 10 s timeout raise TimeoutExpired out of the whole poll. On a
loaded arm64 runner the daemon stalls (same job logged 'use of closed
network connection' on docker.sock) and
test_dashboard_insecure_env_var_no_longer_bypasses_gate failed on PR
#146111, whose diff touches only SKILL.md text. Treat the timeout like any
other failed probe and keep polling to the deadline.
This commit is contained in:
Teknium
2026-10-28 12:50:57 -07:00
parent e4a3d99258
commit ccb3f388f7
2 changed files with 12 additions and 2 deletions

View File

@@ -242,7 +242,12 @@ def poll_container(
end = time.monotonic() + deadline_s
last = ""
while time.monotonic() < end:
r = docker_exec_sh(container, probe, user=user, timeout=10)
try:
r = docker_exec_sh(container, probe, user=user, timeout=10)
except subprocess.TimeoutExpired:
# A stalled ``docker exec`` (busy daemon on a loaded runner) is one failed attempt,
# not the verdict: keep polling until the deadline like any other non-zero probe.
continue
last = r.stdout
if r.returncode == 0:
return True, last

View File

@@ -13,6 +13,7 @@ the realistic runtime context. See the conftest module docstring.
from __future__ import annotations
import json
import subprocess
import time
from tests.docker.conftest import docker_exec, docker_exec_sh, start_container, poll_container
@@ -97,7 +98,11 @@ except urllib.error.HTTPError as h:
end = time.monotonic() + deadline_s
last_err = ""
while time.monotonic() < end:
r = docker_exec_sh(container, probe, timeout=10)
try:
r = docker_exec_sh(container, probe, timeout=10)
except subprocess.TimeoutExpired as exc:
last_err = f"docker exec stalled: {exc}" # a busy daemon: retry until the deadline
continue
if r.returncode == 0 and r.stdout.strip():
lines = r.stdout.split("\n", 1)
try: