MCPcopy Index your code
opentrace/opentrace / pull request

#408 fix(ui): PR review accuracy — SHA-pinned content, per-field truncation, verdict guardrail + model refresh OPEN

jatinot · view on GitHub ↗ · graph: workspace 365ee7cde142

15 files changed 155 symbols touched 41 call sites elsewhere 5 contracts touched

What this PR does

## What this PR does

Fixes the PR-review agent's data pipeline (camelCase/snake_case property mismatch and truncation bugs starved it of actual PR content) and refreshes provider model lists to current lineups.

- **Content loading fix**: `prTools` now reads the camelCase `baseBranch`/`headBranch`/`baseSha`/`headSha` properties the indexer actually writes (previously mismatched, so `prClient.getFileContent` was never called and content came back as `(PR client not available)`). SHAs are now preferred over branch names, and `PRClient.getFileContent` gains a `repoOverride` param so fork PRs fetch from the head repo instead of failing.
- **Truncation overhaul**: `get_pr_file_change` now truncates each field independently (diff/content capped separately, `*_truncated` flags, line-numbered content, `startLine`/`endLine` paging) instead of hard-cutting a combined 8k JSON blob mid-stream; stored patch cap raised 5k→50k chars; GitHub PR files fetch paginated past 100 entries.
- **Verdict guardrail**: review runner (`reviewRunner.ts` + new `pr/reviewParse.ts`) tracks which changed files were actually inspected via `enforceInspectionCoverage` and downgrades APPROVE→COMMENT if files were skipped; comment line-snapping capped at ±3 lines (previously unbounded/first-line fallback).
- **Schema/type changes**: `PRSummary`/`types.ts` gain `base_sha`, `head_sha`, `head_repo`; indexer writes `baseSha`/`headSha`/`headRepo` node properties; `ReviewResult.tsx` parsing logic extracted to React-free `ui/src/pr/reviewParse.ts` and re-exported (import path preserved).
- **Model refresh**: Anthropic/OpenAI/Gemini model lists and defaults updated to July 2026 lineups; `ChatPanel` now falls back to `defaultModel` via `resolveModelChoice` when a stored model ID no longer exists in the provider list (avoids pinning dropdown to a retired ID).

Risk: high fan-in on `indexPRIntoGraph` (13 call sites), `makePRTools`/`makePR` (12 each) and `detectProvider` (18) means the property/schema changes and truncation behavior ripple across most PR-review and provider-detection code paths; 155 symbols touched across 15 files with 41 external call sites raises regression surface for both PR indexing and chat provider selection.

Symbols in this PR ranked by fan-in — how much of the codebase leans on them

symbol kindfan-infile
detectProvider Function5 ui/src/chat/providers.ts
sendMessage Function4 ui/src/appComponents/ChatPanel.tsx
indexPRIntoGraph Function4 ui/src/pr/indexer.ts
sendMessage Function4 ui/src/appComponents/ChatPanel.tsx
indexPRIntoGraph Function4 ui/src/pr/indexer.ts
makePRTools Function3 ui/src/chat/prTools.ts
getPRDetail Method3 ui/src/pr/client.ts
createReview Method3 ui/src/pr/client.ts
postComment Method3 ui/src/pr/client.ts
ghFetch Function3 ui/src/pr/githubPR.ts
makePRTools Function3 ui/src/chat/prTools.ts
getPRDetail Method3 ui/src/pr/client.ts
createReview Method3 ui/src/pr/client.ts
postComment Method3 ui/src/pr/client.ts

Call sites the code elsewhere that depends on what this PR changes — each links to the exact line

callers of detectProvider

providers.test.ts File ui/src/chat/__tests__/providers.test.ts:?

callers of indexPRIntoGraph

handleIndexPR Function ui/src/appComponents/PRListPanel.tsx:128
handleIndexAll Function ui/src/appComponents/PRListPanel.tsx:140

callers of makePRTools

createChatAgent Function ui/src/chat/agent.ts:64

callers of getPRDetail

handleSelectPR Function ui/src/appComponents/PRListPanel.tsx:116
handleIndexAll Function ui/src/appComponents/PRListPanel.tsx:140
handleLookup Function ui/src/appComponents/PRListPanel.tsx:163

callers of createReview

handleSubmitReview Function ui/src/appComponents/PRDetailPanel.tsx:182
client.test.ts File ui/src/pr/__tests__/client.test.ts:?

Review history

Jul 06 08:13155 symbols · 41 call sites
Jul 06 07:59155 symbols · 41 call sites

Keep digging ask about this PR — answers extend the page