Skip to content

feat(unic-pr-review): surface existing Human Threads as read-only review context #248

@orioltf

Description

@orioltf

What to build

unic-pr-review currently fetches every ADO PR Thread but only ever classifies them bot-vs-not (Iteration Marker, ADR-0006). In first-review the Threads are then dropped; in re-review only Bot Threads feed the Re-review Coordinator. Human review discussion is invisible to a Review in every Mode.

Found comparing pr-review (legacy) vs unic-pr-review on ADO PR #5570: the legacy plugin read the 5 Human Threads (#63474–63478), cross-referenced a Finding to a still-open one, and caught a Thread marked fixed whose issue was still present ("re-verify"). v2 surfaced none of it.

Make Human Threads read-only review context, surfaced after the aspect fan-out. The full design is locked in ADR-0016 (docs/adr/0016-human-threads-as-read-only-context.md); CONTEXT.md now defines Human Thread and System Thread. Build to those.

Behaviour:

  • Classify Threads three ways in the ADO Fetcher: Bot (Iteration Marker), System (comments[0].commentType === "system"), Human (neither). Only Human Threads are surfaced; System Threads never reach the Reviewer.
  • Post-fan-out match (deterministic, pure function): map Findings to Human Threads by filePath + line proximity. Aspect agents stay unchanged (no prompt injection, no Spawn-Set / ADR-0008 change).
  • Annotate a matched Finding ("overlaps open Human Thread #N"). Resolved-but-matched → "Thread #N marked fixed but issue still present — re-verify".
  • Notice: unresolved (active/pending) Human Threads that no Finding matched, plus unresolved non-inline (no threadContext) Threads, are listed in a Notice above the Intent Check. Resolved Threads (fixed/wontFix/closed/byDesign) are NOT listed.
  • Never suppress: a Finding is never dropped or down-ranked because a Human Thread exists — Confidence < 60 (ADR-0002) stays the sole filter.
  • Both Modes: first-review (+first-review-fallback) and re-review. In re-review the Coordinator additionally receives a read-only humanThreads input but emits zero threadActions for them.
  • Never write to a Human Thread in any Mode — the ADO Writer only ever targets Bot Threads. Pre-PR Mode unaffected (no ADO Threads).

Acceptance criteria

  • ADO Fetcher emits a classified Human Thread list ({ threadId, filePath, startLine, status, excerpt }), distinct from priorFindings; System Threads excluded.
  • On PR #5570 the 5 Human Threads (#63474–63478) are classified human; the System (RefUpdate) Threads are not surfaced.
  • A pure, tested matching function annotates Findings overlapping a Human Thread by filePath+line proximity, with the resolved-thread "re-verify" wording when status is resolved.
  • Unresolved unmatched Human Threads (incl. non-inline) appear in a Notice above the Intent Check; resolved Threads do not.
  • No Finding is suppressed or down-ranked by a Human Thread (Confidence < 60 remains the only filter).
  • Re-review Coordinator accepts a read-only humanThreads input and emits no threadActions referencing a Human Thread; ADO Writer never posts to a Human Thread.
  • Docs reflect shipped behaviour: README.md "How it works" prose + mermaid flowchart updated (Human-Thread classify step, the new Notice render path at Step 8, the Coordinator's read-only humanThreads input, and the w2 writer box clarified to bot threads only — never human); CHANGELOG.md entry added at version bump. ADR-0016 + CONTEXT.md already landed and need no change.
  • pnpm --filter unic-pr-review test + pnpm typecheck pass; pnpm ci:check clean.

Blocked by

None — can start immediately. Independent of #247 (work-item discovery), though both were found in the same PR #5570 comparison. ADR-0016 + CONTEXT.md terms already merged as the design source of truth.

Metadata

Metadata

Assignees

No one assigned

    Labels

    app:unic-pr-reviewArea: apps/claude-code/unic-pr-reviewfeatureNew capabilityready-for-agentFully specified, ready for an AFK agent

    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