Repository navigation
Report delegated runner outages as infrastructure failures #1752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -703,6 +703,39 @@ def test_check_sandbox_unavailable_exits_two(wt: Path, fake_tool, capsys) -> Non | |
| assert not (wt / ".loopzero" / "checks.json").exists() | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("prior_receipt", [False, True]) | ||
| def test_check_runner_outage_preserves_receipt(wt, gh, monkeypatch, capsys, prior_receipt): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: CLI test does not cover a validated failed stage keeping its receipt and publish behaviour The new CLI test checks only the outage path, with exit 75. The acceptance criteria also require that a validated failed-stage frame keeps its existing behaviour: it writes the receipt and reports FAIL. That path now runs through |
||
| if prior_receipt: | ||
| assert run(capsys, "check")[0] == 0 | ||
| receipt = wt / ".loopzero/checks.json" | ||
| previous = receipt.read_bytes() if prior_receipt else None | ||
| calls = list(gh.calls) | ||
| context = cli._context | ||
| script = """ | ||
| import json, sys | ||
| frame = json.load(sys.stdin) | ||
| if frame["command"] != "echo ok": | ||
| sys.exit(75) | ||
| del frame["env"] | ||
| print(json.dumps(dict(frame, exit_code=0, duration_s=0.0, tail="", not_started=False))) | ||
| """ | ||
|
|
||
| def with_runner(*args, **kwargs): | ||
| worktree, settings = context(*args, **kwargs) | ||
| return worktree, replace(settings, check_runner=(sys.executable, "-c", script), | ||
| inputs={"echo ok": ("feature.py",)}) | ||
|
|
||
| monkeypatch.setattr(cli, "_context", with_runner) | ||
|
|
||
| code, out, err = run(capsys, "check") | ||
|
|
||
| assert code == 2 | ||
| assert "process exit 75" in err and "Retry" in err | ||
| assert "PASS" not in out and "FAIL" not in out | ||
| assert (receipt.read_bytes() if receipt.exists() else None) == previous | ||
| assert gh.calls == calls | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("bootstrap", [False, True]) | ||
| def test_config_flag_overrides_root(wt: Path, tmp_path: Path, capsys, bootstrap) -> None: | ||
| if bootstrap: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Git probe timeouts are reported as runner timeouts
The
except _proc.ProcTimeouthandler wraps the whole_dispatch_onebody, so it also catches more than the runner's own timeout. It catches a timeout from the_gitcalls in_stage_unchangedat lines 622, 646 and 651. It also catches a timeout from the_gitcalls inside the nested local-fallbackrun_checks(lines 96–105 and 158–159). All of these are bounded byGIT_TIMEOUT, not the stage timeout. Each one now raisesSandboxUnavailable("Stage runner timed out after {timeout:g}s ..."), which names the wrong component and the wrong limit, for example "timed out after 3600s (60.00s elapsed)". The task scopes this path to an actual runner timeout. Exit 2 is still reasonable for a git timeout, so the misleading diagnostic is the only defect. The same overly broad catch existed before this change, but this change makes it user-facing as an infrastructure outage. Smallest fix: wrap only the_proc.run(argv, ...)call at line 639 intry/except _proc.ProcTimeout. Let any otherProcTimeoutpropagate, or convert it toSandboxUnavailablewith a git-specific message.