repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

test(klaus): pin the outbound system-prompt blocks

830ccbae9d37e631d96e80634fef847ea01746df

Oliver Krylow <o.krylow@isp-insoft.de> ·

SSH signature · not checked

Browse filesCompare with HEAD

Claude Code's preset carries commit, pull-request, and git-status content, and Klaus replaces it with Pi's prompt, so the specification requires an SDK upgrade to fail E2E when those blocks change.

Changed files (1)

extensions/klaus/__e2e__/provider-scenarios.test.ts

Modified
1647 1647 expect(childSessionId(requests[0])).not.toBe(childSessionId(requests[1]));
1648 1648 }, 120_000);
1650 + it("sends only Pi's system prompt and no Claude Code preset", async () => {
1651 + const server = await useServer((_request, index, response) =>
1652 + sse(response, textFrames(index, "system prompt checked")),
1653 + );
1655 + const result = await directQuery(
1656 + request({ systemPrompt: "Klaus pinned system prompt." }),
1657 + );
1659 + expect(result.error).toBeUndefined();
1660 + const system = (
1661 + server.messageRequests()[0]?.body as {
1662 + system?: Array<{ type: string; text: string }>;
1664 + )?.system;
1665 + if (!system) throw new Error("Request carried no system blocks.");
1666 + /** The Klaus specification requires an SDK upgrade to fail E2E when the
1667 + * system-prompt blocks change, so this pins every block Claude adds. */
1668 + expect(system).toHaveLength(3);
1669 + expect(system[0]?.text).toMatch(/^x-anthropic-billing-header: /);
1670 + expect(system[1]?.text).toBe(
1671 + "You are a Claude agent, built on Anthropic's Claude Agent SDK.",
1672 + );
1673 + expect(system[2]?.text).toBe("Klaus pinned system prompt.");
1674 + /** Claude Code's preset ships commit and pull-request instructions plus a
1675 + * git status snapshot; a custom system prompt must replace all of it. */
1676 + expect(JSON.stringify(system)).not.toMatch(
1677 + /git status|pull request|commit message|gh pr/i,
1678 + );
1679 + }, 120_000);
1650 1681 it("names the tool behind an invalid input schema rejection", async () => {
1651 1682 const server = await useServer((_request, _index, response) => {
1652 1683 response.writeHead(400, { "content-type": "application/json" });