meta-reviewing-ai-reviewing
AI Code Review Patterns
Quick Guide: A model call is untrusted in both directions, so the review follows every user-controlled string into the prompt it lands in, and every response out to whatever it drives. Four facts about current providers change what counts as a defect. The Anthropic and OpenAI SDKs retry twice and time out after ten minutes by default, so a call with no options is protected but too patient for a person waiting, and a retry wrapper around it multiplies attempts. A response cut off at the token limit, or refused, arrives as a successful call. A stream can fail after its 200. And current reasoning models reject a non-default
temperature, so setting one buys a 400 rather than determinism.
Detailed Resources:
- examples/core.md — the defect and its fix for each pattern below
- reference.md — per-provider lookup: SDK retry and timeout defaults, stop and finish reasons, structured-output parameters, sampling parameters, history rules
<critical_requirements>
Before reviewing AI code
Trace every value interpolated into a prompt back to where it entered — retrieved documents and tool results included. Injection is a property of the chain rather than the line: input sanitised at the entry point and spliced raw at a later join is still injected, and a fetched page is as hostile as anything a user types.
Find what each model response is allowed to do, and check it is validated before it does it. A response that picks a handler, fills tool arguments, is stored, or is shown to another user is untrusted input; models return malformed and adversarial output at some rate forever, and the check between response and action decides what that rate costs.