Skip to content

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

Merged
mergify[bot] merged 3 commits into
mainfrom
lean178/1087-review-output-r50
Nov 26, 2026
Merged

mergify[bot] merged 3 commits into
mainfrom
lean178/1087-review-output-r50

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

Replaces #1289.

Validation

Recorded for ff1d23d7e7b6

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

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

Review

  • primary, claude, 3d56147, request_changes
  • delta, claude, ff1d23d, approve

Architecture-Review: unchanged; the command data flow and delivery roles still apply.
Co-Authored-By: Codex <noreply@openai.com>
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 3d561478ec231897aa8ed20c4658409e75b545c4, 50.7s: 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)

Findings without a file location:

  • suggestion: Claude schema failures save the envelope tail, not the rejected result — Codex now passes excerpt=message, but Claude still calls parse_review(..., raw=raw). For Claude the diagnostic is the last 2000 characters of the whole result envelope. The envelope ends with usage, modelUsage and cost metadata, so the saved excerpt may hold little or none of the rejected review. To make the file useful for both reviewers, pass the decoded result text (e.g. str(envelope.get('result', '')), or the structured output) as excerpt.

Native Claude output is retained in the restricted local review receipt.

Comment thread src/loopzero/cli.py Resolved
Comment thread src/loopzero/runners.py Outdated
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: Reclassifying runtime-output failures as malformed moves their runtime diagnostics off the terminal

codex: no final message written (line 1280) and codex: execution output lacks session/token provenance (line 1087) now raise RunnerMalformedOutput. Their tail is Codex stdout+stderr, which is runtime output such as stream or API errors on an exit-0 run. It is not a rejected review payload. With this change _review_failure cuts these to one line, and their stderr tail goes only to the private file. The task says runtime diagnostics should keep their existing output. Consider keeping these two as plain RunnerBadOutput, and limiting RunnerMalformedOutput to cases where the tail is the model's payload: not JSON, schema failures, and not UTF-8.

Architecture-Review: unchanged; cleanup still permits only task-owned artifacts and refuses symlinks.
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 ff1d23d7e7b6885a6071e63f86b48836d4f5417b, 21.0s: approve (0 critical, 0 important, 1 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/runners.py
payload = _claude_payload(envelope)
except (json.JSONDecodeError, ValueError) as exc:
raise RunnerBadOutput("claude: result text is not JSON", _tail(raw)) from exc
raise RunnerMalformedOutput("claude: result text is not JSON", _tail(str(envelope.get("result", "")))) from exc

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: No tests cover the reclassified Claude/Codex errors or the narrowed Claude excerpt

This delta makes three behaviour changes that no test checks. (1) Missing Claude/Codex provenance and an empty Codex final message now raise RunnerBadOutput instead of RunnerMalformedOutput. That changes cli.py:1098/1124: the terminal now shows three lines including the tail, and no fragment is saved to the diagnostic file. (2) 'claude: result text is not JSON' now uses the envelope's result text instead of the whole stdout. (3) Claude schema failures now pass excerpt=json.dumps(payload). A search of tests/ finds none of these messages, so a regression that puts the provenance failures back into the malformed bucket (or the reverse) would go unnoticed. Smallest fix: add one parametrized runner test that checks the exception type and .tail for each of these four raise sites, plus a Claude schema-failure test that checks the payload excerpt is saved.

@eowca
eowca marked this pull request as ready for review November 26, 2026 09:50
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as ec7a26f at 09:55 UTC

5 min in the queue, 4 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 09:50 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1785
  • ✅ Merged 09:55 · ec7a26f · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit ec7a26f into main Nov 26, 2026
17 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/1087-review-output-r50 branch November 26, 2026 09:55
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