feat(FN-828): lock in compaction behavior with comments and regression tests

- Add explicit comments to pi.ts documenting auto-compaction behavior during agent context management
- Add regression tests verifying compaction triggers correctly and preserves conversation integrity
- Document auto-compaction behavior in README under AI Engine section
This commit is contained in:
gsxdsm
2026-04-04 00:02:33 -07:00
parent 383f2789e7
commit 93e693534c
3 changed files with 44 additions and 1 deletions

View File

@@ -196,6 +196,11 @@ export async function createKbAgent(options: AgentOptions): Promise<AgentResult>
? createReadOnlyTools(options.cwd)
: createCodingTools(options.cwd);
// Compaction is explicitly enabled to prevent context-window overflow during
// long-running agent conversations (triage, execution, review, merge).
// When the context fills up, pi auto-compacts the conversation history to
// keep the session alive without manual intervention. This must remain enabled
// as a reliability safeguard — disabling it would cause overflow failures.
const settingsManager = SettingsManager.inMemory({
compaction: { enabled: true },
retry: { enabled: true, maxRetries: 3 },