Skip to content

fix(console): terminate generation stats line with a newline (#2285)#2317

Closed
Anai-Guo wants to merge 1 commit into
LostRuins:concedofrom
Anai-Guo:fix/stats-line-newline-2285
Closed

fix(console): terminate generation stats line with a newline (#2285)#2317
Anai-Guo wants to merge 1 commit into
LostRuins:concedofrom
Anai-Guo:fix/stats-line-newline-2285

Conversation

@Anai-Guo

@Anai-Guo Anai-Guo commented Jul 9, 2026

Copy link
Copy Markdown

Summary

Fixes #2285 — the post-generation stats line runs into the next log message with no line break:

... Total:4.23sstate_write_data: writing state

Cause

The stats line in gpttype_adapter.cpp is printed with a leading \n and no trailing one:

printf("\n[%s] CtxLimit:%d/%d, Init:%.2fs, ... Total:%.2fs", ...);

This relies on the next koboldcpp print also starting with \n. But llama.cpp's state_write_data: writing state message (emitted when save-state runs right after generation) has no leading newline, so it gets glued onto the end of the stats line.

Since that message comes from vendored llama.cpp, the correct-layer fix is to terminate koboldcpp's own stats line.

Fix

Append \n to the stats printf format string so the line is always terminated regardless of what prints next. One-character change, no behavioral impact on the numbers reported.

🤖 Generated with Claude Code

…#2285)

The post-generation stats line (`[time] CtxLimit:... Total:...`) was
printed without a trailing newline, relying on the next koboldcpp print
starting with `
`. When llama.cpp's `state_write_data: writing state`
message (which has no leading newline) is emitted right after, it gets
glued onto the end of the stats line.

Append `
` to the stats printf so the line is always terminated,
regardless of what prints next.

Assisted-by: Claude
LostRuins added a commit that referenced this pull request Jul 10, 2026
@LostRuins

Copy link
Copy Markdown
Owner

Thanks but I think this is overkill, we don't want a double newline every time this prints. Instead, we can simply add the missing newline before saving state. It's fine as it's just a tiny change.

Fixed in 39654ab

@LostRuins LostRuins closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minor logging bug in latest rolling release

2 participants