Commit 3884e64732f3
Changed files (1)
dots
pi
agent
extensions
github
actions
dots/pi/agent/extensions/github/actions/issue.ts
@@ -141,25 +141,12 @@ export async function handleIssueView(
output += `\n## Description\n\n${data.body}\n`;
}
- // Get comments if any
- const commentsCount = data.comments?.totalCount ?? data.comments ?? 0;
- if (commentsCount > 0) {
- output += `\n## Comments (${commentsCount})\n`;
- // Fetch comments separately via gh issue view --comments
- const commentsResult = await execGh(pi, ctx,
- ["issue", "view", String(params.number), "--comments", "--json", "comments"],
- { signal, timeout: 20000 },
- );
- if (commentsResult.code === 0) {
- try {
- const commentsData = JSON.parse(commentsResult.stdout);
- const comments = commentsData.comments ?? [];
- for (const comment of comments) {
- output += `\n@${comment.author?.login ?? "?"} (${comment.createdAt ?? ""}):\n${comment.body}\n`;
- }
- } catch {
- output += "\n(Could not parse comments)\n";
- }
+ // Comments are already included in the initial JSON response as an array
+ const comments = Array.isArray(data.comments) ? data.comments : [];
+ if (comments.length > 0) {
+ output += `\n## Comments (${comments.length})\n`;
+ for (const comment of comments) {
+ output += `\n@${comment.author?.login ?? "?"} (${comment.createdAt ?? ""}):\n${comment.body}\n`;
}
}