豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Chat Debug: Adds per-file size capping to prevent unbounded growth of chat debug#4390

Merged
vijayupadya merged 3 commits intomainfrom
vijayu/debugFileRolling
Mar 13, 2026
Merged

Chat Debug: Adds per-file size capping to prevent unbounded growth of chat debug#4390
vijayupadya merged 3 commits intomainfrom
vijayu/debugFileRolling

Conversation

@vijayupadya
Copy link
Copy Markdown
Contributor

When a session's log file exceeds 100MB, the oldest ~20% of events are truncated using an efficient byte-offset seek, retaining the newest 80MB. This keeps recent events (most useful for debugging) while bounding disk usage.

…JSONL log files during long-running sessions.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds per-file size capping to chat debug log files. When a session log exceeds 100 MB, the oldest ~20% of events are truncated in-place, retaining the newest ~80 MB.

Changes:

  • Introduces MAX_SESSION_LOG_BYTES (100 MB) and TRUNCATION_RETAIN_BYTES (80 MB) constants
  • After each flush/write, checks if the file exceeds the cap and triggers truncation
  • Truncation reads the tail portion of the file and rewrites it, seeking to the nearest newline boundary

Comment thread src/extension/chat/vscode-node/chatDebugFileLoggerService.ts Outdated
Comment thread src/extension/chat/vscode-node/chatDebugFileLoggerService.ts
@vijayupadya vijayupadya marked this pull request as ready for review March 13, 2026 00:17
@vijayupadya vijayupadya enabled auto-merge March 13, 2026 00:17
@vijayupadya vijayupadya added this pull request to the merge queue Mar 13, 2026
Merged via the queue into main with commit 168c09e Mar 13, 2026
19 checks passed
@vijayupadya vijayupadya deleted the vijayu/debugFileRolling branch March 13, 2026 01:01
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.

3 participants