Skip to content

fix(review): consume leftover path:start-end receipts - #996

Closed
seonghobae wants to merge 33 commits into
mainfrom
fix/inline-comment-leftover-range-receipts
Closed

fix(review): consume leftover path:start-end receipts#996
seonghobae wants to merge 33 commits into
mainfrom
fix/inline-comment-leftover-range-receipts

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

--leftover-diff-locations only parsed leftover path:line rows. A leftover cannot-provide written as example.py:5-7 was dropped, so applyable interiors such as example.py:6 stayed listed as one-click applies next to a Manual-edit for the same span.

This increment is the leftover-receipt consumer: leftover path:start-end covers every interior line, the overview omits overlapping applyable rows, leftover comments with start_line write path:start-end, and leftover heading lists example.py:5-7 once.

Verification

  • test_leftover_start_end_receipt_omits_interior_applyable_ranges parses leftover example.py:5-7, drops applyable example.py:6 and example.py:5-7, keeps ok.py:4, and pins leftover write of start_line=5/line=7.
  • coverage run -m pytest tests && coverage report --show-missing twice at 100% (1027 passed, scripts/ci 100% statement/branch), then interrogate 100%.

@cwl-noema-review

When GitHub refuses inline review comments, the PR-level fallback now
lists each sanitized current-head finding location instead of a generic
sentence. Suggested diffs stay out of the body.
Rebuild the fallback from gh api stderr after a refused attach so the
OpenCode overview keeps each trusted path:line next to the GitHub 422
phrase instead of a location-only list.
A single invalid path:line 422s the whole comments array. After that
failure, split the payload and retry each comment so surviving hunks
still attach; remaining failures keep the overview receipts.
The publisher moved that phrase out of the workflow YAML, so the
exact-head path-policy harness failed looking in the old file.
When some one-at-a-time inline comments attach and others 422, the
overview must list only the refused locations so attached hunks are
not reported as failed.
Mixed one-at-a-time retries can fail for different reasons. Record
path:line plus that comment's gh api error so the overview does not
reuse one shared sentence for every refused hunk.
Unbounded one-at-a-time retry after a batch 422 can thrash GitHub,
and mixed receipts listed only refused locations. Cap retries at 20,
persist attached path:line beside refused ones, and record leftovers
the cap left untried so the overview shows every outcome.
GitHub 422s review comments that sit outside every current-head @@ hunk.
Filter the payload against git diff --unified=3 first, post only the
on-hunk comments, and persist skipped path:line as overview receipts.
Authors could not one-click apply OpenCode inline repairs because the
payload only posted ```diff fences. Convert + lines from those diffs
into ```suggestion blocks on surviving RIGHT-side hunk comments.
A surviving suggested_diff that removes more than one current-head line
still posted as a single-line comment, so Apply suggestion only replaced
the first line. Set start_line, line, and start_side when the full span
sits on the same hunk; leave off-hunk spans single-line to avoid 422.
Authors could see refused and skipped path:line after a 422, but not
which surviving hunks shipped as one-click GitHub suggestions. Persist
path:line or path:start-end for comments that carry a suggestion fence.
Overview receipts listed applyable path:start-end ranges, but authors
could not tell leftover ```diff fences (cannot-provide / LEFT) from
one-click GitHub suggestions. Persist those leftover path:line reasons
in a separate overview section.
Leftover cannot-provide and LEFT fences now keep a bounded excerpt in
overview receipts as a distinct non-applyable ```diff block so authors
can copy the replacement by hand without treating it as a GitHub
suggestion range.
When a leftover LEFT suggested-diff still has an extractable
replacement and the same path has a current-head RIGHT hunk, move the
comment onto that hunk so GitHub can apply it. Pure deletions and
cannot-provide fences stay leftover manual-edit blocks.
When a leftover LEFT comment cannot stay on the same RIGHT line, attach
it to the first RIGHT line of that @@ hunk instead of the first RIGHT
line of the whole path. Multi-hunk files no longer land on an earlier
hunk. Pure-deletion hunks stay leftover.
Overview applyable receipts now show path:right came from LEFT
path:left when a leftover comment was remapped onto a RIGHT hunk.
Local origin keys are stripped before the GitHub POST.
One-at-a-time retry after a batch 422 now copies start_line and
start_side so a remapped leftover that spans a multi-line RIGHT hunk
still posts as one GitHub suggestion.
Comments past the 20-comment 422 retry cap are not posted as GitHub
suggestions. Deferred overview rows now keep path:start-end and the
LEFT origin, and those ranges are removed from the applyable heading.
A cannot-provide or pure-deletion leftover past the 20-comment retry
cap still shows the Manual-edit ```diff block and the deferred
range/origin row. Those fences stay off the applyable suggestion list.
When leftover and deferred share a path:line, the leftover heading
prints the deferred range/origin first, then the Manual-edit excerpt.
Deferred leftovers also appear before leftovers that were already posted.
When leftover heading already prefixes a deferred range/origin for the
same path:line, skip the duplicate cannot-provide/LEFT reason bullet so
authors see one deferred line then the Manual-edit excerpt.
When a leftover line sits inside a deferred multi-line path:start-end,
prefix the deferred range and keep the Manual-edit excerpt immediately
after it instead of repeating path:line — reason.
When several leftover lines sit inside the same deferred path:start-end,
prefix that range once and keep each Manual-edit excerpt under it.
When a leftover line sits inside a trusted deferred multi-line
path:start-end but is not itself a trusted finding,
_trusted_receipt_subset used to drop the Manual-edit excerpt.
Keep that excerpt under the deferred range and still drop
untrusted-path leftovers.
When leftover-diff-locations sits inside a trusted deferred path:start-end
but that leftover line is not a trusted control finding, the overview CLI
still keeps the Manual-edit excerpt under the deferred range.
GitHub cannot apply a suggestion on the deleted LEFT side, so leftover
LEFT fences must stay off the applyable overview. Darwin hosts now mock
the linux x86_64 trusted-uv runner for installer verification.
When a leftover cannot-provide or LEFT line sits inside path:start-end,
drop that range from the applyable overview so authors see Manual-edit
instead of a one-click apply for the same span.
The overview CLI now drops applyable path:start-end rows that contain a
leftover cannot-provide or LEFT line so authors see Manual-edit only.
write_hunk_filtered_payload now drops applyable path:start-end rows that
contain a leftover cannot-provide or LEFT line so applyable.txt cannot
list a one-click apply for the same span as leftover example.py:6.
Leftover cannot-provide rows written as path:start-end were dropped by
the overview consumer, so applyable interiors such as example.py:6 stayed
listed as one-click applies. Parse leftover ranges, cover every interior
line, and write start_line-spanned leftover comments as path:start-end.
@seonghobae
seonghobae enabled auto-merge (squash) August 13, 2026 12:05
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 10 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2bc10fb6-7ba3-4dcf-9fb5-a0c89b2d868a

📥 Commits

Reviewing files that changed from the base of the PR and between 6eb06cd and 6821df8.

📒 Files selected for processing (10)
  • .github/workflows/opencode-review-dispatch.yml
  • AGENTS.md
  • CHANGELOG.md
  • docs/doctoring/review-inline-comment-422-fallback.md
  • scripts/ci/materialize_base_python_requirements.py
  • scripts/ci/opencode_inline_comment_fallback.py
  • scripts/ci/test_strix_quick_gate.sh
  • tests/test_materialize_base_python_requirements.py
  • tests/test_opencode_agent_contract.py
  • tests/test_opencode_inline_comment_fallback.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae

Copy link
Copy Markdown
Contributor Author

@cwl-noema-review exact current head e5690e41 — leftover path:start-end receipts now cover interiors so leftover example.py:5-7 omits applyable example.py:6.

Leftover Manual-edit text is copied into the overview HTML comment.
A leftover --> or HTML metacharacter could close that comment or
inject markup. Strip those sequences before the excerpt is stored.
@seonghobae

Copy link
Copy Markdown
Contributor Author

@cwl-noema-review exact current head 9e8a1899 — leftover path:start-end receipts cover interiors so leftover example.py:5-7 omits applyable example.py:6; leftover excerpts sanitized. Head moved after e5690e41. Independent Noema APPROVE on this SHA is required. Do not wait on two-approval. Reviewers remain edit: deny. NVIDIA_NIM_API_KEY only.

Materialize a base Python lock only when every package line is an exact
SHA-256 pin or a two-token relative -r/--requirement include of a
candidate lock path. A lone --require-hashes directive, ./dotted paths,
and -r other-hashes.txt no longer enter the trusted build context.
@seonghobae

Copy link
Copy Markdown
Contributor Author

@cwl-noema-review exact current head 30ffeed1 — leftover path:start-end receipts cover interiors; coverage accepts only bounded relative requirement includes. Head moved after 9e8a1899. Independent Noema APPROVE on this SHA is required. Do not wait on two-approval. Reviewers remain edit: deny. NVIDIA_NIM_API_KEY only.

Reject leftover 422-fallback paths that contain -->, <!--, or a
suggestion fence so a leftover cannot close the overview HTML comment
or reopen an applyable GitHub suggestion block.
@seonghobae

Copy link
Copy Markdown
Contributor Author

@cwl-noema-review exact current head 6821df88 — leftover overview paths with --> / <!-- / suggestion-fence closers omitted so leftover cannot break the overview HTML comment. Head moved after 30ffeed1. Independent Noema APPROVE on this SHA is required. Do not wait on two-approval. Reviewers remain edit: deny. NVIDIA_NIM_API_KEY only.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode could not approve from deterministic current-head evidence because GitHub Checks have failed.

Findings

1. HIGH Current-head GitHub Checks - Fix failed required checks before approval

  • Problem: Failed same-head checks remain for 6821df8847d21539c5de6e50d5991b6765b768e6.
  • Root cause: The model-unavailable evidence fallback is allowed only when peer GitHub Checks are complete and clean.
  • Fix: Read and fix the failed check logs below, then rerun the current-head checks.
  • Regression test: Keep the model-unavailable fallback gated on an empty failed-check rollup.

Failed checks:

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow: opencode-review-dispatch.yml"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow: opencode-review-dispatch.yml"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file (2 files)"]
  S2 --> I2["repository behavior"]
  I2 --> R2["Review risk: Changed file (2 files)"]
  R2 --> V2["required checks"]
  Evidence --> S3["Docs: review-inline-comment-422-fallback.md"]
  S3 --> I3["operator or user guidance"]
  I3 --> R3["Review risk: Docs: review-inline-comment-422-fallback.md"]
  R3 --> V3["docs review"]
  Evidence --> S4["CI script (3 files)"]
  S4 --> I4["review and security gate shell path"]
  I4 --> R4["Review risk: CI script (3 files)"]
  R4 --> V4["bash -n plus Strix self-test"]
  Evidence --> S5["Test (3 files)"]
  S5 --> I5["regression suite"]
  I5 --> R5["Review risk: Test (3 files)"]
  R5 --> V5["targeted test run"]
Loading

@opencode-agent

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: 6821df8847d21539c5de6e50d5991b6765b768e6
  • Workflow run: 31748335381
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode could not approve from deterministic current-head evidence because GitHub Checks have failed.

Findings

1. HIGH Current-head GitHub Checks - Fix failed required checks before approval

  • Problem: Failed same-head checks remain for 6821df8847d21539c5de6e50d5991b6765b768e6.
  • Root cause: The model-unavailable evidence fallback is allowed only when peer GitHub Checks are complete and clean.
  • Fix: Read and fix the failed check logs below, then rerun the current-head checks.
  • Regression test: Keep the model-unavailable fallback gated on an empty failed-check rollup.

Failed checks:

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow: opencode-review-dispatch.yml"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow: opencode-review-dispatch.yml"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file (2 files)"]
  S2 --> I2["repository behavior"]
  I2 --> R2["Review risk: Changed file (2 files)"]
  R2 --> V2["required checks"]
  Evidence --> S3["Docs: review-inline-comment-422-fallback.md"]
  S3 --> I3["operator or user guidance"]
  I3 --> R3["Review risk: Docs: review-inline-comment-422-fallback.md"]
  R3 --> V3["docs review"]
  Evidence --> S4["CI script (3 files)"]
  S4 --> I4["review and security gate shell path"]
  I4 --> R4["Review risk: CI script (3 files)"]
  R4 --> V4["bash -n plus Strix self-test"]
  Evidence --> S5["Test (3 files)"]
  S5 --> I5["regression suite"]
  I5 --> R5["Review risk: Test (3 files)"]
  R5 --> V5["targeted test run"]
Loading

@opencode-agent
opencode-agent Bot disabled auto-merge August 13, 2026 23:45

Copy link
Copy Markdown
Contributor Author

Closing as a cumulative predecessor of #998. This range-receipt consumer and its regression are already present in canonical #998, which carries the complete bounded inline-comment fallback stack plus the later posted-suggestion exclusion boundary. Keeping both open duplicates checks, review traffic, and merge ordering. #998 remains Draft until its current-head materializer and true-HTTP-422 findings are repaired and revalidated.

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.

1 participant