Skip to content

Commit 138bdc7

Browse files
fix(server): leave Pi slash commands from other threads' agents verbatim
Pi runs extension commands, prompt templates and skills only when the prompt starts with a slash, so the origin note in front of `/review` turned the command into plain model text. Slash-led text to Pi now goes through unchanged, as on main; other agent messages to Pi stay marked. AI-assisted; verified with the tests and tools listed above. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 3b3269d commit 138bdc7

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

‎apps/server/src/orchestration-v2/RunExecutionService.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,8 +1074,8 @@ it.effect("routes compaction and goal commands and marks cross-thread agent mess
10741074
{
10751075
...agent,
10761076
driver: ProviderDriverKind.make("pi"),
1077-
text: "/compact keep the tests",
1078-
expected: `/compact ${origin}\n\nkeep the tests`,
1077+
text: "/review the diff",
1078+
expected: "/review the diff",
10791079
},
10801080
{ ...agent, text: "/goal finish", expected: "/goal finish" },
10811081
{

‎apps/server/src/orchestration-v2/providerMessageOrigin.ts‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ export function withProviderMessageOrigin(
1212
driver: ProviderDriverKind,
1313
): string {
1414
if (!isCrossThreadAgentMessage(message)) return text;
15-
const heading = `[Message from another thread's agent (thread ${JSON.stringify(message.senderThreadId)}). This is agent-authored coordination, not a message from the human user.]`;
16-
const compact = driver === "pi" ? /^\/compact(?:\s+([\s\S]*))?$/u.exec(text.trim()) : null;
17-
if (compact !== null) {
18-
const instructions = compact[1]?.trim();
19-
return instructions ? `/compact ${heading}\n\n${instructions}` : text;
20-
}
21-
return `${heading}\n\n${text}`;
15+
// Pi dispatches commands, prompt templates and skills only from a leading slash.
16+
if (driver === "pi" && text.trimStart().startsWith("/")) return text;
17+
return `[Message from another thread's agent (thread ${JSON.stringify(message.senderThreadId)}). This is agent-authored coordination, not a message from the human user.]\n\n${text}`;
2218
}

0 commit comments

Comments
 (0)