Skip to content

feat(protocol): 保留调用方 auto compact 窗口 - #607

Open
dofastted wants to merge 6 commits into
mainfrom
cursor/feat-auto-compact-window-4261
Open

dofastted wants to merge 6 commits into
mainfrom
cursor/feat-auto-compact-window-4261

Conversation

@dofastted

@dofastted dofastted commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

摘要

从已关闭的厨房水槽 #606 拆出的仅 auto_compact_window 变更(基于 main 670dd027)。

  • 协议页配置 routing.compatibility.auto_compact_window(100K–1M 或跟随模型)
  • 入站在 sanitizeInboundBody 前提取 CLAUDE_CODE_AUTO_COMPACT_WINDOW,经内部字段进入 CLI hop / native body
  • writeKernelConfig 写入 kernel 配置;清理后的 body 不再携带该 env

明确不包含

  • 种子页 UI / seed-settings API 行为
  • egress / migration / slot-bin

CHANGELOG

「未发布」一条;未改 VERSION。

Open in Web Open in Cursor 

Note

Medium Risk
Changes inbound sanitization order and outbound CLI/kernel job shape for context-window sizing; bounded validation limits blast radius, but misconfiguration could affect compaction behavior for Claude Code hops.

Reviewed by Cursor Bugbot for commit 6ed5560. Configure here.

@dofastted
dofastted marked this pull request as ready for review October 19, 2026 13:13

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6ed5560. Configure here.

const windowTokens = Number(autoCompactWindow)
if (Number.isInteger(windowTokens) && windowTokens >= 100_000 && windowTokens <= 1_000_000) {
body.auto_compact_window = windowTokens
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Inbound compact window not sanitized

Medium Severity

auto_compact_window is now a privileged job field, but inbound copies of it are never stripped. callerAutoCompactWindow only reads env, and prepareCliHopBody writes a validated value only when that env is in range. Otherwise officialMessagesBody still forwards a client-supplied top-level field, so it can override the panel/kernel default or reach the CLI with an unchecked number.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6ed5560. Configure here.

dofastted and others added 6 commits October 19, 2026 14:35
默认跟随请求模型,调用方窗口经内部字段送到当前 job,面板值可热配置。
窗口在入站清理前提取,再经内部字段进入 native body。
窗口必须在 settings 删除前提取,再传给 native body。
Co-authored-by: ted <kuhlmangarry24@gmail.com>
Co-authored-by: ted <kuhlmangarry24@gmail.com>
@cursor
cursor Bot force-pushed the cursor/feat-auto-compact-window-4261 branch from 3cc0203 to aa08107 Compare October 19, 2026 14:35
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.

2 participants