@oleg_tarasov/pi-compaction-fix

Pi extension that waits for overflow auto-compaction retry before headless prompt completion.

Package details

extension

Install @oleg_tarasov/pi-compaction-fix from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@oleg_tarasov/pi-compaction-fix
Package
@oleg_tarasov/pi-compaction-fix
Version
0.0.2
Published
May 6, 2026
Downloads
not available
Author
oleg_tarasov
License
UNLICENSED
Types
extension
Size
9.3 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/index.js"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

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-fix

To pin a specific release:

pi install npm:@oleg_tarasov/pi-compaction-fix@0.0.2

To try the package for a single run without adding it to settings:

pi -e npm:@oleg_tarasov/pi-compaction-fix

Verify

After install, run:

pi --mode json -p "/pi-compaction-fix-status"

Expected status includes:

installed patch=overflow-auto-compaction-prompt-wait/2026-05-06

Local development

For ad-hoc local use from a checkout:

pi --extension ./src/index.js

Check syntax:

npm run check

Safety 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.