展示HN:我构建了一个工具,帮助AI代理判断PR何时可以合并。
Show HN: I built a tool to assist AI agents to know when a PR is good to go

原始链接: https://dsifry.github.io/goodtogo/

## 随时待命:解决 AI 驱动的开发瓶颈 AI 编码代理正在迅速改变软件开发,但难以完成一项关键任务:判断拉取请求 (PR) 是否*真正*准备好合并。当前的代理会无休止地轮询 CI,错误解读评论,并由于缺乏明确的状态而需要持续的人工干预。 **随时待命** 提供了一个解决方案,只需一个命令即可提供确定性的 PR 分析,返回以下四个明确的状态:**就绪 (READY)**、**需要操作 (ACTION_REQUIRED)**、**未解决的讨论 (UNRESOLVED_THREADS)** 或 **CI 失败 (CI_FAILING)**。 它通过分析 **CI 状态**、分类 **评论 (可操作、不可操作、模棱两可)** – 理解 CodeRabbit 和 Claude 等工具中的细微差别 – 以及跟踪 **讨论解决情况** 以避免被已在代码中解决的讨论误导来实现这一点。 **随时待命** 专为 AI 代理设计,提供结构化的 JSON 输出和合理的退出代码,从而实现自动化工作流程。它可以被集成为 CI 网关,用于代理循环中以高效处理反馈,或用于监控 PR 生命周期。最终,**随时待命** 赋予 AI 自动管理 PR 的能力,减少人工开销并加速开发。

## 准备就绪:AI 代理的 PR 准备度工具 开发者 dsifry 构建了“gtg”,一个 Python 工具,旨在可靠地确定拉取请求 (PR) 是否真正准备好合并,特别是为了解决在使用 Claude Code 等 AI 代理时遇到的问题。 gtg 解决的核心问题是,代理缺乏确定性的方法来判断 PR 何时完成——除了简单地检查 CI 状态之外。 gtg 汇总 CI 结果,*分类* 审查评论(区分可操作的反馈和建议等噪音),并跟踪线程的解决情况。 重要的是,它能够理解 CodeRabbit 等工具中的评论严重程度标记,并识别 AI 审查员的批准/阻止语言。 这使得代理可以避免过早宣布胜利或陷入循环。 gtg 输出 JSON 供代理集成以及人类可读文本,并采用 MIT 许可。 开发者每天都在使用它,并正在寻求来自其他构建类似 AI 驱动工作流程的人们的反馈。
相关文章

原文

The missing piece in AI-assisted development: knowing when you’re actually done.


The Problem No One Talks About

AI coding agents are transforming software development. They can write code, fix bugs, respond to review comments, and create pull requests. But they all share one fundamental problem:

They can’t reliably know when a PR is ready to merge.

Think about it. When you ask an AI agent to “fix the CI and address the review comments,” how does it know when it’s finished?

  • CI is running… is it done yet? Let me check again. And again.
  • CodeRabbit left 12 comments… which ones actually need fixes vs. which are just suggestions?
  • A reviewer wrote “consider using X”… is that blocking or just a thought?
  • There are unresolved threads… but the code was already fixed in the last commit.

Without deterministic answers, agents either:

  • Poll indefinitely - checking CI status in a loop, burning tokens
  • Give up too early - “I’ve pushed my changes” (but CI is failing)
  • Miss actionable feedback - buried in a sea of informational comments
  • Ask you constantly - “Is it ready now? How about now?”

The Solution: Deterministic PR Analysis

Good To Go provides a single command that answers the question definitively:

That’s it. One command. One answer.

Status Meaning What to Do
READY All clear Merge it
ACTION_REQUIRED Comments need fixes Address them
UNRESOLVED_THREADS Open discussions Resolve them
CI_FAILING Checks not passing Fix the build

No ambiguity. No guessing. No infinite loops.

How It Works

Good To Go analyzes your PR across three dimensions:

1. CI Status Aggregation

Combines all GitHub check runs and commit statuses into a single pass/fail/pending state. Handles the complexity of multiple CI systems, required vs optional checks, and in-progress runs.

Not all review comments are created equal. Good To Go classifies each comment as:

  • ACTIONABLE - Must fix before merge (blocking issues, critical bugs)
  • NON_ACTIONABLE - Safe to ignore (praise, nitpicks, resolved items)
  • AMBIGUOUS - Needs human judgment (suggestions, questions)

Built-in parsers understand the patterns of popular automated reviewers:

  • CodeRabbit - Severity indicators (Critical/Major/Minor/Trivial)
  • Greptile - Code analysis findings
  • Claude - Blocking markers and approval patterns
  • Cursor/Bugbot - Bug severity levels

3. Thread Resolution Tracking

Distinguishes between truly unresolved discussions and threads that are technically “unresolved” but already addressed in subsequent commits.

Designed for AI Agents

Good To Go is built specifically for how AI agents work:

Exit Codes That Make Sense

Default mode returns 0 for any analyzable state—because AI agents should parse the JSON output, not interpret exit codes as errors.

# AI-friendly (default): exit 0 + parse JSON
gtg 123 --format json

# Shell-script friendly: semantic exit codes
gtg 123 -q  # quiet mode, exit code only

Structured Output

Every response includes exactly what an agent needs to take action:

{
  "status": "ACTION_REQUIRED",
  "action_items": [
    "Fix CRITICAL comment from coderabbit in src/db.py:42",
    "Resolve thread started by @reviewer in api.py"
  ],
  "actionable_comments": [...],
  "ci_status": {...},
  "threads": {...}
}

State Persistence

Track what’s already been handled across agent sessions:

gtg 123 --state-path .goodtogo/state.db  # Remember dismissed comments
gtg 123 --refresh                         # Force fresh analysis

Use Cases

As a CI Gate

Make gtg a required status check. PRs can’t merge until they’re truly ready—not just “CI passed.”

# .github/workflows/pr-check.yml
- name: Check PR readiness
  run: gtg $ --semantic-codes

In Agent Workflows

Give your AI agent a definitive answer instead of endless polling:

result = subprocess.run(["gtg", pr_number, "--format", "json"], ...)
data = json.loads(result.stdout)

if data["status"] == "READY":
    merge_pr()
elif data["status"] == "ACTION_REQUIRED":
    for item in data["action_items"]:
        address_feedback(item)

For PR Shepherding

Monitor a PR through its entire lifecycle:

while true; do
  gtg 123 -q
  case $? in
    0) echo "Ready to merge!"; break ;;
    1) handle_comments ;;
    2) resolve_threads ;;
    3) wait_for_ci ;;
  esac
  sleep 60
done

Quick Start

# Install
pip install gtg

# Set your GitHub token
export GITHUB_TOKEN=ghp_...

# Check a PR (auto-detects repo from git origin)
gtg 123

# Explicit repo
gtg 123 --repo owner/repo

# Human-readable output
gtg 123 --format text

Philosophy

Good To Go embeds several opinions about PR workflows:

  1. Determinism over heuristics - Every PR has exactly one status at any moment
  2. Actionability over completeness - Surface what needs action, not everything
  3. Agent-first design - Structured output, sensible defaults, state persistence
  4. Fail open for ambiguity - When uncertain, flag for human review rather than block

Made with Claude Code
by David Sifry

联系我们 contact @ memedata.com