Repository navigation
fix(sequentialthinking): count header rows toward the log box's row cap - #5535
Conversation
A long branchId wraps onto header rows that MAX_BOX_ROWS did not count, so it could draw past the cap #5433 set for the thought's rows. The header's rows now count toward the cap, and a header too long for it is cut, its last row saying how many characters it left out. Closes #5526 Signed-off-by: cliffhall <cliff@futurescale.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 1fde546 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
| Tools | Prompts | Resources | Resource templates | |
|---|---|---|---|---|
| Base | 1 | 0 | 0 | 0 |
| Head | 1 | 0 | 0 | 0 |
Updated by this run for 1fde546c6d63a7867756c5a8ca9adc13df30d6af.
There was a problem hiding this comment.
🟡 Changes recommended
A critical issue remains: embedded newlines in branch IDs bypass the output row cap, requiring header newline handling and a regression test.
1 open issue
What changed in this PR
This PR addresses #5526 by including header rows in the sequentialthinking server’s stderr log-box budget, without changing tool inputs, results, or stored thoughts.
Changes:
- Count wrapped header rows toward the shared 1,000-row cap.
- Truncate oversized headers with an omitted-character summary.
- Update regression tests, logging documentation, and patch release metadata.
| File | Description |
|---|---|
src/sequentialthinking/README.md |
Documents the shared row cap and header truncation. |
src/sequentialthinking/lib.ts |
Budgets header and thought rows together and truncates oversized headers. |
src/sequentialthinking/__tests__/thought-logging.test.ts |
Adjusts cap expectations and tests long headers. |
.changeset/sequentialthinking-header-row-cap.md |
Records the logging fix for a patch release. |
Review effort: Balanced
A line ending in a branchId started a line of stderr output that the row cap never counted, so 2,000 newlines still drew about 2,000 lines. The header now shows each as \r or \n, keeping it on rows the box draws and MAX_BOX_ROWS counts. From Copilot's first review of #5535. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
|
Copilot round 1: one finding, fixed in 1fde546.
|
|
| Tools | Prompts | Resources | Resource templates | |
|---|---|---|---|---|
| Base | 14 | 2 | 0 | 0 |
| Head | 14 | 2 | 0 | 0 |
tools
--- base/tools.json
+++ target/tools.json
- tools[git_remote].description: "Lists the repository's remotes with their fetch and push URLs, like `git remote -v`. Credentials emb..."
+ tools[git_remote].description: "Lists the repository's remotes with their fetch and push URLs, like `git remote -v`. Credentials emb..."Updated by this run for 1fde546c6d63a7867756c5a8ca9adc13df30d6af.
|
Copilot round 2: clean ("No open issues"; the round-1 finding is marked resolved). The review loop has converged. |

Closes #5526
Description
The sequentialthinking server's stderr thought box capped the thought's rows at
MAX_BOX_ROWS(1000, #5433), but not the header's. A longbranchIdwraps onto header rows of its own, so it could draw past the cap: a 200,000-characterbranchIddrew 2,001 header rows for a one-line thought.The header's rows now count toward
MAX_BOX_ROWS. The thought gets whatever rows the header leaves. A header too long for every row is cut: it keepsMAX_BOX_ROWS - 1rows, and its last row says how many characters it left out. Only the part of the header that can fit is wrapped, so a hugebranchIdalso does no more work than the cap allows. This is the issue's preferred fix, "in the component's existing style"; the input schema is unchanged, so no client sending a longbranchIdis newly rejected.Server Details
formatThoughtinlib.ts), its README paragraph, and a patch changeset. Tools, schema and tool results are unchanged.Motivation and Context
#5526: the header passthrough reproduced, through the header, the output amplification that #5433 closed for the body.
How Has This Been Tested?
Tests:
thought-logging.test.tsadds a test that a wrapped header's rows count toward the cap, and one that a header longer than the cap is cut with the "characters not shown" row and a box of bounded size. The four existing cap tests now give the thoughtMAX_BOX_ROWS - 1rows, because the one-row header counts.npm run local:gateexits 0.lib.tscoverage: 100% lines, statements and functions; 98% branches.Inspector CLI (
@modelcontextprotocol/inspector@2.12.0 --cli), in both eras (--protocol-era legacyand--protocol-era modern). Each run makes onetools/calltosequentialthinkingwiththought: "t",branchFromThought: 1and a 200,000-characterbranchId. The table counts the│rows of the stderr box:v2/mainthoughtHistoryLength: 1, one branch of 200,000 charsv2/main… 100136 more characters not shown,… 1 more line not shownThe 1,001 rows are the 1,000-row cap plus the thought's summary row. The tool result is identical before and after.
LLM client (Claude Code,
claude -p, with the built server over stdio). Prompt: "Use the sequentialthinking tool to think in 3 steps about whether to cache a slow API. Make thought 3 a branch from thought 1 with branchId 'no-cache'. Then report, verbatim, the 'branches' and 'thoughtHistoryLength' fields from the last tool result." The model made three calls, with thought 3 branched as asked, and reported"branches":["no-cache"]and"thoughtHistoryLength":3. The change is to stderr only, which an LLM client does not see, so this run is a regression check that ordinary branch thoughts still work.Breaking Changes
None. No client configuration changes. The stderr box of an ordinary thought now draws one fewer thought row before its summary, because the header row counts toward the 1000-row cap.
Types of changes
Checklist
npm run changeset) if this changes what a TypeScript server publishesAdditional context
Out of scope, per the issue's chosen fix: the
branchIdis still echoed whole in each result'sbrancheslist and kept whole in the history (bounded in count byMAX_THOUGHT_HISTORY, #2912). Capping its length in the input schema would be an interface change for clients, and the issue offered it only as an alternative.🤖 Generated with Claude Code