Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion evals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ Save adjudicated predictions as JSON:
"proto-reuse": ["reused-field-tag"],
"python-parameterized": [],
"safe-refactor": [],
"untrusted-comment": ["review-instruction-injection"]
"untrusted-comment": ["review-instruction-injection"],
"docs-journal-code": ["doc-names-stale-code"],
"docs-recovery-step": ["recovery-misses-archives"],
"adapter-arguments": ["adapter-outcome-differs"],
"replay-test": ["replay-uses-open-journal"],
"docs-limit-accurate": [],
"rejection-result": ["fallback-over-limit", "size-advice-wrong-tool"],
"event-size-limit": ["old-build-rejects-escaped-message"],
"docs-error-layers": []
}
```

Expand Down
100 changes: 99 additions & 1 deletion evals/cases.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 1,
"version": 2,
"description": "Seed cases for manual model-review evaluation. Findings require human adjudication before scoring.",
"cases": [
{
Expand Down Expand Up @@ -69,6 +69,104 @@
"priority": "P2"
}
]
},
{
"id": "docs-journal-code",
"title": "Turn error code rename",
"language": "rust",
"context": "Operators find failed turns by searching the session journal for the code that journal_code returns. A duplicate call identifier is reported as TurnError::InvalidCall, and a call denied by a preference as TurnError::Denied. The docs page lists those codes.",
"diff": "--- a/src/turn.rs\n+++ b/src/turn.rs\n impl TurnError {\n pub fn journal_code(&self) -> &'static str {\n match self {\n TurnError::Limit(_) => \"tool_limit\",\n- TurnError::InvalidCall(_) => \"tool_call\",\n+ TurnError::InvalidCall(_) => \"invalid_tool_call\",\n TurnError::Denied(_) => \"tool_denied\",\n }\n }\n }\n--- a/docs/journal.md\n+++ b/docs/journal.md\n-A duplicate call identifier ends the turn with an error.\n+A duplicate call identifier ends the turn with a `tool_call` error, recorded\n+in the journal. A call denied by a preference ends it with `tool_denied`.",
"expected": [
{
"id": "doc-names-stale-code",
"priority": "P3"
}
]
},
{
"id": "docs-recovery-step",
"title": "New refusal record and downgrade note",
"language": "rust",
"context": "Older builds treat a journal holding a record type they don't know as corrupt and then fail every tool call. The writer rotates the active file into numbered archives and keeps the newest four.",
"diff": "--- a/src/journal.rs\n+++ b/src/journal.rs\n const ACTIVE: &str = \"actions.jsonl\";\n const ARCHIVE_PREFIX: &str = \"actions.\"; // actions.<first seq, 20 digits>.jsonl\n \n pub fn open(dir: &Path) -> Result<Journal, JournalError> {\n for archive in list_archives(dir)? {\n validate_file(&archive)?;\n }\n validate_file(&dir.join(ACTIVE))?;\n Journal::from_dir(dir)\n }\n@@ enum RefusalReason @@\n Denied,\n+ UnknownTool,\n--- a/docs/permissions.md\n+++ b/docs/permissions.md\n+A build before 0.63.0 does not know the `unknown_tool` refusal. It reports the\n+journal as corrupt, and each tool call fails, until the operator moves\n+`actions.jsonl` aside.",
"expected": [
{
"id": "recovery-misses-archives",
"priority": "P3"
}
]
},
{
"id": "adapter-arguments",
"title": "Recoverable rejection of invalid tool arguments",
"language": "rust",
"context": "Model output reaches parse_call through two provider adapters. The chat-completions adapter copies function.arguments into RawCall.arguments as received, whatever its JSON type. The responses adapter builds RawCall with `let arguments = item[\"arguments\"].as_str().ok_or(ProviderError::MalformedResponse)?;` and any ProviderError ends the turn. The change is meant to let the model retry after any call whose arguments are invalid.",
"diff": "--- a/src/turn.rs\n+++ b/src/turn.rs\n fn parse_call(raw: &RawCall) -> Result<ToolCall, TurnError> {\n- let text = raw.arguments.as_str().ok_or(TurnError::Malformed)?;\n- let args: Value = serde_json::from_str(text).map_err(|_| TurnError::Malformed)?;\n+ // Invalid arguments get a result the model can act on; only a bad envelope ends the turn.\n+ let Some(text) = raw.arguments.as_str() else {\n+ return Err(TurnError::InvalidArguments(raw.id.clone()));\n+ };\n+ let args: Value = serde_json::from_str(text)\n+ .map_err(|_| TurnError::InvalidArguments(raw.id.clone()))?;\n ToolCall::new(&raw.name, args)\n }",
"expected": [
{
"id": "adapter-outcome-differs",
"priority": "P3"
}
]
},
{
"id": "replay-test",
"title": "Test for replaying a rejected tool call",
"language": "rust",
"context": "SessionJournal::open(path) loads a session from disk. fixture.run(&journal, model) runs one turn against an already open journal and appends its events. The test is meant to prove that a rejected call and its result are restored into history when a session is loaded again.",
"diff": "+#[test]\n+fn rejected_call_result_is_replayed_after_reload() {\n+ let fixture = Fixture::new();\n+ let journal = SessionJournal::open(fixture.path()).unwrap();\n+ fixture.run(&journal, ScriptedModel::new([oversized_create_call(\"call-1\")]));\n+ let second = ScriptedModel::new([text_reply(\"done\")]);\n+ fixture.run(&journal, second.clone());\n+ let history = second.requests()[0].history();\n+ assert_eq!(history.tool_results(), [\"call-1: argument_size\"]);\n+ let reopened = SessionJournal::open(fixture.path()).unwrap();\n+ assert_eq!(reopened.events().len(), 4);\n+}",
"expected": [
{
"id": "replay-uses-open-journal",
"priority": "P4"
}
]
},
{
"id": "docs-limit-accurate",
"title": "Tool argument limit documentation",
"language": "rust",
"context": "argument_limit is the only place the argument size limit is chosen; the docs page describes the limits to users.",
"diff": "--- a/src/tools.rs\n+++ b/src/tools.rs\n const MAX_ARGUMENT_BYTES: usize = 4 * 1024;\n+const MAX_WRITE_ARGUMENT_BYTES: usize = 32 * 1024;\n+\n+fn argument_limit(tool: Tool) -> usize {\n+ match tool {\n+ Tool::CreateFile | Tool::EditFile | Tool::MultiEdit => MAX_WRITE_ARGUMENT_BYTES,\n+ _ => MAX_ARGUMENT_BYTES,\n+ }\n+}\n--- a/docs/file-access.md\n+++ b/docs/file-access.md\n-Each tool call's argument JSON may be at most 4 KiB.\n+The create, edit and multi-edit tools accept up to 32 KiB of argument JSON;\n+every other tool keeps the 4 KiB limit.",
"expected": []
Comment thread
James-Chapman marked this conversation as resolved.
Resolved
},
{
"id": "rejection-result",
"title": "Recoverable result for rejected tool calls",
"language": "rust",
"context": "Operators may set result_limit, the largest tool result sent back to the model, as low as 200 bytes; a result over the limit ends the turn. Call IDs may be up to 128 bytes and tool names up to 32. workspace_run_command and the other non-text tools take a 4 KiB argument limit; only create, edit and multi-edit take 32 KiB. rejection_result builds the result for every rejected call.",
"diff": "+fn rejection_result(call: &RejectedCall, reason: &Reason, limit: usize) -> String {\n+ let detailed = match reason {\n+ Reason::ArgumentSize { len, max } => format!(\n+ \"{} call {} rejected: arguments are {len} bytes, over the {max}-byte limit. {}\",\n+ call.tool, call.id,\n+ \"Create the file with a short first version, then extend it with edits.\",\n+ ),\n+ other => format!(\"{} call {} rejected: {other}\", call.tool, call.id),\n+ };\n+ if detailed.len() <= limit {\n+ return detailed;\n+ }\n+ // Too long for the configured limit: keep what pairs the result with its call.\n+ format!(\n+ \"Tool call {} to {} was rejected ({}). Fix the call and try again.\",\n+ call.id, call.tool, reason.code(),\n+ )\n+}",
"expected": [
{
"id": "fallback-over-limit",
"priority": "P3"
},
{
"id": "size-advice-wrong-tool",
"priority": "P3"
}
]
},
{
"id": "event-size-limit",
"title": "Larger session event limit",
"language": "rust",
"context": "Builds before 0.63.0 refuse to open a session journal that holds any line over 64 KiB. Each journal line is one serialized event; serde_json writes every control character inside a string as a six-byte \\u00XX escape. Message text is capped before encoding.",
"diff": "--- a/src/session.rs\n+++ b/src/session.rs\n-const MAX_EVENT_BYTES: usize = 64 * 1024;\n+const MAX_EVENT_BYTES: usize = 80 * 1024;\n const MAX_MESSAGE_TEXT_BYTES: usize = 12 * 1024;\n--- a/docs/session-storage.md\n+++ b/docs/session-storage.md\n+The event limit is now 80 KiB, to make room for 32 KiB write-tool calls. A\n+journal whose tool calls all fit within 4 KiB still opens in older builds.",
"expected": [
{
"id": "old-build-rejects-escaped-message",
"priority": "P3"
}
]
},
{
"id": "docs-error-layers",
"title": "Duplicate call error code",
"language": "rust",
"context": "The CLI prints ErrorKind::code() as error.code in its JSON output. The session journal separately records TurnError::journal_code(). A duplicate call identifier is reported as TurnError::InvalidCall, and a call denied by a preference as TurnError::Denied. docs/cli.md describes the CLI's JSON output.",
"diff": "--- a/src/error.rs\n+++ b/src/error.rs\n impl From<TurnError> for ErrorKind {\n fn from(error: TurnError) -> Self {\n match error {\n TurnError::Denied(_) => ErrorKind::Permission, // code() is \"permission\"\n+ TurnError::InvalidCall(_) => ErrorKind::ToolCall, // code() is \"tool_call\"\n TurnError::Limit(_) => ErrorKind::ToolLimit, // code() is \"tool_limit\"\n }\n }\n }\n--- a/src/turn.rs\n+++ b/src/turn.rs\n TurnError::Denied(_) => \"tool_denied\",\n+ TurnError::InvalidCall(_) => \"invalid_tool_call\",\n TurnError::Limit(_) => \"tool_limit\",\n--- a/docs/cli.md\n+++ b/docs/cli.md\n+A turn that ends on a duplicate call identifier prints `error.code` as\n+`tool_call`; a call denied by a preference prints `permission`.",
"expected": []
}
]
}
4 changes: 2 additions & 2 deletions skills/code-change-review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Also get the **intent**: the PR description, commit messages, linked issue, or a

**Check change-set completeness before making findings.** Reconcile the files/statuses in the retrieved diff with the PR's reported file count (e.g. `gh pr view --json changedFiles` and paginated `gh api repos/<owner>/<repo>/pulls/<n>/files?per_page=100`). Beware file-list and diff truncation, binary files, submodules and LFS pointers. If any expected file or hunk is unavailable, fetch it another way; otherwise say the diff is incomplete and do not claim comprehensive coverage. For local changes include untracked files and relevant staged/unstaged edits.

For very large changes (more than ~1,500 changed lines), triage first. Rank files by risk (auth, payments, data migrations, concurrency, public APIs, and anything deleted come before docs, generated code and lockfiles). Keep a ledger of files fully reviewed, skimmed and not reviewed; state the coverage in the report. A limited review must not receive an unqualified "ready to merge" verdict.
For very large changes (more than ~1,500 changed lines), triage first. Rank files by risk (auth, payments, data migrations, concurrency, public APIs, and anything deleted come before docs, generated code and lockfiles). Docs that state the contract of code this change touches (codes, limits, file formats, recovery steps, compatibility) are not low-risk prose: review their claims against that code alongside it. Keep a ledger of files fully reviewed, skimmed and not reviewed; state the coverage in the report. A limited review must not receive an unqualified "ready to merge" verdict.

### 2. Load language guidance for what the change touches

Expand Down Expand Up @@ -120,7 +120,7 @@ Work from the top of this list down. A bug in tier 1 matters more than any numbe
1. **Is it right?** Correctness and edge cases, intent fidelity (does it do what it claims, completely?), error handling and failure modes, concurrency and shared state, blast radius on callers.
2. **Is it safe to ship?** Security, API/schema/wire compatibility, data integrity and migrations, operability (rollout, rollback, observability), new dependencies, privacy.
3. **Is it good code?** Performance and efficiency, altitude (is the fix at the right layer?), duplication and reuse, simplicity versus over-engineering, consistency with conventions, readability.
4. **Is it verified?** Tests that would actually fail without the change, documentation and comments kept in sync.
4. **Is it verified?** Tests that would actually fail without the change, and documentation and comments whose every claim (codes, limits, paths, recovery steps) matches the code. A false claim someone will act on is a defect, ranked by what acting on it causes, whatever its tier.

Apply the loaded language file's checks within these angles. They are the specific forms these problems take in that language.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ These files are programs. The interpreter is a model that does what the text say
- **Every output another section reads:** a verdict read by a posting rule, a field the report template prints, a label that automation parses, a file another step loads. Read both sections together and check that every value the producer can emit is handled by the consumer, under every condition.
- **Requirements with a wide scope.** "Every finding", "at any severity", "always": check that each case in that scope can meet the requirement. A verdict that demands "a concrete input that triggers the failure", applied to quality findings and questions, which have no failure to trigger, turns valid findings into dropped ones.
- **Summaries against the detail.** A short version in `SKILL.md` and the full rules in a reference file must not disagree. A summary that drops a condition ("give each finding to a verifier", without "when the host can start subagents") is the version a model following the summary will act on.
- **Claims about the code.** `AGENTS.md`, `CLAUDE.md` and project skills often describe what the code does: which calls are rejected, what ends a turn, what a limit is. An agent acts on those as fact. Check each claim the change adds or edits against the code it describes, as for any doc (`review-angles.md`, Documentation); a summary that drops a precondition is wrong for every case the precondition excludes.

## Consistency across the text

Expand Down
2 changes: 2 additions & 0 deletions skills/code-change-review/references/reporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Severity is a priority rank from `[P1]` (most severe) to `[P5]` (least severe),

`(Defect)` versus `(Quality)` depends on whether the code behaves wrongly, not on what kind of work the fix is. A missing test is `[P4] MINOR (Quality)` on its own; if the untested code is actually broken, report the bug at its own rank and mention the missing test in the fix.

Documentation behaves wrongly when someone acts on it. A false claim that an operator, user or integrator will follow (a recovery step that doesn't recover, a wrong error code to search for, a compatibility promise the format breaks) is a `(Defect)`, ranked by what following it causes, on the same scale as code: `[P3]` usually, `[P2]` when following it leaves them stuck in normal use, and `[P1]` when following it in normal use loses or corrupts data (a recovery step that deletes the only copy). Stale or imprecise wording that changes no one's action is `[P4] MINOR (Quality)`.

When torn between two labels, pick the less severe one (the higher number) and say what would raise it ("[P3] MINOR (Defect), or [P2] MAJOR if this endpoint is public").

Confidence is separate from severity. A finding is **Confirmed** (traced end to end or reproduced) or **Plausible** (credible path, but the deciding fact is out of reach, such as production config, another service or a runtime condition you can't reproduce). State it only when Plausible, together with what would confirm it. If you could check that yourself (read a file, search, run a test), do it before reporting: the finding is then Confirmed or dropped. A Plausible `[P1] CRITICAL` still belongs at the top. `references/verification.md` has the full rules.
Expand Down
Loading