Skip to content

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

Merged
mergify[bot] merged 2 commits into
mainfrom
lean178/1303-source-deadline-r53
Nov 26, 2026
Merged

mergify[bot] merged 2 commits into
mainfrom
lean178/1303-source-deadline-r53

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. This replaces Observe passing source checks closer to the wait deadline #1743. Owner verification.

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: bb2aae1

Validation

Recorded for be8c63cc9f7c

  • 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

Carry the verified net change from #1743.

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

@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 78fadc53374c7f8c87dea4194ef4ab789c9d6173, 76.1s: approve (0 critical, 0 important, 3 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)

Findings without a file location:

  • suggestion: Re-entry after the in-wait ready transition drops the read latency measured so far — _wait_for_checks calls itself at line 1566 after mark_ready, but does not pass initial_read_time. The new _poll_until generator therefore starts with longest_read=0. Any slow reads the parent loop already measured, including the initial _pr_readiness latency, are lost. The first real read in the child generator partly makes up for this. However, if that read is fast and an earlier one was slow, the final poll reserves only baseline instead of 2*longest_read, so it is more likely to hit ReadDeadline instead of reading a passing check. Smallest fix: forward initial_read_time=initial_read_time in the recursive call. Better: have the caller track the max observed read time and pass that, so the late-poll reserve stays consistent across the transition. This is the only other place in the diff where a wait starts without the latency already measured. The ready, ready-after-mark and merge entry points all forward it.

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

Comment thread src/loopzero/cli.py
# Poll late enough to see a settled check while reserving time to read it.
baseline = min(5.0, max(0.5, remaining / 10))
allowance = min(remaining / 2, max(baseline, 2 * longest_read))
_sleep(remaining - allowance)

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: Late source poll shrinks the time merge has left for Mergify/merge admission

In merge --wait, the source wait and admission share one deadline (admit_by = deadline). The last source read now happens at deadline - allowance, where allowance can be as small as 0.5s (max(0.5, remaining/10), or 2*longest_read). That applies even when the check passed well before the old midpoint. Before, such a check was seen at the midpoint and admission had about half the final interval. Now the markers/membership/merged_sha reads and the admit_by check in _merge_with_mergify (lines 1755-1775), or the github.merge gate at line 1837, often have only seconds left. This can turn a green check into timed out before requesting Mergify (exit 3). Recovery works (rerun), so this is not blocking. Consider reserving admission time in the merge path, or documenting the trade-off in the comment at line 1459.

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-line budget met by reformatting, not by tightening coverage

The 'without increasing test lines' target is met partly by joining a 3-line signature into one line of about 112 chars (line-length = 100 in pyproject, though E501 is not selected). It also deletes the blank line before the nested def slow_check (line 3376). cli.py:1491 likewise now runs past 100 columns. None of this fails lint, but it is formatting churn traded for a line count. Prefer wrapping the long _wait_with_deadline call in cli.py, and keep the test formatting as it was.

Architecture-Review: unchanged; pass the observed initial read time through main’s shared wait call.
Co-Authored-By: Codex <noreply@openai.com>
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Main #1611 introduced one conflict in _wait_with_deadline. The resolution adds no behavior change: main’s shared call remains, with the approved initial read time passed to the bounded wait.

git range-diff --no-color --diff-merges=remerge 78fadc53^..78fadc53 a8c662a5..be8c63cc

1:  78fadc53 = 1:  78fadc53 Poll source checks closer to the wait deadline
-:  -------- > 2:  be8c63cc Merge main and retain the approved wait accounting

The remerge resolution is one line: waited = wait(bounded=True, initial_read_time=initial_read_time). All 91 focused tests passed. The size gate passed at 8,195/8,250 source lines and 13,799/13,850 test lines, zero net test lines. Please verify the conflict-only refresh at be8c63cc9f7cdba6a67dc0c21bf71d9f269a9f16. Delta review has been started separately.

@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 be8c63cc9f7cdba6a67dc0c21bf71d9f269a9f16, 9.0s: approve (0 critical, 0 important, 0 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.

@eowca
eowca marked this pull request as ready for review November 26, 2026 11:03
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as 5cfb9c2 at 11:08 UTC

5 min in the queue, 4 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 11:03 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1828
  • ✅ Merged 11:08 · 5cfb9c2 · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit 5cfb9c2 into main Nov 26, 2026
16 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/1303-source-deadline-r53 branch November 26, 2026 11:09
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