Skip to content

Refresh trusted review publishers before readiness - #1733

Closed
eowca wants to merge 2 commits into
mainfrom
lean178/1251-refresh-review-publishers
Closed

eowca wants to merge 2 commits into
mainfrom
lean178/1251-refresh-review-publishers

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Refresh trusted review publishers before readiness

Acceptance

  • Refresh the configured trusted base before the initial readiness or merge observation.
  • Reuse the trusted configuration loader and review selector, preserve explicit configuration and fail closed when the configured origin is unavailable.
  • Verify that a retired publisher stays pending in both paths and that its replacement is accepted.

Notes

The offline publisher rotation test compares both paths with green source checks and a stale local tracking ref. The test also covers the explicit configuration escape hatch. Delivery waits for test headroom.

Base

main @ c81807a

Validation

(no loopzero check run recorded)


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

Review

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 5c8d0e3a9cef984f390e6060fa8828512fd4d8dc, 39.3s: 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/config.py
cwd=worktree, env_allowlist=worktree_mod.GIT_ENV, timeout=60,
)
if fetched.exit_code != 0:
raise ConfigError(f"could not refresh origin/{branch}. {hint}")

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: Refresh failure drops git's diagnostic

If git fetch fails, the only error is could not refresh origin/<branch>, followed by a hint to "Fetch the trusted base workflow". The hint isn't useful because the fetch is what just failed. The user can't tell an authentication failure from a network failure, a missing branch or a bad remote URL. base_revision in the same module already appends _proc.tail(done.stderr or done.stdout, 1). Do the same here (e.g. could not refresh origin/{branch}: {tail}) so a fail-closed ready/merge can be acted on. Fail-closed behaviour is unchanged.

Comment thread src/loopzero/cli.py
wt = _toplevel()
return wt, _load_config(args, wt, pin_checks=pin_checks)
return wt, _load_config(
args, wt, pin_checks=pin_checks, refresh=args.command in {"ready", "merge"},

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: merge --cancel now needs network access to origin

_context now refreshes for every merge invocation, including merge --cancel. --cancel only uses config.repo and merge_strategy to dequeue from Mergify. As a result, an unreachable origin, or credentials that can't fetch, now block cancelling a queued PR, even though the publisher policy plays no part in a dequeue. If that wasn't intended, skip the refresh when args.cancel is set, e.g. refresh=args.command == "ready" or (args.command == "merge" and not args.cancel).

Comment thread tests/test_cli.py

@pytest.mark.parametrize("publisher,expected", [
("retired-publisher", "pending"), ("replacement-publisher", "success"),
])

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: Publisher rotation test only covers ready, not merge

Both commands refresh, but the rotation test only runs ready. For merge, the only evidence is the one-fetch count in test_wait_for_github_mergeability, which doesn't show that a retired publisher is rejected. Parametrizing the new test over ready and merge would cover both commands that refresh. For merge, assert a non-zero exit with the missing-review reason on the retired case. It is cheap and guards against _context being refactored so that only ready refreshes.

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

waits for test headroom

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 1e737f6470f5b55bc79a278d2ecd4e2e42607f5b, 12.3s: 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

Superseded by #1751, which retains this implementation and reduces the test diff to 15 lines. The changed test proof needs a fresh review after both rounds were used here.

@eowca eowca closed this Nov 26, 2026
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.

1 participant