Skip to content

Conversation

@xingyaoww
Copy link
Collaborator

@xingyaoww xingyaoww commented Jan 9, 2026

Problem

The PR review agent was making suggestions that spanned multiple lines but only specifying a single line number, causing misaligned suggestions. For example, when suggesting changes to two consecutive lines like:

stdout = process.stdout or ""
stderr = process.stderr or ""

The agent would only select line 119, but the suggestion contained two lines, resulting in a misaligned comment where the original lines and suggested lines didn't match up.

See this example: #1666 (comment)

Solution

Updated the PR review prompt to include documentation for using start_line and line parameters together when making multi-line comments or suggestions.

Changes

  • Added a new "Multi-Line Comments and Suggestions" section to the prompt
  • Documented the start_line, line, start_side, and side parameters
  • Added examples for both gh CLI and curl showing how to make multi-line suggestions
  • Added a note emphasizing that the number of lines in the suggestion must match the selected range

Testing

This is a prompt-only change. The next time the PR review agent runs, it will have the updated instructions for handling multi-line suggestions correctly.

@xingyaoww can click here to continue refining the PR


Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.12-nodejs22 Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:cee6223-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-cee6223-python \
  ghcr.io/openhands/agent-server:cee6223-python

All tags pushed for this build

ghcr.io/openhands/agent-server:cee6223-golang-amd64
ghcr.io/openhands/agent-server:cee6223-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:cee6223-golang-arm64
ghcr.io/openhands/agent-server:cee6223-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:cee6223-java-amd64
ghcr.io/openhands/agent-server:cee6223-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:cee6223-java-arm64
ghcr.io/openhands/agent-server:cee6223-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:cee6223-python-amd64
ghcr.io/openhands/agent-server:cee6223-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-amd64
ghcr.io/openhands/agent-server:cee6223-python-arm64
ghcr.io/openhands/agent-server:cee6223-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-arm64
ghcr.io/openhands/agent-server:cee6223-golang
ghcr.io/openhands/agent-server:cee6223-java
ghcr.io/openhands/agent-server:cee6223-python

About Multi-Architecture Support

  • Each variant tag (e.g., cee6223-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., cee6223-python-amd64) are also available if needed

The PR review agent was making suggestions that spanned multiple lines
but only specifying a single line number, causing misaligned suggestions.

This adds documentation for using start_line and line parameters together
when making multi-line comments or suggestions, with examples for both
gh CLI and curl.

Co-authored-by: openhands <[email protected]>
Copy link
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

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

Found two issues in the new documentation that need to be fixed: malformed JSON in the curl example and a missing API version header.

Copy link
Collaborator Author

@xingyaoww xingyaoww left a comment

Choose a reason for hiding this comment

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

Testing multi-line suggestion with corrected JSON format.

Comment on lines 196 to 198
"body": "Consider this improvement:\\n\\n```suggestion\\n
first_line = \\"improved\\"\\nsecond_line = \\"code\\"\\n
third_line = \\"here\\"\\n```"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Critical Issue - Malformed JSON: This curl example has literal newlines embedded in the JSON string value, which creates invalid JSON. The line breaks after \n on lines 195-197 should not be there.

Suggested change
"body": "Consider this improvement:\\n\\n```suggestion\\n
first_line = \\"improved\\"\\nsecond_line = \\"code\\"\\n
third_line = \\"here\\"\\n```"
"body": "Consider this improvement:\\n\\n```suggestion\\nfirst_line = \\"improved\\"\\nsecond_line = \\"code\\"\\nthird_line = \\"here\\"\\n```"

The entire body value should be on a single line with proper escape sequences.

The curl example had literal newlines embedded in the JSON string value,
which creates invalid JSON. Fixed by putting the body value on a single
line with proper escape sequences.

Also simplified the example to use a 2-line suggestion (lines 10-11)
with shorter variable names to fit within line length limits.

Co-authored-by: openhands <[email protected]>
@openhands-ai
Copy link

openhands-ai bot commented Jan 9, 2026

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • Agent Server

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #1677 at branch `fix/pr-review-multiline-suggestions`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

@xingyaoww xingyaoww requested a review from enyst January 9, 2026 20:14
@xingyaoww xingyaoww enabled auto-merge (squash) January 9, 2026 20:23
@xingyaoww xingyaoww merged commit 90ca600 into main Jan 9, 2026
22 checks passed
@xingyaoww xingyaoww deleted the fix/pr-review-multiline-suggestions branch January 9, 2026 21:44
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.

5 participants