From 8a3ee0580d5f3660c23e9c4a55e832e950b960fe Mon Sep 17 00:00:00 2001 From: eowca <4008965+eowca@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:16:52 +0100 Subject: [PATCH 1/3] Print source wait resume commands Architecture-Review: unchanged; source waits keep their existing deadline and exit code. Co-Authored-By: Codex --- src/loopzero/cli.py | 20 +++++++++++--------- tests/test_cli.py | 14 +++++++------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/loopzero/cli.py b/src/loopzero/cli.py index 48a64159..9e007ab0 100644 --- a/src/loopzero/cli.py +++ b/src/loopzero/cli.py @@ -1288,7 +1288,7 @@ def _wait_with_deadline( allow_skipped=allow_skipped, initial=initial) deadline = started + timeout if time.monotonic() >= deadline: - _print_check_wait_timeout(pr) + _print_check_wait_timeout(pr, args) return None reported_timeout = False try: @@ -1299,17 +1299,19 @@ def _wait_with_deadline( reported_timeout = waited is None except github.ReadDeadline: if not reported_timeout: - _print_check_wait_timeout(pr) + _print_check_wait_timeout(pr, args) return None return waited -def _print_check_wait_timeout(pr: github.PR) -> None: - if pr.mergeable == "UNKNOWN": - print(f"timed out waiting for GitHub to compute mergeability on {pr.head_sha[:12]}") - else: - print(f"timed out waiting for required checks on {pr.head_sha[:12]}") - +def _print_check_wait_timeout(pr: github.PR, args: argparse.Namespace | None) -> None: + waiting_for = "GitHub to compute mergeability" if pr.mergeable == "UNKNOWN" else "required checks" + command = args.command if args else "ready" + keep_config = " Keep the same `--config` option." if args and args.config else "" + print( + f"timed out waiting for {waiting_for} on {pr.head_sha[:12]}. " + f"Run `loopzero {command} --wait` to resume on this head.{keep_config}" + ) def _verify_wait_snapshot( args: argparse.Namespace | None, wt: Path, config: Config, head: str, current_head: str, @@ -1386,7 +1388,7 @@ def _wait_for_checks( f"triggers and permissions for head {pr.head_sha[:12]}; after correcting the cause, " "rerun the same `--wait` command" ) - _print_check_wait_timeout(current) + _print_check_wait_timeout(current, args) return None diff --git a/tests/test_cli.py b/tests/test_cli.py index c09d043c..a8cb9119 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -2592,7 +2592,7 @@ def test_wait_for_github_mergeability(wt, gh, capsys, monkeypatch, command, sett if settled == "CONFLICTING": assert code == 1 and "has merge conflicts" in out + err elif settled == "UNKNOWN": - assert code == 3 and "timed out waiting for GitHub to compute mergeability" in out + assert code == 3 and out.endswith(f"timed out waiting for GitHub to compute mergeability on {head[:12]}. Run `loopzero {command} --wait` to resume on this head.\n") else: assert code == (0 if command == "ready" else 3) assert requests == ([(REPO, 7, head, "main")] @@ -2683,12 +2683,12 @@ def sleep(seconds): clock += seconds monkeypatch.setattr(cli, "_sleep", sleep) - code, out, err = run(capsys, "ready", f"--wait={wait}") + code, out, err = run(capsys, "--config", "workflow.toml", "ready", f"--wait={wait}") assert (code, err) == (expected, "") assert out.endswith({ 0: f"ready: {URL}\n", 1: "not ready: required check 'checks' is failure\n", - 3: f"timed out waiting for required checks on {head[:12]}\n", + 3: f"timed out waiting for required checks on {head[:12]}. Run `loopzero ready --wait` to resume on this head. Keep the same `--config` option.\n", }[expected]) @@ -2773,7 +2773,7 @@ def advance(seconds): [30.0, 5.0] if initial_pending else [30.0]) assert out.endswith(f"ready: {URL}\n" if expected == 0 else "not ready: required check 'checks' is failure\n" if expected == 1 else - f"timed out waiting for required checks on {head[:12]}\n") + f"timed out waiting for required checks on {head[:12]}. Run `loopzero ready --wait` to resume on this head.\n") assert sum(c["argv"][:2] == ["pr", "ready"] for c in gh.calls) == 1 @@ -2854,7 +2854,7 @@ def advance(seconds): assert marked_at == [210.0] assert sleeps == [30.0, 60.0, 120.0, 30.0] + ([] if run_appears else [30.0, 30.0]) assert out.endswith(f"ready: {URL}\n" if run_appears else - f"timed out waiting for required checks on {head[:12]}\n") + f"timed out waiting for required checks on {head[:12]}. Run `loopzero ready --wait` to resume on this head.\n") assert sum(c["argv"][:2] == ["pr", "ready"] for c in gh.calls) == 1 @@ -3363,7 +3363,7 @@ def test_merge_wait_times_out_on_pending_checks_with_exit_three( code, out, err = run(capsys, "merge", "--wait=0") assert (code, err) == (3, "") - assert f"timed out waiting for required checks on {head[:12]}" in out + assert f"timed out waiting for required checks on {head[:12]}. Run `loopzero merge --wait` to resume on this head." in out assert wt.exists() and all(c["argv"][:2] != ["pr", "merge"] for c in gh.calls) @@ -3392,7 +3392,7 @@ def slow_check(argv, *, timeout, **kwargs): assert (code, err) == (3, "") assert budgets == pytest.approx([8.0]) - assert f"timed out waiting for required checks on {head[:12]}" in out + assert f"timed out waiting for required checks on {head[:12]}. Run `loopzero merge --wait` to resume on this head." in out assert all(c["argv"][:2] != ["pr", "merge"] for c in gh.calls) From edb180f4ffbc99dbedef72b2a078acdd569e5dd4 Mon Sep 17 00:00:00 2001 From: eowca <4008965+eowca@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:19:19 +0100 Subject: [PATCH 2/3] Quote the explicit configuration in the resume command Architecture-Review: unchanged; this changes the displayed command only. Co-Authored-By: Codex --- src/loopzero/cli.py | 7 ++++--- tests/test_cli.py | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/loopzero/cli.py b/src/loopzero/cli.py index 9e007ab0..8cf4f391 100644 --- a/src/loopzero/cli.py +++ b/src/loopzero/cli.py @@ -1306,11 +1306,12 @@ def _wait_with_deadline( def _print_check_wait_timeout(pr: github.PR, args: argparse.Namespace | None) -> None: waiting_for = "GitHub to compute mergeability" if pr.mergeable == "UNKNOWN" else "required checks" - command = args.command if args else "ready" - keep_config = " Keep the same `--config` option." if args and args.config else "" + command = ["loopzero", args.command if args else "ready", "--wait"] + if args and args.config: + command[1:1] = ["--config", str(args.config)] print( f"timed out waiting for {waiting_for} on {pr.head_sha[:12]}. " - f"Run `loopzero {command} --wait` to resume on this head.{keep_config}" + f"Run `{shlex.join(command)}` to resume on this head." ) def _verify_wait_snapshot( diff --git a/tests/test_cli.py b/tests/test_cli.py index a8cb9119..d4a3ecf7 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -2683,12 +2683,12 @@ def sleep(seconds): clock += seconds monkeypatch.setattr(cli, "_sleep", sleep) - code, out, err = run(capsys, "--config", "workflow.toml", "ready", f"--wait={wait}") - + (wt / "retry config.toml").write_bytes((wt / "workflow.toml").read_bytes()) + code, out, err = run(capsys, "--config", "retry config.toml", "ready", f"--wait={wait}") assert (code, err) == (expected, "") assert out.endswith({ 0: f"ready: {URL}\n", 1: "not ready: required check 'checks' is failure\n", - 3: f"timed out waiting for required checks on {head[:12]}. Run `loopzero ready --wait` to resume on this head. Keep the same `--config` option.\n", + 3: f"timed out waiting for required checks on {head[:12]}. Run `loopzero --config 'retry config.toml' ready --wait` to resume on this head.\n", }[expected]) From 6f9719fda24ed3e721b394230fde61816ef5cd9b Mon Sep 17 00:00:00 2001 From: eowca <4008965+eowca@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:23:06 +0100 Subject: [PATCH 3/3] Keep dash-prefixed config values usable in retry commands Architecture-Review: unchanged; the command is displayed only. Co-Authored-By: Codex --- src/loopzero/cli.py | 2 +- tests/test_cli.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/loopzero/cli.py b/src/loopzero/cli.py index 8cf4f391..62673b30 100644 --- a/src/loopzero/cli.py +++ b/src/loopzero/cli.py @@ -1308,7 +1308,7 @@ def _print_check_wait_timeout(pr: github.PR, args: argparse.Namespace | None) -> waiting_for = "GitHub to compute mergeability" if pr.mergeable == "UNKNOWN" else "required checks" command = ["loopzero", args.command if args else "ready", "--wait"] if args and args.config: - command[1:1] = ["--config", str(args.config)] + command.insert(1, f"--config={args.config}") print( f"timed out waiting for {waiting_for} on {pr.head_sha[:12]}. " f"Run `{shlex.join(command)}` to resume on this head." diff --git a/tests/test_cli.py b/tests/test_cli.py index d4a3ecf7..951dd730 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -2683,12 +2683,12 @@ def sleep(seconds): clock += seconds monkeypatch.setattr(cli, "_sleep", sleep) - (wt / "retry config.toml").write_bytes((wt / "workflow.toml").read_bytes()) - code, out, err = run(capsys, "--config", "retry config.toml", "ready", f"--wait={wait}") + (wt / "-retry config.toml").write_bytes((wt / "workflow.toml").read_bytes()) + code, out, err = run(capsys, "--config", "./-retry config.toml", "ready", f"--wait={wait}") assert (code, err) == (expected, "") assert out.endswith({ 0: f"ready: {URL}\n", 1: "not ready: required check 'checks' is failure\n", - 3: f"timed out waiting for required checks on {head[:12]}. Run `loopzero --config 'retry config.toml' ready --wait` to resume on this head.\n", + 3: f"timed out waiting for required checks on {head[:12]}. Run `loopzero '--config=-retry config.toml' ready --wait` to resume on this head.\n", }[expected])