Repository navigation
feat(pi-extension): keep host system prompt parts separate - #243
Conversation
Pi hosts pass the system prompt as an array of parts and place provider cache breakpoints between them. Joining the parts into one string moved the whole prompt whenever any part changed. Append the guardrail prompt as its own part for arrays and keep the joined string for string or missing prompts.
|
Automated E2E review: blocked (fork PR, no maintainer approval yet)
Static read only. This is not E2E proof:
To unblock the review, a maintainer can approve running this SHA in the Devin session, and the full E2E review will then run against it. |
|
I haven't run anything for PR #243. It comes from the fork blyzer/betterwright, its author has no role in the repo, and no maintainer has approved running its code. I posted a comment on the PR explaining this. That comment includes a static read of the diff at head fff3dd9, which found no defects. No build, tests, real Pi flow, recordings or fix PRs were done. If you're a BetterWright maintainer, do you approve running this fork's code at fff3dd9 in this isolated VM? |
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryThe Pi extension now keeps host prompt parts separate and appends its operating guidance as one trailing part.
blyzer acknowledged a release-check test failure and reported that it also occurs on the unmodified base. Reviews (1) · Last reviewed commit: "feat(pi-extension): keep host system pro..." · Reviewed by Greptile |
What and why
The native Pi extension's
before_agent_starthook now appends its guardrail text as its own system prompt part when the host passes the prompt as an array. Before, it built${String(event.systemPrompt)}\n\n...: for an arrayString()joins the parts with commas, so the host's parts were lost, and the host's own parts layout was not preserved. I did not measure any cache effect from this. A string prompt (older hosts) keeps the previous behaviour.Checklist
bun run release:checkpasses locally. Not fully: under the pinned Bun 1.4.0, 1344 pass and 1 fails:unit runner executes TypeScript sources and ignores stale compiled files. It fails identically on the unmodified base on my machine and passes in CI. Under Bun 1.4.3 a second test,Bun 1.4 is the pinned project runtime, also fails (version pin). Everything else in the gate (versions, lint, typecheck, build, declarations, tarball) passed.bun run check:versionsis green.types/*.d.ts. No public API change.bun run test:typesandbun run check:packageare green.src/worker.tsordist/src/worker.js.CHANGELOG.md.How it was verified
tests/node/pi-extension.test.ts: "native Pi extension appends guardrails as a separate part when the host passes prompt parts". 14/14 pass in that file.src/pi-extension.tsreverted to the base, that test fails (13 pass, 1 fail).biome cion the changed files andbun run typecheckpass.BETTERWRIGHT_REQUIRE_BROWSER=1) because the change does not touch browser code.Behaviour change
String prompts are unchanged. Array prompts now get the guardrails as one extra trailing part. OMP's
before_agent_starttakes and returnssystemPrompt: string[], so an extension should return parts, not one joined string.