Skip to content

fix(review): an unparseable model reply can be printed as raw truncated JSON after "No issues found"; finish_reason=length makes reviews fail even at max_tokens 32768 #718

Closed

Description

@ajianaz

Cora version

0.20.0 (the review action pins the same version in CI)

Which command?

cora review --format pretty in CI (the review action / a workflow that posts stdout as a PR comment).

What happened?

Two related failures seen while reviewing about 60 pull requests:

  1. "Review could not complete" on large diffs. The log shows the provider returning empty content with finish_reason=length, cora retrying at max_tokens 8192, 16384 and 32768, and ending with an empty reply or a gateway timeout. The usual trigger is a diff of about 1,850 lines or more (below about 900 to 1,000 lines it works); a rerun often produces a verdict. The model is likely spending its token budget on reasoning tokens, so more max_tokens does not always help.
  2. Raw truncated JSON in the comment. In one run the comment printed "No issues found!" and then the start of a JSON document that begins mid-string and ends mid-sentence, with minor and info findings inside. The workflow redirects cora review --format pretty stdout to a file and posts it verbatim, and stderr goes to a separate file, so this text came from cora's own stdout: it looks like the tail of a truncated model reply that was not parsed.

What did you expect to happen?

  • A reply that cannot be parsed is dropped or repaired and reported as "reply truncated" with the finish reason, never printed as if it were output.
  • When finish_reason=length repeats, cora switches strategy instead of only raising max_tokens: split the diff into per-file or per-hunk batches (the scan path already batches) and merge the findings, and print the diff size and the cause in the verdict.
  • A documented option to disable reasoning for the review model, or to cap reasoning tokens.

Steps to reproduce

Run cora review on a branch whose diff is about 1,900 lines of Rust against an OpenAI-compatible endpoint serving a reasoning model, with --format pretty.

Logs / output

LLM returned empty content, finish_reason=length; retrying with max_tokens=16384
...
Review could not complete. LLM API error after retries

Config (if relevant)

CORA_MODEL is a reasoning-capable model behind an OpenAI-compatible gateway. Tracking issue with other CI observations: codecoradev/tole#670.

Before submitting

  • I searched existing issues and didn't find a duplicate

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:highscope:core

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions