The best way to control Claude Code, Codex and more from any computer or phone
fix(pi): Pi agents get T3's pull request linking rules (#31727)
Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Fatih Yilmaz committed
Nov 19, 2026 at 12:16 UTC
54038e14eca280d7b5ff131fe8a146dd3e1efffc
2 files changed
+19
-2
packages/provider-pi/src/server/mcpExtensionSource.test.ts
+14
@@ -5,6 +5,7 @@ import * as NodeOS from "node:os";
5
import * as NodeModule from "node:module";
6
import * as NodeVM from "node:vm";
7
import { assert, describe, it } from "@effect/vitest";
8
+import { PULL_REQUEST_LINKING_INSTRUCTIONS } from "@t3tools/provider-core/server/runtimeInstructions";
9
10
import { PI_T3_MCP_EXTENSION_SOURCE, PI_T3_SERVICE_TIER_COMMAND } from "./mcpExtensionSource.ts";
11
import { loadMcpBridge } from "./mcpBridge.testkit.ts";
@@ -79,8 +80,21 @@ describe("Pi orchestration prompt section", () => {
80
assert.isDefined(result);
81
assert.isTrue(result!.systemPrompt.startsWith(`${event.systemPrompt}\n\n`));
82
assert.include(result!.systemPrompt, "orchestrator_capabilities");
83
+ assert.include(result!.systemPrompt, PULL_REQUEST_LINKING_INSTRUCTIONS);
84
}
85
});
86
+
87
+ it("sets the guidance section on Pi builds with prompt sections", async () => {
88
+ const bridge = await loadMcpBridge();
89
+ const sections: Record<string, string> = {};
90
+ const result = await bridge.handlers.get("before_agent_start")!(
91
+ { systemPrompt: "base", systemPromptOptions: { sections } },
92
+ { ui: { notify: assert.fail } },
93
+ );
94
+ assert.isUndefined(result);
95
+ assert.include(sections.t3_code_orchestration, "orchestrator_capabilities");
96
+ assert.include(sections.t3_code_orchestration, PULL_REQUEST_LINKING_INSTRUCTIONS);
97
+ });
98
});
99
100
describe("Pi project trust", () => {
packages/provider-pi/src/server/mcpExtensionSource.ts
+5
-2
@@ -1,5 +1,6 @@
1
// No T3 imports inside the string; resolve Pi and typebox from the user's Pi install.
2
import { T3_CODE_ORCHESTRATION_INSTRUCTIONS } from "@t3tools/provider-core/server/orchestrationInstructions";
3
+import { PULL_REQUEST_LINKING_INSTRUCTIONS } from "@t3tools/provider-core/server/runtimeInstructions";
4
5
export const PI_T3_MCP_EXTENSION_FILENAME = "pi-t3-mcp-extension.ts";
6
@@ -24,6 +25,7 @@ const TOKEN_ENV = ${JSON.stringify(T3_MCP_BEARER_ENV)};
25
const RUNTIME_MODE_ENV = ${JSON.stringify(T3_PI_RUNTIME_MODE_ENV)};
26
const EXTENSION_PATH_ENV = ${JSON.stringify(T3_PI_MCP_EXTENSION_PATH_ENV)};
27
const ORCHESTRATION_INSTRUCTIONS = ${JSON.stringify(T3_CODE_ORCHESTRATION_INSTRUCTIONS.trim())};
28
+const PULL_REQUEST_LINKING_INSTRUCTIONS = ${JSON.stringify(PULL_REQUEST_LINKING_INSTRUCTIONS)};
29
const SERVICE_TIER_COMMAND = ${JSON.stringify(PI_T3_SERVICE_TIER_COMMAND)};
30
const PROTOCOL = "2025-06-18";
31
const READ_ONLY_TOOLS = new Set(["read", "grep", "find", "ls"]);
@@ -497,13 +499,14 @@ export default async function t3McpExtension(pi: ExtensionAPI) {
499
// Keep guidance in the system prompt so leading slash commands still expand.
500
pi.on("before_agent_start", (event, ctx) => {
501
reconcileDiscovery(ctx);
502
+ const instructions = ORCHESTRATION_INSTRUCTIONS + "\\n\\n" + PULL_REQUEST_LINKING_INSTRUCTIONS;
503
const sections = event.systemPromptOptions?.sections;
504
if (sections && typeof sections === "object" && event.systemPromptOptions?.forceSystemPrompt === undefined) {
505
// A full prompt override bypasses Pi's later section rendering.
503
- sections.t3_code_orchestration = ORCHESTRATION_INSTRUCTIONS;
506
+ sections.t3_code_orchestration = instructions;
507
return undefined;
508
}
506
- return { systemPrompt: event.systemPrompt + "\\n\\n" + ORCHESTRATION_INSTRUCTIONS };
509
+ return { systemPrompt: event.systemPrompt + "\\n\\n" + instructions };
510
});
511
}
512
`;