@howaboua/pi-subagent-review 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howaboua/pi-subagent-review",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Pi extension that adds /review via an isolated review subagent.",
5
5
  "license": "MIT",
6
6
  "files": [
package/review.prompt.md CHANGED
@@ -8,6 +8,9 @@ Rules:
8
8
  - Prefer `git diff`, targeted file reads, and concrete evidence over assumptions.
9
9
  - Focus on actionable findings, not broad summaries.
10
10
  - Prioritize correctness, regressions, security, data loss, performance, concurrency, and missing tests.
11
+ - Be slightly lenient: include lower-severity but still concrete, actionable issues when they are supported by evidence.
12
+ - Do not stop after finding only one or two issues; keep looking for additional credible findings.
13
+ - Aim to surface roughly 5-15 issues if the diff supports that many, but never pad or invent findings.
11
14
  - Reference specific file paths and line ranges when possible.
12
15
  - Suggest the smallest credible fix when helpful.
13
16
  - If there are no actionable issues worth flagging, say that clearly.
@@ -15,7 +18,7 @@ Rules:
15
18
  Output format:
16
19
  # Review Findings
17
20
  - `[high|medium|low] path/to/file:start-end` - issue, why it matters, and the concrete fix
18
- - `[high|medium|low] path/to/file:start-end` - issue, why it matters, and the concrete fix
21
+ - ...continue with as many issue bullets as are warranted by the evidence
19
22
 
20
23
  If there are no actionable issues, output exactly:
21
24
 
@@ -37,7 +37,8 @@ export function registerReviewCommand(pi: ExtensionAPI) {
37
37
  }
38
38
 
39
39
  try {
40
- details = await runReviewSubagent(task, review.repoRoot, reviewConfig);
40
+ details = await runReviewSubagent(task, review.repoRoot, reviewConfig, ctx.signal);
41
+ if (ctx.signal?.aborted) return;
41
42
  const finalOutput = getFinalOutput(details.messages).trim() || "No actionable issues found.";
42
43
  if (isSubagentFailure(details)) throw new Error(details.errorMessage || details.stderr || finalOutput);
43
44
 
package/src/review.ts CHANGED
@@ -119,6 +119,9 @@ export function buildReviewTask(review: ReviewContext, extraFocus: string): stri
119
119
  sections.push(
120
120
  "",
121
121
  "Return prioritized, actionable findings only.",
122
+ "Be slightly lenient: include lower-severity but still concrete, actionable issues when supported by evidence.",
123
+ "Do not stop after finding only one or two issues; keep looking for additional credible findings.",
124
+ "Aim for roughly 5-15 issues if the diff supports that many, but do not pad or invent findings.",
122
125
  "Focus on correctness, regressions, security, data loss, performance, concurrency, and missing tests.",
123
126
  "Reference specific files and line ranges when possible.",
124
127
  "If there are no actionable issues worth flagging, say that clearly.",
package/src/subagent.ts CHANGED
@@ -18,7 +18,7 @@ export function getFinalOutput(messages: any[]): string {
18
18
  return "";
19
19
  }
20
20
 
21
- export async function runReviewSubagent(task: string, cwd: string, config: Required<ReviewConfig>) {
21
+ export async function runReviewSubagent(task: string, cwd: string, config: Required<ReviewConfig>, signal?: AbortSignal) {
22
22
  const details = createChildRunDetails(task, cwd, config);
23
23
  const args = [
24
24
  "--mode",
@@ -35,6 +35,7 @@ export async function runReviewSubagent(task: string, cwd: string, config: Requi
35
35
  const promptText = [
36
36
  "Run as the Review Subagent inside an isolated no-session RPC subprocess.",
37
37
  "Stay strictly in review mode. Do not edit files or propose implementation plans beyond concise fixes.",
38
+ "Do not stop after one or two findings; keep looking for additional credible issues, aiming for roughly 5-15 if warranted.",
38
39
  "Mode: review",
39
40
  `Task: ${task}`,
40
41
  ].join("\n\n");
@@ -146,6 +147,11 @@ export async function runReviewSubagent(task: string, cwd: string, config: Requi
146
147
  ]);
147
148
  };
148
149
 
150
+ const abortProcess = () => {
151
+ void stopProcess();
152
+ };
153
+ signal?.addEventListener("abort", abortProcess, { once: true });
154
+
149
155
  proc.stdout.on("data", (chunk) => {
150
156
  stdoutBuffer += chunk.toString();
151
157
  const lines = stdoutBuffer.split("\n");
@@ -172,13 +178,16 @@ export async function runReviewSubagent(task: string, cwd: string, config: Requi
172
178
  });
173
179
 
174
180
  try {
181
+ if (signal?.aborted) throw new Error(`${REVIEW_LABEL} aborted.`);
175
182
  await sendCommand({ type: "get_state" }, RPC_READY_TIMEOUT_MS);
183
+ if (signal?.aborted) throw new Error(`${REVIEW_LABEL} aborted.`);
176
184
  await sendCommand({ type: "set_auto_compaction", enabled: true });
177
185
  await sendCommand({ type: "set_auto_retry", enabled: true });
178
186
  await sendCommand({ type: "prompt", message: promptText });
179
187
  promptSent = true;
180
188
 
181
189
  while (true) {
190
+ if (signal?.aborted) throw new Error(`${REVIEW_LABEL} aborted.`);
182
191
  if (processClosed) break;
183
192
  await sleep(RPC_POLL_MS);
184
193
  let state: { isStreaming: boolean; isCompacting: boolean; pendingMessageCount: number };
@@ -193,6 +202,7 @@ export async function runReviewSubagent(task: string, cwd: string, config: Requi
193
202
  if (promptSent && agentEndCount > 0 && isIdle && isQuiet) break;
194
203
  }
195
204
  } finally {
205
+ signal?.removeEventListener("abort", abortProcess);
196
206
  await stopProcess();
197
207
  }
198
208