Skip to content

Keep malformed reviewer output in a private diagnostic file - #1289

Closed
eowca wants to merge 3 commits into
mainfrom
lean178/1087-review-fragments
Closed

eowca wants to merge 3 commits into
mainfrom
lean178/1087-review-fragments

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Keep malformed reviewer output in a private diagnostic file

Context and goal

  • Goal: Keep reviewer names, parser errors, and rerun guidance visible when both reviewers fail.
  • Problem: A malformed one-line result can add 2,000 characters per reviewer to the terminal summary.
  • Context: Malformed fragments go in a bounded, private file under the task worktree. Runtime, login, quota, and installation diagnostics keep their existing output.

Closes #1087

Acceptance

  • Two malformed results return exit 4 and emit fewer than 650 UTF-8 bytes. The terminal shows the parser errors, guidance, and diagnostic path.
  • The private diagnostic file contains bounded excerpts of the rejected messages. A write failure is reported alongside the reviewer error.
  • Codex schema failures retain the rejected final message. Runtime timeouts retain the existing diagnostic.

Transcript size

Scenario Before After
Combined stdout and stderr, two malformed results 4,527 bytes 554 bytes

The baseline is 234ac2e0. Focused CLI and runner tests passed, including an unwritable diagnostic and the native Codex fixture with malformed review JSON.

Notes

Base

Base: aa563c2

Validation

(no loopzero check run recorded)


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

Review

  • primary, claude, bbcb945, request_changes

Refs #1087

Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; keeps the upstream Claude payload parser and the private bounded diagnostic

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 bbcb945ebedb962f5ac5caba6a2f821272e1fe17, 41.8s: request_changes (0 critical, 1 important, 2 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 tests/test_cli.py
return code, captured.out, captured.err


@pytest.mark.parametrize("save", [True, 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.

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 loopzero check/CI fails on this branch. The size-budget check is part of acceptance, so this cannot merge as is. Smallest fix: make the new tests shorter. For example, drop the parametrized save split into one test with two compact assertions. Or fold test_codex_schema_error_keeps_the_rejected_message into the existing strict-schema test. Do not raise the cap without a justification.

Comment thread src/loopzero/runners.py
provenance, raw = _codex_provenance(done.stdout, done.stderr, message, home=home)
if not message.strip():
raise RunnerBadOutput("codex: no final message written", _tail(done.stdout + done.stderr))
raise RunnerMalformedOutput("codex: no final message written", _tail(done.stdout + done.stderr))

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: Codex runtime diagnostics reclassified as malformed lose their terminal line

codex: no final message written and codex: 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_failure keeps 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).

Comment thread src/loopzero/cli.py Outdated
return ""
path = wt / ".loopzero" / f"reviewer-output-{head[:12]}-{kind}.json"
try:
path.parent.mkdir(parents=True, exist_ok=True, mode=0o700)

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: Diagnostic writer skips the directory hardening that _save_review applies

mkdir(mode=0o700, exist_ok=True) leaves an existing .loopzero/ with its current permissions. _save_review (cli.py:1115-1121) also calls path.parent.chmod(0o700) and refuses a symlinked target. The file itself is created 0o600 by NamedTemporaryFile, so the exposure is small. Still, the two writers to the same private directory now disagree on how they protect it. Smallest fix: move the mkdir+chmod into a shared helper and call it from both _save_review and _save_review_failure_output.

Architecture-Review: unchanged; the existing delivery structure and command roles still apply.
Co-Authored-By: Codex <noreply@openai.com>
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #1749. Loop Zero cannot delta-review the conflict-resolution merge (#1240), so the same reviewer-output fix will get a primary review on current main.

@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.

Keep malformed reviewer payloads out of the terminal failure summary

1 participant