Merge pull request 'fix(hub): enable SDK auto-compact for resumed sessions' (#40) from fix/sdk-auto-compact into main

Reviewed-on: EduCraft/curriculum-project-hub#40
This commit is contained in:
2026-07-30 17:13:15 +08:00
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -211,6 +211,12 @@ export async function runAgent(req: RunRequest): Promise<RunResult> {
settings: {
disableBundledSkills: true,
todoFeatureEnabled: true,
// Sessions are resumed across runs (ADR-0017). Without auto-compact
// the SDK jsonl grows unboundedly — a long-lived project session hit
// 31 MB / 1995 lines, making every API call resend the entire history
// and inflating a "change a title" task to 22 minutes. Let the SDK
// compact automatically when the context window fills.
autoCompactEnabled: true,
},
...(hasSkills && security.skillPluginRoot !== undefined
? { plugins: [{ type: "local" as const, path: security.skillPluginRoot, skipMcpDiscovery: true }] }
+1 -1
View File
@@ -113,7 +113,7 @@ describe("runAgent", () => {
permissionMode: "bypassPermissions",
allowDangerouslySkipPermissions: true,
settingSources: [],
settings: { disableBundledSkills: true, todoFeatureEnabled: true },
settings: { disableBundledSkills: true, todoFeatureEnabled: true, autoCompactEnabled: true },
tools: expect.arrayContaining(["Read", "Write", "Edit", "Bash", "Glob", "Grep", "TodoWrite"]),
allowedTools: expect.arrayContaining(["TodoWrite", "mcp__cph_hub__todo_write"]),
disallowedTools: expect.arrayContaining(["Agent", "SendMessage", "Task", "TeamCreate", "ScheduleWakeup"]),