Skip to content

Reconcile eligibility dispatch after finding resolution - #1562

Closed
eowca wants to merge 28 commits into
mainfrom
lean178/1509-recover-eligibility-dispatch
Closed

eowca wants to merge 28 commits into
mainfrom
lean178/1509-recover-eligibility-dispatch

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Context and goal

After resolving a finding, look for a matching Actions run before retrying an ambiguous eligibility dispatch. Check the PR branch, head, and remaining findings before retrying.

Closes #1509. This draft depends on #1560.

Validation

Recorded for 97aafaa115bc

  • 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

Focused resolve replays passed. Live workflow-run visibility remains unverified. Source +32 lines, tests +0.


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

Review

  • primary, claude, 97aafaa, approve

eowca and others added 25 commits November 26, 2026 04:31
Architecture-Review: unchanged; remains fail-closed while trusted evidence is unavailable, with the same status context and publisher.
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; remains fail-closed while trusted evidence is unavailable, with the same status context and publisher.
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; evidence and publication failures remain distinguishable within the existing hosted trust boundary.
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; transient fetch diagnostics remain inside the existing isolated checkout.
Co-Authored-By: Codex <noreply@openai.com>
…e-observation-retry

# Conflicts:
#	src/loopzero/github.py
#	src/loopzero/hosted.py
#	tests/test_hosted.py
Architecture-Review: unchanged; only run display metadata and GitHub read-back change, with the same authenticated trigger, inputs and enforcement.
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; hosted eligibility still requires verified Git objects before accepting inherited evidence.
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; remains fail-closed while trusted evidence is unavailable, with the same status context and publisher.
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; evidence and publication failures remain distinguishable within the existing hosted trust boundary.
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; transient fetch diagnostics remain inside the existing isolated checkout.
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; hosted eligibility still requires verified Git objects before accepting inherited evidence.
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; the evidence outcome changes while the existing retry and wait behavior remains in force until #1502.
Co-Authored-By: Codex <noreply@openai.com>
…safe-observation-retry

# Conflicts:
#	src/loopzero/github.py
#	src/loopzero/hosted.py
#	tests/test_hosted.py
…ervation-retry

# Conflicts:
#	src/loopzero/github.py
#	tests/test_hosted.py
Co-Authored-By: Codex <noreply@openai.com>
@eowca
eowca changed the base branch from lean178/1502-safe-observation-retry to main November 26, 2026 07:40
eowca and others added 3 commits November 26, 2026 09:07
Architecture-Review: unchanged; scoped deadlines are still applied only to reads, and non-idempotent writes keep their original outcomes.
Co-Authored-By: Codex <noreply@openai.com>
…recover-eligibility-dispatch

# Conflicts:
#	src/loopzero/cli.py

@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 97aafaa115bca5685593f1f08bc11133613659dd, 54.0s: 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/github.py

def refresh_eligibility(repo: str, pr: PR, branch: str, base: str, publishers: tuple[str, ...]) -> None:
args = eligibility_dispatch_args(repo, pr.number, base)
since = datetime.fromtimestamp(time.time(), UTC).isoformat(timespec="seconds")

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: An empty run list after one 5 s wait still allows a duplicate dispatch

since comes from the local clock, and _eligibility_dispatched returns False whenever the filtered list is empty. That can be wrong in two cases: (a) the local clock runs ahead of GitHub's, so a run that was accepted has created_at < since and is filtered out; (b) GitHub creates the run asynchronously after the dispatch is accepted, and it can take longer than RETRY_DELAY during the same incident that caused the 5xx or timeout. Either way the code dispatches a second time. The run uses a non-cancelling concurrency group, so the duplicate is mostly harmless. Still, the acceptance asks that observations which cannot rule out an accepted refresh do not authorize another one. Smallest fix: move since back by a small skew margin (e.g. 30–60 s). Any extra runs this picks up are refreshes of the same PR, which count as success anyway. Also state in a comment that an empty list is treated as best-effort evidence.

Comment thread src/loopzero/github.py
try:
_gh(*args)
except (GhUnavailable, ProcTimeout) as exc:
if isinstance(exc, GhUnavailable) and not _transient_error(exc.tail, False):

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 transient check repeats _gh classification

_gh raises GhUnavailable only for a transient failure or a rate limit. Running _transient_error(exc.tail, False) again re-parses the tail text to tell those apart, and it ignores the HTTP status that _gh used. If a 5xx response has stderr without an HTTP 5xx line, it gets misclassified as non-transient. This also means two copies of the classification can drift apart. Prefer one signal: for example, have _gh raise a distinct rate-limit subclass, or check for rate limiting here directly, rather than re-deriving transience from the text.

Comment thread tests/test_cli.py
gh.respond("api -X", {"stdout": "", "exit": 1, "stderr": "HTTP 503" if transient else "HTTP 403"} if transient or outcome == "denied" else "", "")
monkeypatch.setattr(github, "_retry_sleep", backoffs.append)
runs = [] if outcome == "retry" else [{"display_title": "Refresh eligibility for PR #7" if outcome == "applied" else "unknown"}]
monkeypatch.setattr(github.time, "time", lambda: 1795640554)

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 patches the global time.time

monkeypatch.setattr(github.time, "time", ...) replaces time.time on the shared time module, not just in github. Every caller during the test sees the frozen value, including app-token aging, _rate_limit_delay and _graphql_reset. monkeypatch restores it afterwards, but this can hide clock-dependent behaviour inside the test. Freezing a module-level clock seam in github (like _retry_sleep) would keep the effect scoped.

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.

Recover eligibility dispatch after a successful finding resolution

1 participant