Skip to content

Commit fa2b1c1

Browse files
piotrskiclaude
andcommitted
fix: enforce max-lines budget including truncation and summary footer
Reserve space for both the truncation message and summary footer when computing the max-lines cutoff, so --max-lines N never emits more than N lines. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9c80aa6 commit fa2b1c1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/agent-react-devtools/src/formatters.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ export function formatTree(nodes: TreeNode[], hintOrOpts?: string | FormatTreeOp
7979
let truncated = false;
8080

8181
function addLine(line: string): boolean {
82-
// Reserve 1 line for the summary footer if we have a totalCount
83-
const reserve = totalCount !== undefined ? 1 : 0;
82+
// Reserve lines for truncation message and summary footer
83+
const reserve = (totalCount !== undefined ? 1 : 0) + 1; // +1 for truncation line
8484
if (maxLines !== undefined && lines.length >= maxLines - reserve) {
8585
truncated = true;
8686
return false; // signal: stop adding

0 commit comments

Comments
 (0)