Skip to content

pr-review: check for linked PR before attempting review #56

@ellen-goc

Description

@ellen-goc

Problem

When the org scan dispatches pr-review for issues labeled action:review, it raises an unhandled ValueError if no linked PR exists yet:

ValueError: No linked pull request found for issue #N in org/repo

This happens because a developer may label an issue action:review before opening a PR, or the PR is opened but not yet linked to the issue.

Observed occurrences (from ~/.askcc/logs/askcc.log):

  • weyucou/task-management#9 — 2026-03-20 04:13
  • weyucou/pletzer-slackbot-service#3 — 2026-03-20 12:34

Expected Behavior

Before invoking Claude for pr-review, askcc should verify that a linked PR exists. If none is found, it should skip gracefully with an informative log message (e.g. WARN: No linked PR found for issue #N, skipping pr-review) rather than raising an exception.

Suggested Fix

In _build_prompt (or before calling it for pr-review), call fetch_pr_content defensively and catch the ValueError, returning a clear skip signal to the caller.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions