6cb45561

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

Total

1m45s

Time to Start Worker time Duration Time to finish Idle
Config 1s 8s 8s 10s 1s
Eval 7s 54s 54s 1m02s 0s
Build 57s 1m15s 49s 1m47s 0s
Suite 1s 2m18s 1m45s 1m47s 1s

Timeline

Config Eval Build
0s10s20s30s40s50s1m1m10s1m20s1m30s1m40s