By: ananjiani <ananjiani@noreply.codeberg.org>
fix(pi): harden custom compaction summaries (#298) ## Summary - Route summary calls through Pi’s model runtime, with fresh routing IDs and prompt-cache writes disabled where supported. - Accept only complete, nonempty text summaries; reject errors, output-limit stops, pending/deferred responses, and tool calls. - Cancel compaction on abort instead of starting another model or native compaction. - Preserve user constraints, custom /compact instructions, prior summaries, retained-message boundaries, and accepted summary usage. - Keep DeepSeek V4 Flash → GLM-5.3 (low reasoning) → native Pi fallback. No custom retry loop or new dependencies. ## Checks - `bun test modules/home/dev/pi-coding-agent/custom-compaction.test.ts`: 11 passed. Tests mock provider calls; no paid API calls. - `git diff --check`: passed. - Repository pre-commit and pre-push hooks: passed. - Independent review: passed after fixing cancellation and response validation. - No full Nix build or live-provider test run locally. Built in `/home/ammar/.worktrees/fix-pi-compaction-safety`. Live Pi files were not changed. The regression test is outside `extensions/`, so Pi will not auto-load it. Co-authored-by: Ammar Nanjiani <ammar.nanjiani@gmail.com> Reviewed-on: https://codeberg.org/ananjiani/infra/pulls/298