What version of Kimi Code is running?
0.3.0
Which open platform/subscription were you using?
Kimi Code
Which model were you using?
No response
What platform is your computer?
Debian(WSL)
What issue are you seeing?
When reading a file that exceeds both the MAX_LINES and MAX_BYTES_KB limits, the <system> status tag in the tool result only reports the line limit. The byte limit is silently omitted even though it was also triggered.
For example, the status might say:
<system>... Max 1000 lines reached.</system>
But it does not mention that MAX_BYTES was also hit, which could mislead the model into thinking only the line cap mattered.
What steps can reproduce the bug?
-
Prepare a file that exceeds both MAX_LINES (1000) and MAX_BYTES_KB (100 KB) limits. For example, a file with 1001 lines where each line is very long (e.g., 120+ characters).
-
Use the Read tool to read this file.
-
Inspect the wire.jsonl file — in the tool result's <system> status tag, you will see:
<system>... Max 1000 lines reached.</system>
But not the Max 102400 bytes reached. message, even though the byte limit was also hit.
The root cause is in packages/agent-core/src/tools/builtin/file/read.ts: the limit checks are chained with else if, so when both maxLinesReached and maxBytesReached are true, only the first branch executes.
What is the expected behavior?
Both limits should be reported independently when both are triggered:
<system>... Max 1000 lines reached. Max 102400 bytes reached.</system>
The EOF message ("End of file reached.") should only appear when neither truncation limit was hit.
Additional information
The fix is straightforward — change else if to independent if statements and tighten the EOF condition. I have a branch ready and can open a PR once this issue is triaged.
What version of Kimi Code is running?
0.3.0
Which open platform/subscription were you using?
Kimi Code
Which model were you using?
No response
What platform is your computer?
Debian(WSL)
What issue are you seeing?
When reading a file that exceeds both the
MAX_LINESandMAX_BYTES_KBlimits, the<system>status tag in the tool result only reports the line limit. The byte limit is silently omitted even though it was also triggered.For example, the status might say:
But it does not mention that
MAX_BYTESwas also hit, which could mislead the model into thinking only the line cap mattered.What steps can reproduce the bug?
Prepare a file that exceeds both
MAX_LINES(1000) andMAX_BYTES_KB(100 KB) limits. For example, a file with 1001 lines where each line is very long (e.g., 120+ characters).Use the Read tool to read this file.
Inspect the
wire.jsonlfile — in the tool result's<system>status tag, you will see:But not the
Max 102400 bytes reached.message, even though the byte limit was also hit.The root cause is in
packages/agent-core/src/tools/builtin/file/read.ts: the limit checks are chained withelse if, so when bothmaxLinesReachedandmaxBytesReachedaretrue, only the first branch executes.What is the expected behavior?
Both limits should be reported independently when both are triggered:
The EOF message ("End of file reached.") should only appear when neither truncation limit was hit.
Additional information
The fix is straightforward — change
else ifto independentifstatements and tighten the EOF condition. I have a branch ready and can open a PR once this issue is triaged.