fix: improve review inline/body discipline and agent reliability

This commit is contained in:
2026-05-31 17:48:04 -05:00
parent b1cb1cce75
commit a847c1f3c9
3 changed files with 22 additions and 9 deletions
+5 -4
View File
@@ -4,7 +4,7 @@ import type { ToolContext } from "./server.ts";
import { execute, tool } from "./shared.ts";
/** Hard cap on returned content to avoid flooding the model's context window. */
const MAX_CHARS = 6000;
const MAX_CHARS = 20000;
export const ReadFileParams = type({
path: type.string.describe("absolute path to the file to read"),
@@ -17,9 +17,10 @@ export function ReadFileTool(_ctx: ToolContext) {
name: "read_file",
description:
"Read lines from a file. Use this to read sections of the PR diff returned by checkout_pr. " +
`Returns at most ${MAX_CHARS} characters — use narrow line ranges to stay within budget. ` +
"Read selectively: only the files most relevant to the review, not the entire diff at once. " +
"Example: `read_file({ path: diffPath, start_line: 5, end_line: 42 })`.",
`Returns at most ${MAX_CHARS} characters. ` +
"Prefer fewer, wider reads: read large contiguous ranges rather than many small ones. " +
"If the TOC lists 10 files, read 3-4 wide ranges that cover them rather than 10 separate calls. " +
"Example: `read_file({ path: diffPath, start_line: 5, end_line: 200 })`.",
parameters: ReadFileParams,
execute: execute(async ({ path, start_line, end_line }) => {
let content: string;