Commit 06d309fc599b

Vincent Demeester <vincent@sbr.pm>
2026-02-06 22:00:07
fix(pi): correct subagent execute parameter order (signal before onUpdate)
The correct parameter order for pi 0.52.6 is: execute(toolCallId, params, signal, onUpdate, ctx) NOT: execute(toolCallId, params, onUpdate, ctx, signal) Verified by checking git extension which works correctly. Previous commit had it backwards - I misread the breaking change note.
1 parent d952206
Changed files (1)
dots
pi
agent
extensions
subagent
dots/pi/agent/extensions/subagent/index.ts
@@ -420,7 +420,13 @@ export default function (pi: ExtensionAPI) {
 		].join(" "),
 		parameters: SubagentParams,
 
-		async execute(_toolCallId, params, onUpdate, ctx, signal) {
+		async execute(_toolCallId, params, signal, onUpdate, ctx) {
+			if (!ctx.cwd) {
+				return {
+					content: [{ type: "text", text: `Error: ctx.cwd is undefined. This should not happen.` }],
+					details: { mode: "single", agentScope: "user", projectAgentsDir: null, results: [] },
+				};
+			}
 			const agentScope: AgentScope = params.agentScope ?? "user";
 			const discovery = discoverAgents(ctx.cwd, agentScope);
 			const agents = discovery.agents;