test(agent): give watchdog stubs progress_timeout; drop eager time.time() from stream-open log

The attempt-local first-progress deadline added `progress_timeout` to
`_NonStreamWatchdogs`, but the SimpleNamespace stubs in
test_nonstream_wait_notice.py and test_wait_notice_cadence.py were not
updated. `_emit_wait_notice` reads `wd.progress_timeout` inside its
blanket `except Exception`, so the AttributeError silently produced no
notice and no liveness touch: 11 tests red.

The new "Codex stream opened" debug line also called `time.time()`
eagerly, consuming a tick of the 3-tick stub in
test_codex_first_event_timing.py and shifting the first-event stamp.
The first-event log a few lines below already carries the attempt's
timeline anchor, so the open marker logs without an epoch.
This commit is contained in:
kshitijk4poor
2026-09-24 15:14:12 +05:30
committed by kshitij
parent 6a116551dc
commit 628094ee0e
3 changed files with 6 additions and 4 deletions

View File

@@ -1113,8 +1113,9 @@ def run_codex_stream(agent, api_kwargs: dict, client: Any = None, on_first_delta
# Claim the delta sink for THIS attempt; a newer attempt supersedes this token.
writer_token["value"] = claim_stream_writer(agent)
writer_token["raw_stream"] = _raw_stream
logger.debug("Codex stream opened at %.3f (attempt=%s/%s, model=%s)",
time.time(), attempt + 1, max_stream_retries + 1, model)
# No time.time() here: the first-event stamp below is the attempt's timeline anchor.
logger.debug("Codex stream opened (attempt=%s/%s, model=%s)",
attempt + 1, max_stream_retries + 1, model)
def _drain_for_finalizer(event_stream: Any) -> None:
# ``final`` is already assembled; draining only lets Relay run its finalizer. A transport error

View File

@@ -23,7 +23,7 @@ def _request():
request.call_start = 1000.0
request.wd = SimpleNamespace(
codex=True, stale_timeout=600.0, ttfb_enabled=True, ttfb_timeout=120.0,
idle_enabled=True, idle_timeout=180.0, idle_requires_progress=False,
idle_enabled=True, idle_timeout=180.0, idle_requires_progress=False, progress_timeout=0.0,
)
request.codex_watchdog_state = SimpleNamespace(
lock=threading.Lock(), last_event_ts=None, last_progress_ts=None,

View File

@@ -22,7 +22,8 @@ def _nonstream_request(ttfb_timeout=300.0):
request.api_kwargs = {"model": "test-model"}
request.call_start = 1000.0
request.wd = SimpleNamespace(codex=True, stale_timeout=600.0, ttfb_enabled=True, ttfb_timeout=ttfb_timeout,
idle_enabled=True, idle_timeout=180.0, idle_requires_progress=False)
idle_enabled=True, idle_timeout=180.0, idle_requires_progress=False,
progress_timeout=0.0)
request.codex_watchdog_state = SimpleNamespace(lock=threading.Lock(), last_event_ts=None,
last_progress_ts=None, retry_started_ts=None)
request.wait_notice_started_ts = None