@oleg_tarasov/pi-compaction-fix
v0.0.2
Published
Pi extension that waits for overflow auto-compaction retry before headless prompt completion.
Maintainers
Readme
pi-compaction-fix
Pi extension for @mariozechner/pi-coding-agent 0.73.0.
It monkey-patches AgentSession.prompt() so headless pi --mode json -p / print-mode runs wait for overflow auto-compaction's scheduled retry before returning. This is intended as a temporary delivery mechanism for a Pi core fix, not as a permanent extension API pattern.
Why this exists
In Pi 0.73.0, normal auto-retry is awaited by AgentSession.prompt(), but overflow auto-compaction is handled later from the asynchronous agent-event queue. When a model request fails with context_length_exceeded, Pi can compact the session and schedule Agent.continue(), but a headless child process may return before that recovery run completes. pi-subagents then sees the context-overflow assistant error as terminal and marks the child failed.
Install
Install from npm with Pi's package installer:
pi install npm:@oleg_tarasov/pi-compaction-fixTo pin a specific release:
pi install npm:@oleg_tarasov/[email protected]To try the package for a single run without adding it to settings:
pi -e npm:@oleg_tarasov/pi-compaction-fixVerify
After install, run:
pi --mode json -p "/pi-compaction-fix-status"Expected status includes:
installed patch=overflow-auto-compaction-prompt-wait/2026-05-06Local development
For ad-hoc local use from a checkout:
pi --extension ./src/index.jsCheck syntax:
npm run checkSafety warning
The extension intentionally touches private Pi internals. It warns when the active Pi version is not the version it was checked against (0.73.0). When Pi is upgraded, re-verify or remove this extension.
