Skip to content

Treat CR thread-summary replies as durable settled context when provider resolution is unavailable #394

Description

@rianjs

Problem

cr respond can post inline summary replies through a GitHub App, but empirical testing on PR #359 showed the app installation token can fail resolveReviewThread with a GraphQL permission error even when it can post replies and the human viewer can resolve the same thread.

That means the PR itself can contain the durable summary reply, but the GitHub review thread may remain unresolved. Today the resolved-thread context path keys primarily off the provider isResolved flag, so a fresh review can miss the summary-as-cache signal and may reprocess or re-raise already-addressed discussion.

Desired behavior

Use CR-authored summary reply metadata as durable PR-local context, even when the provider cannot mark the thread resolved:

  • Recognize codereview:thread-summary marker replies authored by the posting identity.
  • Treat the latest CR-authored thread-summary reply as settled context when no newer human reply follows it.
  • Feed that summary into reviewer/dossier context so agents avoid recomputing or re-raising the discussion.
  • If a newer human reply appears after the summary marker, consider the thread pending again.
  • Preserve the provider isResolved distinction so UI state and API resolution are not conflated with CR's own durable summary cache.

Empirical context

On PR #359:

  1. Human replied inline to CR-authored findings.
  2. cr respond --dry-run --rerun correctly planned summary replies and thread resolution.
  3. Live cr respond --rerun posted the summary replies as rianjs-bot.
  4. resolveReviewThread failed for the GitHub App token with permission denied.
  5. A direct human gh api graphql call to resolveReviewThread succeeded for the same thread IDs.

Proposed contract

A thread is provider-resolved when isResolved=true.

A thread is CR-settled when the latest CR-authored lifecycle comment carries a valid codereview:thread-summary marker and no later human comment exists.

Reviewer prompts should receive compact file-scoped summaries for both provider-resolved and CR-settled threads, while command output/diagnostics should make clear whether provider resolution actually happened.

Guardrails

  • Run this through the GPT-5.5 xhigh consulting architect before implementation.
  • Keep provider resolution and CR-settled metadata as separate domain concepts.
  • Do not use top-level comments as substitutes for inline thread summaries.
  • Unit tests should cover:
    • unresolved thread with latest CR summary marker becomes CR-settled context
    • newer human reply after summary marker reopens/pends the thread
    • forged human-authored summary markers are ignored
    • provider-resolved threads continue to use the existing latest-comment summary behavior
    • reviewer/dossier context includes CR-settled summaries without reprocessing the full conversation
  • Empirical test should use an open PR with an inline human reply and a GitHub App posting identity that can reply but cannot resolve.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions