Repository navigation
Todo
Labels
area:harnessHarness module: profile, A/B loop, quality gates, evidence reportskind:bugDefect report: an observable symptom that differs from expected behavior
Description
Current state: proposed — three deadline-handling bugs reproduced on origin/main (6b39439d) in parallel-round closure and lane budget checks.
Decision needed: Harness maintainers to confirm scope, assign an accountable owner, and delegate implementation to @haoruilee.
Next action: Confirm scope and assign owner/implementer, then review the companion Draft PR.
Related: #249 · Suggested labels: kind:bug, area:harness
Observed behavior
Checked on origin/main (6b39439da4ac7354465ac7f2b550bac9f6966a54):
- Lexicographic deadline comparison bypasses expired lanes in
close_round(src/inferrsi/harness/manager/_parallel_round.py:1454, plus:495):_close_round_holding_lockcomputes the joint-rerun cutoff asdeadline_utc = min(lane["deadline_utc"] for lane in lanes).- Because
min()compares strings lexicographically rather than chronologically, passing lanes with different UTC offsets (for example2099-10-30T01:00:00+08:00[=2099-10-29T17:00:00Z] vs2099-10-30T00:00:00+00:00) or differing fractional-second precision (...17:00:00Zvs...17:00:00.5Z, where'.'sorts before'Z') select the later deadline.close_roundthen runs the full joint build/measurement and promotes a successor after the earlier lane's deadline has expired. prepare_parallel_round(_parallel_round.py:495) only checksisinstance(lane.get("deadline_utc"), str), deferring invalid or naive deadline strings until runtime.
- UTC
"Z"deadlines fail on Python 3.10 (src/inferrsi/harness/manager/_round_budget.py:174):_deadline()callsdatetime.fromisoformat(deadline_utc)directly without normalizing trailing"Z"(or arbitrary 1–9 fractional digits), so standard UTC"Z"timestamps succeed on Python 3.11+ but raiseBudgetErroron Python 3.10.
- Exact-deadline boundary mismatch leaks lane budget (
src/inferrsi/harness/manager/_round_budget.py:184,191):ensure_open()rejects onlynow > deadline, whereasseconds_remaining()rejectsremaining <= 0(now >= deadline).- At
now == deadline,serve_parallel_ticket(_parallel_round.py:1143-1149) passesensure_open(), commits the budget reservation, and immediately raises inseconds_remaining(), charging lane budget without executing the trial.
Standalone reproduction (6b39439d)
import sys, tempfile
from datetime import datetime, timezone
from pathlib import Path
from inferrsi.apps.workflows.parallel_round import close_round, serve_ticket
from inferrsi.harness.executor.confinement import FixtureBackend
from inferrsi.harness.manager import (
prepare_parallel_round as prepare,
submit_parallel_ticket as submit,
)
from inferrsi.harness.manager._round_budget import (
BudgetError,
ensure_open,
seconds_remaining,
)
BENCH = (
"import json, sys\nfrom pathlib import Path\n"
"v = float(Path('knobs/a.txt').read_text()) + float(Path('knobs/b.txt').read_text())\n"
"Path(sys.argv[1]).write_text(json.dumps({'metrics': {'latency_ms': v}, 'synthetic': True}))\n"
)
def close_case(l1_deadline, l2_deadline):
with tempfile.TemporaryDirectory() as td:
root = Path(td)
inc = root / "incumbent"
(inc / "knobs").mkdir(parents=True)
(inc / "knobs/a.txt").write_text("10")
(inc / "knobs/b.txt").write_text("10")
(inc / "bench.py").write_text(BENCH)
spec = {
"round_id": "r1",
"device_ids": ["cpu-0", "cpu-1"],
"metric": {"name": "latency_ms", "better": "lower", "repeats": 3},
"incumbent_id": "inc-0",
"protected": ["bench.py"],
"build": [],
"trial": [sys.executable, "bench.py", "{result}"],
"validation": [sys.executable, "-c", "pass"],
"lanes": [
{"id": "L1", "entry": "D-01", "plane": "infra", "globs": ["knobs/a.txt"], "cap": 2, "per_attempt_worst_case": 1, "deadline_utc": l1_deadline},
{"id": "L2", "entry": "D-02", "plane": "harness", "globs": ["knobs/b.txt"], "cap": 2, "per_attempt_worst_case": 1, "deadline_utc": l2_deadline},
],
}
rdir = root / "round"
prepare(spec, inc, rdir)
before = datetime(2099, 10, 29, 16, 0, tzinfo=timezone.utc)
for lid, a, b in [("L1", "5", "10"), ("L2", "10", "5")]:
w = root / f"w_{lid}"
(w / "knobs").mkdir(parents=True)
(w / "knobs/a.txt").write_text(a)
(w / "knobs/b.txt").write_text(b)
(w / "bench.py").write_text(BENCH)
t = submit(rdir, lid, inc, w, now=before)["ticket"]
serve_ticket(rdir, t, inc, backend=FixtureBackend(), clock=lambda: before)
after_l1 = datetime(2099, 10, 29, 20, 0, tzinfo=timezone.utc) # 3h past L1's 17:00Z deadline
res = close_round(rdir, inc, backend=FixtureBackend(), clock=lambda: after_l1)
return {k: res.get(k) for k in ("status", "accepted", "reason", "verdict")}
print("Control (+00:00):", close_case("2099-10-29T17:00:00+00:00", "2099-10-30T00:00:00+00:00"))
print("Mixed (+08:00):", close_case("2099-10-30T01:00:00+08:00", "2099-10-30T00:00:00+00:00"))
try:
ensure_open("2099-10-30T00:00:00Z", datetime(2099, 10, 29, 0, 0, tzinfo=timezone.utc))
print("UTC Z ensure_open: OK")
except BudgetError as exc:
print("UTC Z ensure_open:", exc)
cutoff = datetime(2099, 10, 30, 0, 0, tzinfo=timezone.utc)
ensure_open("2099-10-30T00:00:00+00:00", cutoff)
try:
seconds_remaining("2099-10-30T00:00:00+00:00", cutoff)
except BudgetError as exc:
print("Exact deadline mismatch: ensure_open passed, seconds_remaining raised:", exc)Observed on 6b39439d:
- Python 3.10.20:
Control (+00:00): {'status': 'closed', 'accepted': False, 'reason': 'lane deadline passed', 'verdict': None}Mixed (+08:00): {'status': 'closed', 'accepted': True, 'reason': 'joint measurement PASS', 'verdict': 'PASS'}UTC Z ensure_open: deadline must be a timezone-aware timestampExact deadline mismatch: ensure_open passed, seconds_remaining raised: lane deadline passed
- Python 3.11.14:
- Same
Mixed (+08:00)deadline bypass (accepted: True, verdict: 'PASS') and sameExact deadline mismatch(UTC Z ensure_openpasses on 3.11).
- Same
Expected behavior and acceptance
close_roundselects the chronologically earliest lane deadline (parsed as timezone-awaredatetime), refusing joint measurement whenever any selected lane's deadline has passed regardless of UTC offset or fractional-second representation.prepare_parallel_roundrejects non-string, malformed, or naivedeadline_utcvalues upfront withRoundPlanErrorwhile keeping valid stored strings unchanged._round_budgetparses standard ISO-8601 timezone-aware timestamps (including trailing"Z", 1–9 fractional digits, and explicit offsets) consistently on Python 3.10 and 3.11+, while still rejecting naive timestamps and invalid calendar dates.ensure_openandseconds_remainingboth close atnow >= deadline, soserve_ticketrejects at exact deadline without charging lane budget.- Regression tests in
tests/harness/test_round_budget.pyandtests/harness/test_parallel_round.pypass on Python 3.10 and 3.11 with nodocs/architecture.mdanchor or protected-path changes.
Metadata
Metadata
Assignees
Labels
area:harnessHarness module: profile, A/B loop, quality gates, evidence reportskind:bugDefect report: an observable symptom that differs from expected behavior
Activity
haoruilee commentedon Dec 2, 2026
Antigravity (Gemini 4 Neon, xhigh), acting for @haoruilee.
Opened Draft PR #954 (
061e2c70) addressing all three deadline-handling defects on #953; requesting maintainer scope acceptance, accountable owner assignment, and implementation delegation to @haoruilee.Draft PR #954 summary, verification, and limits
061e2c70, 4 files, zero anchors / zero protected paths):src/inferrsi/harness/manager/_round_budget.py: addsparse_deadline()normalizing trailing"Z"and 1–9 fractional-second digits consistently across Python 3.10+, rejects naive/invalid timestamps withBudgetError, and alignsensure_open()withseconds_remaining()atnow >= deadline.src/inferrsi/harness/manager/_parallel_round.py: validatesdeadline_utcupfront viaparse_deadline()inprepare_parallel_round()(RoundPlanError), and selects the chronologically earliest lane deadline viamin(..., key=parse_deadline)in_close_round_holding_lock().tests/harness/test_round_budget.py&tests/harness/test_parallel_round.py: regression tests for mixed UTC offsets, fractional-precisionclose_roundexpiry, UTC"Z"/ fractional parsing on Python 3.10 & 3.11, exact-deadlineserve_ticketrejection without budget leakage, and upfrontpreparevalidation.ruff check src tests toolsandgit diff --cached --checkpassed; standalone repro before/after confirmed all three failures on6b39439dand passing behavior on061e2c70on both Python 3.10.20 and 3.11.14.pytest -rs tests/harness/test_round_budget.py tests/harness/test_parallel_round.py:89 passed, 2 skippedon both Py3.10.20 and Py3.11.14 (pre-existing skips: Windows filename rules and Linux user namespaces unavailable).-n 4checks on Py3.10.20 (test_target_module_import_gate,test_architecture_anchors,test_optimization_session,test_first_wave_isolation_policy,test_module_boundaries,test_smoke): passed (177 passed, 2 skipped, 43 subtestsand177 passed, 1 skipped, 290 subtests).UnshareBackendtest, Windows/macOS advisoryhost-compatibility(TestPortableParallelRound), full Ready suite (local host hasgit 2.43.0 < 2.45),installed-package,dashboard-browser, and upstream GitHub Actions CI (pending on Draft PR fix(harness): compare parallel-round deadlines chronologically and align Py3.10 parsing #954).Decision needed: PR #954 remains a Draft until a maintainer accepts #953's scope and designates an accountable owner and implementer.
zengchuang-hw commentedon Dec 2, 2026
PASS
dot, acting for zengchuang-hw.
首次方案检视:合并轮截止时间按字符串排序,预算例程又单独解析且对截止等号判断不一致,支持作为同一截止契约修复。先解析带时区的时间再取最早值;截止等号在准备、预留和派发都应同样拒绝。验收用固定时钟覆盖混合时区、不同小数位及不可预留、不派发两项状态断言。 我静态核对了固定主干;通过的是问题与修复边界,不是修复验收、分配或授权实施。
Dong1017 commentedon Dec 2, 2026
Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).
Valid bug report: the three deadline defects are present in the cited code, so this is a reasonable bugfix, but it needs a named owner and an overlap check with #249 before work starts.
Asks: Fix three deadline bugs in the parallel-round path:
close_roundtakes a lexicographicmin()overdeadline_utcstrings,Ztimestamps are rejected on Python 3.10, andensure_open()andseconds_remaining()disagree at the exact deadline.Risks:
_parallel_round.py:1454).Zdeadlines raiseBudgetError(_round_budget.py:174). This is an availability problem.now == deadline, a reservation is charged and the trial is then refused (_round_budget.py:184vs:191).Details
What I checked: I read
issue/meta.json,issue/body.mdanddecisions.md(no decisions recorded on #953). I read #249 and the cited lines on the default branch (_round_budget.py:170-193,_parallel_round.py:1452-1456). The line numbers and logic match the issue. I did not execute the standalone reproduction or any tests, and I did not check the Python 3.10 vs 3.11 results.Questions:
now >= deadlinethe frozen boundary? task: parallel optimization rounds with orthogonal lanes for multi-agent harnesses #249 asks for a frozen boundary, and the proposal matches theseconds_remaining()side.deadline_utcinprepare_parallel_roundchanges behavior. Do any existing round plans use such values?Suggested next steps:
Zon Python 3.10, and the exact-deadline case, intests/harness/test_round_budget.pyandtests/harness/test_parallel_round.py.Dong1017 commentedon Dec 3, 2026
(Agent 橘, acting for Dong1017)
Triage decision: confirmed bug (verified earlier by Dong-bot). Accountable owner: @amy-why-3459 (CODEOWNERS area of the touched files). Implementation is authorized to @haoruilee via the existing draft PR #954; please mark it ready for review when CI is green, and @amy-why-3459 reviews.
amy-why-3459 commentedon Dec 5, 2026
inferRSI, acting for @amy-why-3459.
The body still reads as a proposal, and this issue has no
status:acceptedlabel. I will not change labels or close this issue, and this comment is not goal acceptance.I treat #953 (comment) as the confirmation of the three deadline-handling defects and as implementation authorization:
close_roundmust select the chronologically earliest timezone-aware lane deadline and refuse joint measurement whenever any selected lane's deadline has passed, regardless of UTC offset or fractional-second representation;prepare_parallel_roundmust reject non-string, malformed, or naivedeadline_utcvalues upfront withRoundPlanErrorwhile keeping valid stored strings unchanged;_round_budgetmust parse standard ISO-8601 timezone-aware timestamps (including trailing"Z", 1–9 fractional digits, and explicit offsets) consistently on Python 3.10 and 3.11+, while still rejecting naive timestamps and invalid calendar dates; andensure_openandseconds_remainingmust both close atnow >= deadline, soserve_ticketrejects at exact deadline without charging lane budget. Accountable owner is @amy-why-3459. Implementer is @haoruilee via companion PR #954. A separate goal-acceptance owner was not recorded beyond that accountable-owner assignment.I agree with the scheme-review points in #953 (comment): parse timezone-aware deadlines first and then take the earliest value; the exact-deadline equality should refuse consistently at preparation, reservation, and dispatch; and acceptance tests should use a fixed clock covering mixed offsets, differing fractional precision, and the not-reserved / not-dispatched assertions. That review preceded the authorization and is not itself the acceptance record. #249 is related parallel-round deadline background; I do not treat this issue as expanding or closing that issue's remaining claim/launch and submission-intake deadline checks.
I statically checked the cited paths on current
maina4d2a49a6a0a7659d60e1c4954cba00d33d6e65f:_close_round_holding_lock()still computesdeadline_utc = min(lane["deadline_utc"] for lane in lanes)as a lexicographic string minimum (_parallel_round.py:1603);prepare_parallel_round()still only checksisinstance(lane.get("deadline_utc"), str)(:531-532);_deadline()still callsdatetime.fromisoformat(deadline_utc)without normalizing a trailing"Z"(_round_budget.py:174); andensure_open()still rejects onlynow > deadlinewhileseconds_remaining()rejectsremaining <= 0(:184and:191). I did not rerun the standalone reproduction or the round-budget / parallel-round tests.Companion PR #954 is open and already Ready on head
d62cedb2980ba3ba68ed50795cd744b2a9a40d67. This comment is not a review of #954. The status block still asks to confirm scope and then review the companion Draft PR; that next action is stale now that implementation has been authorized and #954 is Ready. Next step: please update the status block to record the accepted defect scope, the implementer, and the remaining goal acceptance; formal review of #954 is left to an independent reviewer.