Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 43c2524

Browse files
committed
fix(read_file): default anchor_line to offset in indentation mode
When mode='indentation' but anchor_line is not provided, now defaults to the offset parameter (or 1 if neither is provided), rather than silently falling back to slice mode. This aligns with the documented behavior in packages/types/src/tool-params.ts.
1 parent 9fb16b8 commit 43c2524

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/core/tools/ReadFileTool.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,12 @@ export class ReadFileTool extends BaseTool<"read_file"> {
242242
private processTextFile(content: string, entry: InternalFileEntry): string {
243243
const mode = entry.mode || "slice"
244244

245-
if (mode === "indentation" && entry.anchor_line !== undefined) {
245+
if (mode === "indentation") {
246246
// Indentation mode: semantic block extraction
247+
// When anchor_line is not provided, default to offset (which defaults to 1)
248+
const anchorLine = entry.anchor_line ?? entry.offset ?? 1
247249
const result = readWithIndentation(content, {
248-
anchorLine: entry.anchor_line,
250+
anchorLine,
249251
maxLevels: entry.max_levels,
250252
includeSiblings: entry.include_siblings,
251253
includeHeader: entry.include_header,

0 commit comments

Comments
 (0)