Skip to content

fix(pr-review): refresh GitHub state when resuming keyed reviews #648

Description

@neubig

Problem

The GitHub PR reviewer reuses its keyed conversation for an explicit re-review, but the resumed agent can repeat stale mutable GitHub state instead of refreshing it.

Live example: OpenHands/software-agent-sdk#5039 was first reviewed at 14:05 UTC. Its linked issue #5038 was then re-triaged and labeled ready-for-dev at 14:11 UTC. An explicit re-review at 14:14 UTC reused the conversation and reposted the earlier verdict, still claiming #5038 had priority:medium and no ready-for-dev label.

Conversation reuse is desirable, but a new review request must evaluate the current PR, linked issues, comments, and checks rather than treating earlier observations as current.

Acceptance criteria

  • Every explicit review request refreshes mutable GitHub state before deciding a verdict: exact head, PR body, review comments, linked issue body and labels, review requests, and current-head checks.
  • A same-head re-review after a linked issue label/body change observes the new issue state and does not repeat the stale finding.
  • A same-head re-review after check status or review/comment changes observes those updates.
  • Existing keyed conversation reuse and context retention remain intact.
  • Automated tests reproduce a completed first review, mutate linked issue/check/review state, resume the same conversation, and verify the second review uses the refreshed state.
  • The reusable github-pr-reviewer extension and generated automation bundle remain synchronized.

OpenHands AI triage

The following comments and acceptance criteria were added by the OpenHands AI agent.

Triage

Bounded scope: the resume path of the reusable skills/github-pr-reviewer automation and the review prompt it sends when it reuses an existing keyed conversation. AgentConversationDispatcher.deliver() (skills/github/scripts/agent_conversation.py) resumes the stable per-PR conversation and, for a new delivery, sends one fresh turn; the review prompt is built by _build_review_prompt() in skills/github-pr-reviewer/scripts/main.py and wrapped by PullRequestReviewer._prompt() in scripts/worker.py. The existing prompt already requires re-reading the PR head and inspecting current-head Actions results, but it does not require re-reading the other mutable GitHub state, so a resumed agent can report earlier observations (for example a linked issue's earlier labels or priority) as current. The fix is to make a fresh explicit review request re-establish current state before it decides a verdict, using the automation's existing mechanism (the prompt instructs the agent, which reads GitHub itself through the configured token). The dispatcher's keyed reuse and delivery idempotency stay as they are.

Non-goals: no change to head-moved stale-result suppression, the labeled/review-request trigger selection, the deterministic maintainer handoff, the native review verdict format, or the checkout lifecycle; no change to AgentConversationDispatcher behavior for other automations; no runtime, agent-server, SDK, or automation-service changes, and nothing outside this repository.

Priority: priority:high. This is a correctness defect in the live review pipeline: #648 describes a reproduced stale verdict on OpenHands/software-agent-sdk#5039, and its sibling #646 (delayed submitted events restarting completed reviews) is already priority:high. A stale verdict is externally visible, can wrongly report a linked issue as not ready for development, and undermines the automation's purpose, so it outranks the catalog-addition and skill-authoring backlog items.

Acceptance Criteria

  • On every explicit review request that reuses an existing keyed conversation (a re-applied trigger label in scheduled mode, or a new review_requested event in event mode), the prompt requires the reviewer to re-fetch current mutable GitHub state before deciding its verdict: the exact head, the PR body, review comments and threads, the linked issue body and labels, current review requests, and current-head check results.
  • A same-head re-review following a linked issue label or body change (for example the linked issue gains ready-for-dev after the first review) resumes the same conversation and produces a review that reflects the new issue state; it does not repeat the earlier finding that the issue was not ready or carried a different priority.
  • A same-head re-review following a check-status, review, or comment change reflects that update rather than the earlier observation.
  • Keyed conversation reuse and context retention are unchanged: a redelivered identical delivery is still deduplicated without sending a new turn, and a new delivery resumes the same conversation id, sends exactly one new turn, and retains the conversation's prior context (no new conversation is created for an existing subject).
  • Automated tests reproduce a completed first review, then mutate linked-issue label and body, check-status, and review/comment state, resume the same conversation, and verify the second review uses the refreshed state; they pass with uv run pytest -q.
  • skills/github-pr-reviewer/SKILL.md (and README.md where it describes re-review) document that an explicit re-review refreshes mutable GitHub state rather than trusting earlier observations.
  • The reusable extension and the generated automation bundle remain synchronized: python scripts/sync_extensions.py --check and npm run build:automations report no drift, and if shipped bundle files change, automations/catalog/github-pr-reviewer/manifest.json setup.bundle.version is bumped with the matching template.version in tests/fixtures/automations/github-pr-reviewer.json.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:highHigh priority for triage against backlogready-for-devScoped for contribution; managed by repository readiness checks.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions