Skip to content

Compare readiness using GitHub timestamps - #1841

Merged
mergify[bot] merged 3 commits into
mainfrom
lean178/1158-readiness-timestamps-v2
Nov 26, 2026
Merged

mergify[bot] merged 3 commits into
mainfrom
lean178/1158-readiness-timestamps-v2

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Compare readiness using GitHub timestamps

Context and goal

  • Context: Required checks must pass before readiness succeeds. Review freshness bounds the wait for a replacement verdict.
  • Problem: Lexical timestamp comparisons and host-clock offsets can end the wait early or misclassify a newer failure.
  • Goal: Compare offset-aware instants, preserve fractional precision, and use a valid GitHub response Date for review age.

Closes #1158
Closes #1159

Replaces #1583 after its conflict with current main. The two blocking findings are addressed by rejecting malformed HTTP Dates and preserving the sub-microsecond remainder of check and review timestamps.

Acceptance

  • Accept UTC, fractional UTC and explicit offsets. Equal or later failures stay blocking.
  • Reject missing, malformed and naive values as evidence of freshness.
  • Run the same wait across host offsets when GitHub supplies a valid Date. Preserve the bounded fallback and require passing checks.

Validation

Recorded for 5239a3e64e32

  • 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

Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; readiness still relies on GitHub evidence and its existing check gates.

@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 ea129f83d3822317bfd277834f4385eab004bb58, 48.4s: 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)

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

Comment thread src/loopzero/cli.py
if reviews is None:
reviews = _pr_reviews(config.repo, pr.number)
dates: list[str] = []
reviews = (_pr_reviews(config.repo, pr.number, **({"dates": dates} if workflow_wait else {}))

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: Response Date reaches the caller through untyped kwargs and an output list

To get the HTTP Date to _readiness, the change adds **kwargs to _rest_rows, _pr_reviews, api_get and _gh_json, and adds a dates output list to _gh. _readiness then builds the call with **({"dates": dates} if workflow_wait else {}). Type checking can no longer see these keyword arguments, so a misspelled keyword would only fail at runtime inside _gh. Every page also overwrites the list as a side effect. The behaviour is correct today. A smaller fix: give _rest_rows, _pr_reviews, api_get and _gh_json an explicit dates: list[str] \| None = None parameter and pass dates=dates unconditionally. Collecting the Date outside waits costs nothing, so the conditional dict-splat can go.

Comment thread src/loopzero/github.py
}
for name, cr in latest_runs.items():
state = cr.get("conclusion") or cr.get("status") or "unknown"
timestamp = cr.get("started_at" if state in _PENDING_CHECKS else "completed_at")

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: A completed run without completed_at no longer falls back to started_at

Before this change the timestamp was completed_at or started_at. Now a completed or failed run reads only completed_at, and a missing value becomes None. A failure with no completed_at is therefore never treated as stale, so the wait stops instead of waiting. That is the conservative choice and fits the rule that missing values are not evidence of freshness. Still, it is a behaviour change that no test covers. Add a test row for it, or a short comment saying the stricter rule is deliberate.

Comment thread src/loopzero/github.py


ReadinessTimestamp = tuple[datetime, str]

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: ReadinessTimestamp's string part needs a comment

ReadinessTimestamp pairs a datetime with a string holding the fractional digits beyond microseconds, with trailing zeros removed. Comparing the tuples is correct only because those strings are compared character by character as decimal fractions that start at the same digit. That depends on removing the trailing zeros and on the datetime part being in UTC. Add a one-line docstring on readiness_timestamp explaining this, so a later change, such as comparing only the datetime or dropping the zero removal, does not break the sub-microsecond ordering without anyone noticing.

Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; conflict resolution only combines readiness test cases.

@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 746bbbd43b54c34dc949e9487e7247b7969b5a2b, 9.7s: 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 tests/test_cli.py
(False, True), (True, True), (False, "tie"), (False, "missing"),
)),
(False, 300, False, False, 1, False),
*[(False, 180, failure, True, 1, False) for failure in

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: Merged parametrize rows mix generator and list splats

The merge kept main's rows, which splat generators (*(... for ...)), and appended the branch's rows, which splat lists (*[... for ...]). Both forms produce the same cases. The resolution loses no case and leaves no conflict markers: every age and failure variant from either side is present. Mixing the two styles inside one parametrize list is only cosmetic. Pick one style for lines 2934-2939 if you touch them again.

@eowca
eowca marked this pull request as ready for review November 26, 2026 11:55
@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

🚫 Left the queue · conflict with base branch

5 min in the queue, with no time running CI.

So far

Reason

The pull request conflicts with main

Conflicting files: docs/ARCHITECTURE.md, src/loopzero/cli.py

Before this, the pull request was held in the queue behind 3 pull requests ahead of it.

To get back in the queue

  • You should update or rebase your pull request. A pull request in a stack is updated by rebasing the stack onto the branch it conflicts with. A pull request queued by a rule comes back to the queue once updated, as long as the rule still matches.
  • If it was queued with a command, update it, then comment @mergifyio queue to queue it again.

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 26, 2026
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify mergify Bot added dequeued and removed queued labels Nov 26, 2026
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; the receipt precheck and timestamp fixes keep their existing 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 delta review by claude on 5239a3e64e32bcf4aeb1e0fbe83117fb7d284943, 10.5s: 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 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 47180d3 at 12:18 UTC

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

So far

  • ✅ Entered the queue Thu 26 Nov, 12:13 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1873
  • ✅ Merged 12:18 · 47180d3 · 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 47180d3 into main Nov 26, 2026
18 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/1158-readiness-timestamps-v2 branch November 26, 2026 12:19
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.

Use GitHub server time for review freshness during readiness waits Parse and compare GitHub readiness timestamps as UTC instants

1 participant