superpowers/tests/pi
Jesse Vincent 5802204a18 fix(pi): inject the bootstrap on every prompt, not just the first (#2083)
The pi extension cleared injectBootstrap on agent_end, assuming it marked
the end of a session. pi emits agent_end at the end of every agent run,
which is once per user prompt, so from the second prompt on no provider
request carried the using-superpowers bootstrap.

The messages a context handler returns are sent to the provider but are
not written to session history, so the bootstrap is never in
event.messages on a later call and the existing marker check cannot see
an earlier injection. The bootstrap therefore has to be injected into
every provider request. Removing the agent_end disarm does exactly that,
one copy per request at a stable position at the start of the messages.

Observed against pi 0.85.1 with a local stub OpenAI-compatible provider,
one session of three prompts (the second makes a tool call): before, only
request 1 of 4 carried the bootstrap; after, all 4 carry exactly one copy.

The test that asserted the disarm as intended behaviour is replaced by
one that drives pi's per-prompt lifecycle events across several prompts
and provider requests. The porting guide described the agent_end reset
as the pattern to copy and now describes the failure instead.

Claude-Session: https://claude.ai/code/session_01SHANcr4A71nzuU9et4Fnba
2026-10-22 22:56:05 +00:00
..
test-pi-extension.mjs fix(pi): inject the bootstrap on every prompt, not just the first (#2083) 2026-10-22 22:56:05 +00:00