From 90625114282bfb37a968e0a661759f9a3a5922f4 Mon Sep 17 00:00:00 2001 From: Askhz <1361267452@qq.com> Date: Mon, 18 May 2026 16:11:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E7=A6=81=E7=94=A8=20CONTEXT=5FCOLLA?= =?UTF-8?q?PSE=20=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=8A=A8=E5=8E=8B=E7=BC=A9?= =?UTF-8?q?=E4=B8=8D=E8=A7=A6=E5=8F=91=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CONTEXT_COLLAPSE 是空壳 stub,启用后会在 shouldAutoCompact() 中抑制 autocompact,但自身的 collapse 能力并未实现,导致上下文超限后不会触发 自动压缩,一直涨到 API 返回 413 硬报错。 上游已在 0290fe32 修复,CSC 在合并 upstream/main v2.4.2 时漏掉了这个 变更。此次修复与上游一致:注释掉 defines.ts 和 dev.ts 中的 CONTEXT_COLLAPSE feature flag。 Co-Authored-By: CoStrict-DeepSeek-V4-Pro --- scripts/defines.ts | 2 +- scripts/dev.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/defines.ts b/scripts/defines.ts index c03657405..aaea5f6db 100644 --- a/scripts/defines.ts +++ b/scripts/defines.ts @@ -58,7 +58,7 @@ export const DEFAULT_BUILD_FEATURES = [ 'ACP', // ACP 代理协议,支持外部 agent 接入 'WORKFLOW_SCRIPTS', // 工作流脚本(.claude/workflows/ 中的 YAML/MD) 'HISTORY_SNIP', // 历史消息裁剪,压缩上下文窗口 - 'CONTEXT_COLLAPSE', // 上下文折叠,自动压缩旧消息 + // 'CONTEXT_COLLAPSE', // 已禁用:实现是空壳 stub,启用后会抑制 auto compact 导致上下文管理完全失效 'MONITOR_TOOL', // Monitor 工具,流式监控后台进程输出 // 'FORK_SUBAGENT', // Fork 子代理,显式 `fork: true` 参数触发,不影响 run_in_background 行为 // 'UDS_INBOX', // inbox 数组只增不减(非 GB 级主因) diff --git a/scripts/dev.ts b/scripts/dev.ts index 39d258284..3eca62bc6 100644 --- a/scripts/dev.ts +++ b/scripts/dev.ts @@ -40,7 +40,7 @@ const DEFAULT_FEATURES = [ // PR-package restored features "WORKFLOW_SCRIPTS", "HISTORY_SNIP", - "CONTEXT_COLLAPSE", + // "CONTEXT_COLLAPSE", // 已禁用:实现是空壳 stub,启用后会抑制 auto compact 导致上下文管理完全失效 "MONITOR_TOOL", "FORK_SUBAGENT", "UDS_INBOX", From 5b19f83040ab11d06e1771a112599141ef6c0cb8 Mon Sep 17 00:00:00 2001 From: Askhz <1361267452@qq.com> Date: Mon, 18 May 2026 16:49:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E7=A6=81=E7=94=A8=20build.ts=20?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=20CONTEXT=5FCOLLAPSE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 与 defines.ts 和 dev.ts 保持一致,构建产物中也不再启用空壳 CONTEXT_COLLAPSE,恢复 autocompact 正常工作。 Co-Authored-By: CoStrict-DeepSeek-V4-Pro --- build.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.ts b/build.ts index 5a2ad896e..4c3717d65 100644 --- a/build.ts +++ b/build.ts @@ -48,7 +48,7 @@ const DEFAULT_BUILD_FEATURES = [ // PR-package restored features 'WORKFLOW_SCRIPTS', 'HISTORY_SNIP', - 'CONTEXT_COLLAPSE', + // 'CONTEXT_COLLAPSE', // 已禁用:实现是空壳 stub,启用后会抑制 auto compact 导致上下文管理完全失效 'MONITOR_TOOL', 'FORK_SUBAGENT', // 'UDS_INBOX', From 2ae463a8fe6a628c9e00a467a8300130c3074bfa Mon Sep 17 00:00:00 2001 From: Askhz <1361267452@qq.com> Date: Mon, 18 May 2026 17:28:16 +0800 Subject: [PATCH 3/3] =?UTF-8?q?refactor:=20dev.ts=20=E5=92=8C=20build.ts?= =?UTF-8?q?=20=E7=BB=9F=E4=B8=80=E4=BB=8E=20defines.ts=20=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=20feature=20flags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前三个文件各自维护独立的 feature 列表,导致合并时容易漏掉变更 (如 CONTEXT_COLLAPSE 在 defines.ts 已禁用但 build.ts 仍启用)。 现在 dev.ts 和 build.ts 都从 defines.ts 导入 DEFAULT_BUILD_FEATURES, 与上游保持一致的单一定义源模式。 Co-Authored-By: CoStrict-DeepSeek-V4-Pro --- build.ts | 40 ++-------------------------------------- scripts/dev.ts | 34 ++-------------------------------- 2 files changed, 4 insertions(+), 70 deletions(-) diff --git a/build.ts b/build.ts index 4c3717d65..745866950 100644 --- a/build.ts +++ b/build.ts @@ -1,6 +1,6 @@ import { readdir, readFile, writeFile, cp, unlink, mkdir } from 'fs/promises' import { join } from 'path' -import { getMacroDefines } from './scripts/defines.ts' +import { getMacroDefines, DEFAULT_BUILD_FEATURES } from './scripts/defines.ts' const outdir = 'dist' @@ -23,44 +23,8 @@ if (process.env.SKIP_REVIEW_BUILTIN) { } } -// Default features that match the official CLI build. +// Feature flags imported from defines.ts (single source of truth). // Additional features can be enabled via FEATURE_=1 env vars. -const DEFAULT_BUILD_FEATURES = [ - 'AGENT_TRIGGERS_REMOTE', - 'CHICAGO_MCP', - 'VOICE_MODE', - 'SHOT_STATS', - 'PROMPT_CACHE_BREAK_DETECTION', - 'TOKEN_BUDGET', - // P0: local features - 'AGENT_TRIGGERS', - 'ULTRATHINK', - 'BUILTIN_EXPLORE_PLAN_AGENTS', - 'LODESTONE', - // P1: API-dependent features - 'EXTRACT_MEMORIES', - 'VERIFICATION_AGENT', - 'KAIROS_BRIEF', - 'AWAY_SUMMARY', - 'ULTRAPLAN', - // P2: daemon + remote control server - 'DAEMON', - // PR-package restored features - 'WORKFLOW_SCRIPTS', - 'HISTORY_SNIP', - // 'CONTEXT_COLLAPSE', // 已禁用:实现是空壳 stub,启用后会抑制 auto compact 导致上下文管理完全失效 - 'MONITOR_TOOL', - 'FORK_SUBAGENT', -// 'UDS_INBOX', - 'KAIROS', - 'COORDINATOR_MODE', - 'LAN_PIPES', - // 'REVIEW_ARTIFACT', // API 请求无响应,需进一步排查 schema 兼容性 - // P3: poor mode (disable extract_memories + prompt_suggestion) - 'POOR', - // P3: serve mode (HTTP API server) - 'DIRECT_CONNECT', -] // Collect FEATURE_* env vars → Bun.build features const envFeatures = Object.keys(process.env) diff --git a/scripts/dev.ts b/scripts/dev.ts index 3eca62bc6..7a54af2ba 100644 --- a/scripts/dev.ts +++ b/scripts/dev.ts @@ -6,7 +6,7 @@ */ import { join, dirname } from "node:path"; import { fileURLToPath } from "node:url"; -import { getMacroDefines } from "./defines.ts"; +import { getMacroDefines, DEFAULT_BUILD_FEATURES as DEFAULT_FEATURES } from "./defines.ts"; // Resolve project root from this script's location const __filename = fileURLToPath(import.meta.url); @@ -22,37 +22,7 @@ const defineArgs = Object.entries(defines).flatMap(([k, v]) => [ ]); // Bun --feature flags: enable feature() gates at runtime. -// Default features enabled in dev mode. -const DEFAULT_FEATURES = [ - "BUDDY", "TRANSCRIPT_CLASSIFIER", "BRIDGE_MODE", - "AGENT_TRIGGERS_REMOTE", "CHICAGO_MCP", "VOICE_MODE", - "SHOT_STATS", "PROMPT_CACHE_BREAK_DETECTION", "TOKEN_BUDGET", - // P0: local features - "AGENT_TRIGGERS", - "ULTRATHINK", - "BUILTIN_EXPLORE_PLAN_AGENTS", - "LODESTONE", - // P1: API-dependent features - "EXTRACT_MEMORIES", "VERIFICATION_AGENT", - "KAIROS_BRIEF", "AWAY_SUMMARY", "ULTRAPLAN", - // P2: daemon + remote control server - "DAEMON", - // PR-package restored features - "WORKFLOW_SCRIPTS", - "HISTORY_SNIP", - // "CONTEXT_COLLAPSE", // 已禁用:实现是空壳 stub,启用后会抑制 auto compact 导致上下文管理完全失效 - "MONITOR_TOOL", - "FORK_SUBAGENT", - "UDS_INBOX", - "KAIROS", - "COORDINATOR_MODE", - "LAN_PIPES", - // "REVIEW_ARTIFACT", // API 请求无响应,需进一步排查 schema 兼容性 - // P3: poor mode (disable extract_memories + prompt_suggestion) - "POOR", - // P3: serve mode (HTTP API server) - "DIRECT_CONNECT", -]; +// Default features imported from defines.ts (single source of truth). // Any env var matching FEATURE_=1 will also enable that feature. // e.g. FEATURE_PROACTIVE=1 bun run dev