Repository navigation
Keep malformed reviewer output in a private diagnostic file #1289
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
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 |
|---|---|---|
|
|
@@ -358,6 +358,35 @@ def expect_cli(capsys, exit_code, *argv, stdout=None, stderr=None, stdout_contai | |
| return out, err | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("save", [True, False]) | ||
|
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. important: Change pushes tests over the size-budget cap, so the shared gate fails scripts/size_budget.sh sets TESTS_CAP=13850. It fails when the test line count is over the cap and has grown against the base. The task notes say the merged head has 13,888 test lines, and this diff adds 37 test lines, so |
||
| def test_review_malformed_fragments_stay_out_of_terminal(wt, gh, fake_bin, monkeypatch, capsys, save): | ||
| prepare_review(wt, gh, fake_bin) | ||
| envelopes = {family: json.dumps({"unexpected": family * 700}) for family in ("claude", "codex")} | ||
|
|
||
| def malformed(family, *, head, kind, **kwargs): | ||
| raw = envelopes[family] | ||
| cli.runners.parse_review(json.loads(raw), family=family, head=head, kind=kind, raw=raw) | ||
|
|
||
| monkeypatch.setattr(cli.runners, "review_with", malformed) | ||
| if not save: | ||
| def fail(*args): | ||
| raise PermissionError("diagnostic write denied") | ||
| monkeypatch.setattr(cli, "_write_json_atomically", fail) | ||
| code, out, err = run(capsys, "review") | ||
| size = len((out + err).encode()) | ||
| assert size < 650, size | ||
| assert code == 4 and "rerun" in err and "wait for the owner" in err | ||
| for family in envelopes: | ||
| assert f"{family}: review has unexpected or missing keys" in err | ||
| assert family * 10 not in err | ||
| if save: | ||
| path = next((wt / ".loopzero").glob("reviewer-output-*.json")) | ||
| assert path.name in err and path.stat().st_mode & 0o777 == 0o600 | ||
| assert json.loads(path.read_text()) == {family: raw[-2000:] for family, raw in envelopes.items()} | ||
| else: | ||
| assert "diagnostic write denied" in err | ||
|
|
||
|
|
||
| # --- start / check -------------------------------------------------------------------- | ||
|
|
||
|
|
||
|
|
||
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: Codex runtime diagnostics reclassified as malformed lose their terminal line
codex: no final message writtenandcodex: execution output lacks session/token provenance(line 1090) carry the tail of codex stdout+stderr. That is the runtime event stream, not a rejected review message. These are now RunnerMalformedOutput, so_review_failurekeeps only the first line, and the stderr/event excerpt that was shown before is visible only in the private file. The task says runtime diagnostics keep their existing output. If codex exits 0 after a turn/stream failure, the operator loses the inline hint. Smallest fix: keep these two as plain RunnerBadOutput. Reserve RunnerMalformedOutput for payloads the model produced (parse_review, final message not JSON/UTF-8, claude result/envelope parsing).