Repository navigation
perf(review): keep the review prompt an index of linked items - #1762
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 8, 2026, 12:41 PM ET / 16:41 UTC. ClawSweeper reviewWhat this changesThis PR deduplicates the primary PR body, summarizes passing checks, and replaces linked-item bodies with an index when GitHub access is available. Review scores
ProductKind: Performance · Worth it: Yes Merge readiness✅ Ready for maintainer review This PR provides a useful, measured reduction in review input that current main does not provide. No actionable patch defect was found. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherClawSweeper gathers GitHub discussion and source evidence for a model to review an issue or PR. This change reduces the prompt representation while preserving the collected records used for freshness and safety checks. flowchart TD
A[Collected GitHub records] --> B[Prompt projection]
B --> C[Primary body and check summary]
B --> D{GitHub access available}
D -->|Yes| E[Linked item index]
D -->|No| F[Inline linked bodies]
C --> G[Reviewer]
E --> G
F --> G
G --> H[Read relevant linked records]
Technical reviewBest possible solution: Keep the prompt projection at the existing review-runtime boundary while preserving full collected records and fetching decision-relevant linked evidence on demand. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug report; the supplied CLI comparison demonstrates the oversized input and its reduction. Is this the best way to solve the issue? Yes. A prompt-only projection is a narrow solution that preserves freshness, source capture, offline context, and existing admission serialization. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fb5a0d95b269. Provenance checked
TestingProof path: shipped entry point. Added test files: 1. SecurityNone. EvidenceWhat I checked:
Likely related people:
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment |
What
The review prompt becomes an index instead of an archive. The reviewer already has a read-only
GH_TOKENand GitHub network access, so it fetches a linked item's full record when that item matters.issue.bodyandpullRequest.bodyare the same text. The prompt keeps it underissueand puts"[same as issue.body]"inpullRequest. If the two reads differ, both stay.pullChecksgives counts by outcome and lists only runs/statuses that did not pass. Before, it listed up to 100 runs, most of them green.relatedItems,closingPullRequestsandreferencingMergedPullRequestskeep identity, state, title, labels and why they are linked. Their bodies are omitted only when the reviewer can read GitHub (allowlisted-proxyorunrestricted). With no network they stay inline as before.gh issue view/gh pr viewreads.Only the prompt view changes (
src/clawsweeper-prompt-context.ts). Collected context, source-revision digests, check digests, close guards and reports are untouched. Policy v32.Why
A dumped prompt for openclaw/openclaw#167298 was 190k chars. 49k chars were related-item bodies (each linked PR body sent twice), 11k chars were check runs, and the PR body appeared twice.
Proof
Shipped entry point, same PR, run with a hosted-like Codex home (
.github/actions/setup-codex/review-permissions.toml,--codex-sandbox clawsweeper-review, read-onlyGH_TOKEN):pnpm run review -- --local-only --target-repo openclaw/openclaw --item-number 167298 --codex-model gpt-6.1-sol --codex-sandbox clawsweeper-review --output-retention debug --artifact-dir <dir>Correction (after merge): on the branch the reviewer tried to read the two linked items it cared about (
gh issue view 87637 --json body,comments; gh pr view 92165 --json body,comments), but both reads failed with HTTP 403: the review network allows only read methods, and these commands use GraphQLPOST. The verdict above came without those bodies. The follow-up PR points reviewers at RESTgh apireads, which succeed under the same profile.Tests: linked-item bodies are omitted with network and kept without it; checks are counted and only non-passing ones listed; the primary body appears once with its coverage under
issue.pnpm run checkpasses.Codex
/reviewP2 (deduping long bodies by their 12,000-unit prefix could drop a PR body edited late between the two reads) fixed inb53848280: the PR body is deduped only whenprimaryBodySourceSha256matches. Regression test: same prefix, different late proof trace keeps both bodies and the PR source hash; it fails on the prefix comparison and passes now.Limits: one PR compared; review verdicts are model output and can vary between runs.
Merge Danger
Door: two-way: prompt shape only; revert restores the old view.
Blast radius: every hosted review prompt. If the reviewer skips a linked item it needed, that item's detail is missing from the decision; the prompt names the read to use.