revert(truncation-compaction): rollback to experimental opt-in config (#348)

This commit is contained in:
Sisyphus
2025-12-30 20:42:06 +09:00
committed by GitHub
parent 355f18d411
commit 058e6adf96
9 changed files with 62 additions and 40 deletions

View File

@@ -49,7 +49,6 @@ export const HookNameSchema = z.enum([
"session-notification",
"comment-checker",
"grep-output-truncator",
"tool-output-truncator",
"directory-agents-injector",
"directory-readme-injector",
"empty-task-response-detector",
@@ -164,12 +163,14 @@ export const DynamicContextPruningConfigSchema = z.object({
export const ExperimentalConfigSchema = z.object({
aggressive_truncation: z.boolean().optional(),
auto_resume: z.boolean().optional(),
/** Enable preemptive compaction at threshold (default: true) */
/** Enable tool output truncator - dynamically truncates tool outputs based on context window (default: false) */
tool_output_truncator: z.boolean().optional(),
/** Enable preemptive compaction at threshold (default: false) */
preemptive_compaction: z.boolean().optional(),
/** Threshold percentage to trigger preemptive compaction (default: 0.80) */
preemptive_compaction_threshold: z.number().min(0.5).max(0.95).optional(),
/** Truncate all tool outputs, not just whitelisted tools (default: true) */
truncate_all_tool_outputs: z.boolean().default(true),
/** Truncate all tool outputs, not just whitelisted tools (default: false, only applies when tool_output_truncator is enabled) */
truncate_all_tool_outputs: z.boolean().optional(),
/** Dynamic context pruning configuration */
dynamic_context_pruning: DynamicContextPruningConfigSchema.optional(),
/** Enable DCP (Dynamic Context Pruning) for compaction - runs first when token limit exceeded (default: false) */

View File

@@ -82,7 +82,7 @@ export function createPreemptiveCompactionHook(
const experimental = options?.experimental
const onBeforeSummarize = options?.onBeforeSummarize
const getModelLimit = options?.getModelLimit
const enabled = experimental?.preemptive_compaction !== false
const enabled = experimental?.preemptive_compaction === true
const threshold = experimental?.preemptive_compaction_threshold ?? DEFAULT_THRESHOLD
if (!enabled) {

View File

@@ -24,7 +24,7 @@ interface ToolOutputTruncatorOptions {
export function createToolOutputTruncatorHook(ctx: PluginInput, options?: ToolOutputTruncatorOptions) {
const truncator = createDynamicTruncator(ctx)
const truncateAll = options?.experimental?.truncate_all_tool_outputs ?? true
const truncateAll = options?.experimental?.truncate_all_tool_outputs ?? false
const toolExecuteAfter = async (
input: { tool: string; sessionID: string; callID: string },

View File

@@ -255,7 +255,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
const commentChecker = isHookEnabled("comment-checker")
? createCommentCheckerHooks(pluginConfig.comment_checker)
: null;
const toolOutputTruncator = isHookEnabled("tool-output-truncator")
const toolOutputTruncator = pluginConfig.experimental?.tool_output_truncator === true
? createToolOutputTruncatorHook(ctx, { experimental: pluginConfig.experimental })
: null;
const directoryAgentsInjector = isHookEnabled("directory-agents-injector")