Skip to content

Observe passing source checks closer to the wait deadline - #1743

Closed
eowca wants to merge 3 commits into
mainfrom
lean178/1303-source-deadline
Closed

eowca wants to merge 3 commits into
mainfrom
lean178/1303-source-deadline

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Observe passing source checks closer to the wait deadline

Context and goal

  • Goal: Give source checks a late observation with enough time to read the result.
  • Problem: The last read runs at the midpoint of the remaining wait. A later passing check can be missed.
  • Context: Keep the total deadline and reserve read time based on observed latency. Merge takes an initial readiness observation before starting its wait budget.

Closes #1303

Acceptance

  • Ready and merge observe a check that passes after the old midpoint on the same head.
  • A slow read still times out at the deadline, and a zero wait still observes once.
  • Extend existing fake clock coverage without increasing test lines.

Base

Base: 481383a

Notes

Supersedes the #1303 slice of #1425. The last read uses the existing bounded GitHub calls and preserves the current wait budget and verdicts.

Validation

Recorded for 71cef5a334b8

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Review

  • primary, claude, 68f4f54, request_changes
  • delta, claude, 71cef5a, approve

Architecture-Review: unchanged; the final source observation uses its existing read deadline and preserves zero-wait behavior.
Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loopzero primary review by claude on 68f4f549f47beb3d7506b56fbb46eb4db6919218, 40.7s: request_changes (0 critical, 1 important, 1 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)

Native Claude output is retained in the restricted local review receipt.

Comment thread src/loopzero/cli.py Resolved
Comment thread tests/test_cli.py
def test_source_wait_reads_once_before_first_interval(
wt, gh, capsys, monkeypatch, source_queue_api, command,
):
def test_source_wait_reads_once_before_first_interval(wt, gh, capsys, monkeypatch, source_queue_api, command):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Test name no longer matches what it checks

With --wait=8, the remaining 8s is already less than the first 30s interval. The test now goes straight to the late-read branch and asserts a sleep of 7.2s, so it never exercises the 'first interval' path its name describes (the earlier clock.now == WAIT_INTERVAL check). Other tests still assert the leading 30.0 sleep, so overall coverage is fine. Consider renaming the test (for example ..._reads_once_then_late_before_deadline) so a future reader doesn't assume the regular interval is covered here.

Architecture-Review: unchanged; ready and merge both account for observed read latency within the existing wait deadline.
Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loopzero delta review by claude on 71cef5a334b896f291e0335f238a7f63bffae080, 19.3s: approve (0 critical, 0 important, 1 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)

Native Claude output is retained in the restricted local review receipt.

Comment thread src/loopzero/cli.py
waited = _wait_with_deadline(wt, config, pr, args.wait, kicked=True, started=started,
args=args, allow_skipped=True)
args=args, allow_skipped=True,
initial_read_time=started - read_started)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Second ready wait discards read latency seen during the first wait

The post-mark_ready wait gets initial_read_time=started - read_started, which is only the latency of the initial _pr_readiness read. In the draft-with-pending-checks path, the first _wait_with_deadline (line 1234) may have seen much slower reads. That longest_read is local to _poll_until and is lost. The second wait shares the same started/deadline, so its late-read allowance can be sized from a stale, smaller latency. The final observation is then scheduled too close to the deadline and gets cut off by ReadDeadline, so the result is a timeout where a passing check could have been seen. The wait still stops at the deadline, so this is not a correctness bug. Smallest fix: return or thread the observed longest read out of the first wait, or keep the maximum in a shared value, and pass it to the second call.

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

The approved head 71cef5a passed the full local check. The current main cannot merge it cleanly after #1747 changed the source-wait code in cli.py. Both review rounds are spent, so this draft stays at its approved head.

Architecture-Review: unchanged; Keep the approved deadline accounting with main’s explicit branch lookup.
Co-Authored-By: Codex <noreply@openai.com>
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Merged main at a6403fe4 into the approved head 71cef5a3. The resolution adds no behavior change and preserves both main’s explicit branch lookup and the approved wait timing.

git range-diff --no-color --diff-merges=remerge 481383af..71cef5a3 a6403fe4..1ffad3f6

1:  68f4f549 = 1:  68f4f549 Poll source checks closer to the wait deadline
2:  71cef5a3 = 2:  71cef5a3 Reserve time for the initial ready observation
-:  -------- > 3:  1ffad3f6 Merge origin/main and resolve the conflict for #1743

Conflict resolution from git show --remerge-diff --format= --unified=0 1ffad3f6

diff --git a/src/loopzero/cli.py b/src/loopzero/cli.py
remerge CONFLICT (content): Merge conflict in src/loopzero/cli.py
index 4860d556..bda79f20 100644
--- a/src/loopzero/cli.py
+++ b/src/loopzero/cli.py
@@ -1314 +1313,0 @@ def cmd_ready(args: argparse.Namespace) -> int:
-<<<<<<< 71cef5a3 (Reserve time for the initial ready observation)
@@ -1316,2 +1314,0 @@ def cmd_ready(args: argparse.Namespace) -> int:
-    pr, readiness = _pr_readiness(wt, config, workflow_wait=args.wait is not None)
-=======
@@ -1319 +1315,0 @@ def cmd_ready(args: argparse.Namespace) -> int:
->>>>>>> a6403fe4 (Reuse the PR reads that bracket hosted eligibility (#1766))

Focused tests passed (91). The size gate passed at 8188/8,250 source lines and 13,784/13,850 test lines, with zero test-line growth. Awaiting your verification and the owner-priority landing order.

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

The local size numbers above apply to this PR head. Main advanced to 3f60c7f9 during the refresh. The hosted check tested a clean merge with that newer main and measured 8,260/8,250 source lines (10 over) and 13,815/13,850 test lines. The PR still adds zero test lines against current main. This draft is waiting for source headroom as well as owner verification and the landing order.

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Lean verification of the conflict-only refresh (in place of a third review round): head 1ffad3f650b4c1744b975d6d772fe1d1764bdf9b keeps the approved commits unchanged (range-diff =) and adds one merge commit. I read the remerge diff: the resolution keeps both sides' intent and adds no behaviour change. Verified. This may land at exactly this head once the source cap has room (it is over by the hosted count) and its turn in the #575 landing order comes. Any further head change needs a new verification.

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #1812, which carries the verified net change from fresh main and has primary approval on its new head. Both review rounds on this PR were spent before the conflict-resolution merge.

@eowca eowca closed this Nov 26, 2026
mergify Bot pushed a commit that referenced this pull request Nov 26, 2026
Carry the verified net change from #1743.

Architecture-Review: unchanged; Keep the approved deadline accounting with main’s explicit branch lookup.

Architecture-Review: unchanged; ready and merge both account for observed read latency within the existing wait deadline.
Architecture-Review: unchanged; the final source observation uses its existing read deadline and preserves zero-wait behavior.

Co-authored-by: eowca <4008965+eowca@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Observe required checks near the end of a bounded source wait

1 participant