Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/guides/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ In Actions, Landing supplies the trigger, target, and relevant revisions. The ag

## Publish native results

PR review publishes a native [GitHub Review](https://docs.github.com/en/rest/pulls/reviews#create-a-review-for-a-pull-request) for the requested commit, with findings attached to the affected lines. A clean review needs no code comments. Reviews comment by default; approvals and change requests require explicit authorization. The gate recommendation remains separate.
PR review publishes a native [GitHub Review](https://docs.github.com/en/rest/pulls/reviews#create-a-review-for-a-pull-request) for the requested commit, with findings attached to the affected lines. A clean review needs no code comments. Follow-up reviews on new commits read the PR's existing review threads: findings that still apply stay in their original threads and are referenced from the review body rather than posted again, and resolved threads stay settled unless new evidence changes their conclusion. Reviews comment by default; approvals and change requests require explicit authorization. The gate recommendation remains separate.

Explicit delegations require a reply to their selected issue or PR; inline follow-ups reply in the original review thread. Landing verifies that the prepared identity published to the requested destination before reporting completion. Include `confirm_reply` when restricting tools for inline follow-ups.

Expand Down
48 changes: 40 additions & 8 deletions src/landing/adapters/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,49 @@
from landing.prompts import render
from landing.runtime import Runtime

REPOSITORY_GUIDANCE = "GitHub repository: $repository. Use the prepared gh CLI. In GitHub conversations use #number or owner/repo#number outside code spans; elsewhere use explicit links. Read contribution templates from the checkout's standard GitHub locations when needed."

PUBLICATION_GUIDANCE = "When publishing, include $stamp at the start of the body to identify this delivery. For a body file, use gh pr/issue comment --body-file FILE or gh api -F body=@FILE; -f body=@FILE sends the literal path. Use --input FILE for a JSON payload. Refresh the current PR head before publishing. Supplemental evidence may be linked from the required reply or review; a separate evidence comment cannot replace that publication. The context records the candidate head separately from the actual CI checkout revision."

THREAD_GUIDANCE = "Reply in the original thread with POST repos/$repository/pulls/$number/comments/$thread/replies, rather than a new review. Include the delivery marker, or call confirm_reply with the returned comment ID."

REVIEW_GUIDANCE = "Publish a native GitHub COMMENT review on PR #$number; APPROVE and REQUEST_CHANGES require separate explicit authorization. Use the reviews API with commit_id, body and inline comments containing path, line and side; ranges also use start_line and start_side. Verify locations against the inspected diff. Put the verdict in the review body and findings in inline comments; use the body for findings with no suitable diff location. Use suggestion blocks for verified replacements within the commented range, preserving the surrounding syntax, and <details> for longer reproductions or evidence. Reply to existing findings through the original review thread. Native check jobs are independent of Landing feedback; do not wait for this feedback job or the enclosing workflow to complete."
REPOSITORY_GUIDANCE = (
"GitHub repository: $repository. Use the prepared gh CLI. In GitHub conversations use #number or owner/repo#number "
"outside code spans; elsewhere use explicit links. Read contribution templates from the checkout's standard GitHub "
"locations when needed."
)

PUBLICATION_GUIDANCE = (
"When publishing, include $stamp at the start of the body to identify this delivery. "
"For a body file, use gh pr/issue comment --body-file FILE or gh api -F body=@FILE; "
"-f body=@FILE sends the literal path. Use --input FILE for a JSON payload. "
"Refresh the current PR head before publishing. Supplemental evidence may be linked from the required reply or "
"review; a separate evidence comment cannot replace that publication. "
"The context records the candidate head separately from the actual CI checkout revision."
)

THREAD_GUIDANCE = (
"Reply in the original thread with POST repos/$repository/pulls/$number/comments/$thread/replies, rather than a new "
"review. Include the delivery marker, or call confirm_reply with the returned comment ID."
)

REVIEW_GUIDANCE = (
"Publish a native GitHub COMMENT review on PR #$number; APPROVE and REQUEST_CHANGES require separate explicit "
"authorization. Use the reviews API with commit_id, body and inline comments containing path, line and side; "
"ranges also use start_line and start_side. Verify locations against the inspected diff. "
"Put the verdict in the review body and findings in inline comments; use the body for findings with no suitable "
"diff location. Use suggestion blocks for verified replacements within the commented range, preserving the "
"surrounding syntax, and <details> for longer reproductions or evidence. "
"Before publishing, read the PR's existing review threads, including their resolved and outdated state, through the "
"GraphQL reviewThreads connection. Add inline comments only for findings that no existing thread raises. "
"Leave a still-applicable open finding in its thread and refer to it from the review body by link; "
"reply in that thread only when the candidate changes its conclusion or affected location. "
"Resolved threads stay settled unless new evidence changes their conclusion. "
"Native check jobs are independent of Landing feedback; do not wait for this feedback job or the enclosing workflow "
"to complete."
)

AUTOMATIC_GUIDANCE = "This is automatic follow-up; no_update is available when there is no useful change."

CONVERSATION_GUIDANCE = "Answer the delegation in issue or PR #$number. Link a repair or supporting evidence when needed; do not repeat an explanation already published in the linked issue, PR or review. Call confirm_reply with the returned conversation comment ID to read back the published body."
CONVERSATION_GUIDANCE = (
"Answer the delegation in issue or PR #$number. Link a repair or supporting evidence when needed; "
"do not repeat an explanation already published in the linked issue, PR or review. "
"Call confirm_reply with the returned conversation comment ID to read back the published body."
)


class GitHubEnvironment(BaseSettings):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ async def run():
consumer = asyncio.create_task(
output(await landing.run_stream(session_id="pending", prompt="Record evidence."))
)
# The server creates the receipt before writing its line; wait for the complete record.
async with asyncio.timeout(15):
while not receipt.exists():
while not receipt.exists() or not receipt.read_text().endswith("\n"):
await asyncio.sleep(0.01)
pid = json.loads(receipt.read_text())["pid"]
consumer.cancel()
Expand Down
Loading