The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): a zero-padded delegate pid never crashes marker admission (review F11)
Teknium610affcae7c3
diff --git a/hermes_cli/update_lock.py b/hermes_cli/update_lock.pyindex 9fd9edff467..63ab4ad2694 100644--- a/hermes_cli/update_lock.py+++ b/hermes_cli/update_lock.py@@ -590,13 +590,13 @@ def _parse_marker(raw: bytes, *, mtime: float | None = None) -> _Marker:started_at = _bounded_int(lines[1], _U64_MAX) if pid is not None else Nonepid = -1 if pid is None else pidct = _CT_LINE.fullmatch(lines[2])- delegate = next((m for m in map(_DELEGATE_LINE.fullmatch, lines[3:])- if m and _bounded_int(m.group(1), _U32_MAX) is not None), None)+ delegates = ((m, _bounded_int(m.group(1), _U32_MAX)) for m in map(_DELEGATE_LINE.fullmatch, lines[3:]) if m)+ delegate, delegate_pid = next(((m, d) for m, d in delegates if d is not None), (None, None))runs = tuple(m.group(1) for m in map(_RUN_LINE.fullmatch, lines[3:]) if m)in_flight = not raw and mtime is not None and time.time() - mtime < EMPTY_MARKER_GRACE_SECONDSreturn _Marker(raw=raw, pid=pid, started_at=started_at, create_time=float(ct.group(1)) if ct else None,- delegate_pid=int(delegate.group(1)) if delegate else None,+ delegate_pid=delegate_pid,delegate_create_time=float(delegate.group(2)) if delegate else None, in_flight=in_flight,ct_text=ct.group(1) if ct else None, delegate_ct_text=delegate.group(2) if delegate else None,runs=runs,diff --git a/tests/fixtures/update_marker_corpus.json b/tests/fixtures/update_marker_corpus.jsonindex 4762ae83c97..1d58d6ba69f 100644--- a/tests/fixtures/update_marker_corpus.json+++ b/tests/fixtures/update_marker_corpus.json@@ -617,6 +617,19 @@},"note": "an unparseable delegate line is ignored, never an error"},+ {+ "name": "delegate_pid_leading_zeros_past_int_limit",+ "text": "6080\n1791079348\nct:1791079348.328\ndelegate:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013368 ct:1791079350.794\n",+ "live": {+ "13368": 1791079350.794+ },+ "expect": {+ "verdict": "live",+ "owner": 13368,+ "run": null+ },+ "note": "the delegate pid fits u32: leading zeros never count, and a reader must not raise on them (CPython int() refuses >4300 digits)"+ },{"name": "ct_huge_digit_count","text": "6080\n1791079348\nct:1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n",