Skip to content

Research: LLM-powered PR Walkthrough / Chain-of-Thought Review UI #74

Description

@tanvesh01

Research: LLM-powered PR Walkthrough / Chain-of-Thought Review UI

Context: We want a structured, step-by-step PR walkthrough in Rudu — similar to Codiff's "Walkthrough" feature — displayed as a vertical Chain-of-Thought timeline with collapsible steps, clickable file chips, and progress tracking.

This issue catalogs what already exists in open PRs, what comparable tools do, and what infrastructure we still need.


1. What already exists in Rudu

PR #56[codex] Add remote Pi review workflow (branch: pr-worker-codex-review, 63 files)

Backend (Rust + Tauri):

  • ReviewSession / ReviewWorkspace / ReviewChat domain model with persistence (session.json)
  • Local git worktree checkout per PR (~/rudu/workspaces/<repo>/pr-<n>/repo)
  • ACP (Agent Client Protocol) runtime adapter (review_session/acp.rs) for Codex chat
  • Streaming event model: ReviewChatEvent union with Message, Thought, Tool, Plan, Finished, Error
  • ReviewWorkspaceEvent log stream for workspace preparation steps
  • Research ADRs document the Codex migration from Pi (0003-use-codex-as-the-review-chat-agent.md)

Frontend (React + Tailwind):

  • src/components/ai-elements/chat.tsxreusable UI primitives already built:
    • <Reasoning> — collapsible reasoning block with streaming state
    • <Tool> — tool call status block (input-available / output-available)
    • <Checkpoint> / <CheckpointIcon> / <CheckpointTrigger> — timeline markers
    • <Conversation> / <ConversationContent> — scrollable chat container
  • src/features/review-chat/assistant-part.tsx — renders assistant message parts:
    • text → markdown
    • reasoning<Reasoning>
    • data-acp-planAcpPlanView (ordered plan entries with status badges)
    • tool<Tool>
  • src/features/review-chat/line-selection.tsfile attachments with diff line ranges, already wired into PatchViewerMain
  • Chat panel added as a right sidebar tab ("Rudu") in patch-viewer-main.tsx

Key insight: The UI primitives for a Chain-of-Thought timeline are already 70% built. They are currently arranged for a chat transcript, not a walkthrough.

PR #29Add AI summarization review panels (branch: d4rm5:main, 24 files)

Backend:

  • src-tauri/src/services/chapters.rs — LLM chapter generator with structured JSON prompt (chapters-v1)
  • Prompt returns: { prologue: { summary, keyChanges[], reviewFocus[] }, chapters: [{ title, summary, files[], reviewSteps[], risks[] }] }
  • 8-provider LLM abstraction in services/llm.rs (OpenAI, Anthropic, Google, OpenRouter, Z.ai, Minimax, Opencode, OpenAI-compatible)
  • Keyring-based API key storage (rudu.llm)
  • SQLite caching for chapters

Frontend:

  • src/components/ui/chapter-overview.tsx — ~1000-line component rendering chapter list with severity badges, expandable chapters, review steps, related files, risks panel, completion tracking
  • TanStack Query hooks in src/queries/llm.ts

Key insight: PR #29 has a structured backend for generating grouped review content, but the UI is a dashboard, not a walkthrough timeline. The data shape is close to what a walkthrough needs.


2. What Codiff does (reference implementation)

Codiff's walkthrough (electron/walkthrough.cjs):

  • Prompt strategy: Returns a review walkthrough order, not review findings. Files are ranked by "review leverage" (architecture boundaries → contained changes → mechanical churn).
  • JSON schema:
    {
      "groups": [
        {
          "title": "Review carefully",
          "reason": "...",
          "files": [
            {
              "path": "...",
              "action": "review" | "scan" | "skim",
              "impact": "wide" | "contained" | "mechanical",
              "reason": "...",
              "context": "..."
            }
          ]
        }
      ],
      "summary": { "focus": "...", "skim": "..." }
    }
  • Normalization: Validates every file is used exactly once; fills missing files into a fallback group.
  • Model: gpt-5.3-codex-spark with reasoning effort high, 45s timeout, read-only sandbox.

3. What ai-sdk ChainOfThought offers (Vercel AI Elements)

Composable component API (packages/elements/src/chain-of-thought.tsx):

<ChainOfThought defaultOpen>
  <ChainOfThoughtHeader />
  <ChainOfThoughtContent>
    <ChainOfThoughtStep
      icon={SearchIcon}
      label="Searching for profiles..."
      status="complete" | "active" | "pending"
    >
      <ChainOfThoughtSearchResults>
        <ChainOfThoughtSearchResult>github.com</ChainOfThoughtSearchResult>
      </ChainOfThoughtSearchResults>
    </ChainOfThoughtStep>
  </ChainOfThoughtContent>
</ChainOfThought>
  • Vertical step list with connector line
  • status prop: complete | active | pending
  • Collapsible header
  • Search result chips (badges)
  • Image support

Mapping to PR walkthrough:

ChainOfThought concept PR walkthrough mapping
<ChainOfThoughtStep> One file group (e.g. "Review carefully")
label Group title + reason
status User progress through groups
<ChainOfThoughtSearchResult> File chip with action/impact badges
description File reason + context
Click on chip Scroll to file in diff viewer

4. Comparable tools in the wild

Tool Stars Walkthrough? Structured output? Notes
PR-Agent 11.2k Partial (/describe, /review) Yes (YAML/JSON configs) Mature, but GitHub-action-centric; no desktop timeline UI
OpenCommit 7.1k No No Commit message generation only
slop-review ~50 Yes (CLI) Yes (JSON) Lightweight Ruby CLI; similar "impact" concept
diff-explainer ~200 No No Explains hunks in plain English
wrily ~100 Yes Yes Web-based review assistant with step-by-step guidance

None of the open-source tools provide a native desktop Chain-of-Thought timeline UI. Rudu would be novel here.


5. Gap analysis

Need PR #56 has PR #29 has Missing
Local workspace for LLM context
Streaming event model
Reasoning/tool/status UI primitives
Structured grouped output backend
impact / action per file ✅ NEW
Vertical timeline layout ✅ NEW
Step status (complete/active/pending) Partial (tool states) ✅ NEW
File chip → diff scroll Partial (attachments) ✅ NEW
Summary header (focus + skim) Partial (prologue) ✅ Extend

6. Recommended implementation paths

Option A: Extend PR #56 chat (chat-driven walkthrough)

Add a special /walkthrough prompt that instructs Codex to output a structured walkthrough using the existing ACP plan format, enriched with file groups. Render it by restyling the existing <Reasoning> + <Tool> + <Checkpoint> stack into a vertical timeline.

Pros:

  • No new backend command needed
  • Leverages existing Codex ACP session
  • Interactive: user can ask follow-up questions about each step

Cons:

  • Relies on Codex reliably producing structured JSON inside a chat turn
  • Harder to cache/regenerate
  • Tied to Codex (can't easily swap providers)

Option B: Add separate walkthrough backend (pre-generated)

New Tauri command + prompt (inspired by PR #29's chapters.rs but simpler), returning the Codiff JSON shape. New React component renders it as a Chain-of-Thought timeline. Reuse file chip click handler from PR #56's attachment system.

Pros:

  • Deterministic structured output with JSON schema enforcement
  • Provider-agnostic (uses PR Add AI summarization review panels #29's 8-provider LLM service)
  • Cacheable per PR revision
  • Matches Codiff's proven prompt strategy

Cons:

Option C: Hybrid (recommended)

Build a dedicated walkthrough backend (Option B) for the initial structured generation, but render it inside the Review Chat panel (Option A) so the user can ask follow-up questions about any step. The walkthrough appears as the first assistant message in the chat, using the Chain-of-Thought layout.

Why this is best:

  • Gets the reliability of structured JSON generation
  • Keeps the user inside the conversational review flow
  • Reuses PR codex acp #56's chat UI primitives
  • Can fall back to "just chat" if walkthrough generation fails

7. Concrete next steps (if we proceed)

  1. Branch off PR codex acp #56 (or wait for merge) — the chat infrastructure is the right foundation.
  2. Port PR Add AI summarization review panels #29's LLM service (services/llm.rs, commands/chapters.rs, types/github.ts) into the same branch.
  3. Add impact and action fields to the chapter/walkthrough prompt and TypeScript types.
  4. Create WalkthroughTimeline component in src/features/review-chat/ using existing <Reasoning> / <Tool> / <Checkpoint> primitives, styled as a vertical timeline.
  5. Wire file chips to useDiffNavigator scroll-to-file (already exists in patch-viewer-main.tsx).
  6. Add per-step status tracking based on which files the user has viewed (could use existing diff navigator state).
  7. Cache walkthroughs per PR + head SHA using the existing SQLite cache or session metadata.

8. Open questions

  • Should the walkthrough be auto-generated on PR open or on-demand via a button?
  • Should we support re-running the walkthrough with a different provider/model?
  • How do we handle large PRs (>120k chars patch)? PR Add AI summarization review panels #29 already clips; Codiff uses 160k total with 4k per section.
  • Do we want user-editable plan entries (like Codex's checkpoint interaction) or read-only?
  • Should file chips show only action (review/scan/skim) or also impact (wide/contained/mechanical)?

Research compiled from:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-humanNeeds human implementation or decision

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions