Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/auggie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export type RunAuggieOptions = {
context?: GithubPullRequest;
/** The body of the comment that triggered this action, if triggered by a comment */
commentBody?: string;
/** The ID of the comment that triggered this action, if triggered by a comment */
commentId?: number;
};

/**
Expand All @@ -27,6 +29,7 @@ export async function runAuggie(options: RunAuggieOptions): Promise<string> {
workspaceRoot,
context,
commentBody,
commentId,
} = options;

const workspace = workspaceRoot || process.cwd();
Expand Down Expand Up @@ -70,6 +73,12 @@ export async function runAuggie(options: RunAuggieOptions): Promise<string> {
core.info("📨 User comment included in prompt");
}

// Add triggering comment ID if available
if (commentId) {
fullPrompt = `${fullPrompt}\n\n## Triggering Comment ID:\n${commentId}`;
core.info(`📍 Triggering comment ID: ${commentId}`);
}

// Add user prompt
fullPrompt = `${fullPrompt}\n\n${userPrompt}`;

Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async function main(): Promise<void> {
augmentApiUrl,
workspaceRoot,
commentBody,
commentId,
} = getAuggieParams();
const { owner, repo } = parseRepository();
const githubToken = process.env.GITHUB_TOKEN;
Expand All @@ -34,6 +35,7 @@ async function main(): Promise<void> {
apiUrl: augmentApiUrl,
workspaceRoot: workspaceRoot || undefined,
commentBody,
commentId,
});

core.info("✅ Auggie agent completed successfully");
Expand Down
3 changes: 3 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ type AuggieParams = {
augmentApiUrl: string;
workspaceRoot: string | undefined;
commentBody: string | undefined;
commentId: number | undefined;
};

/**
Expand All @@ -189,12 +190,14 @@ export function getAuggieParams(): AuggieParams {
const augmentApiUrl = getInput("augment_api_url", true);
const workspaceRoot = getInput("workspace_root");
const commentBody = getCommentBodyFromEvent();
const commentId = getCommentIdFromEvent();
return {
eventName,
prompt,
augmentApiKey,
augmentApiUrl,
workspaceRoot,
commentBody,
commentId,
}
}
16 changes: 13 additions & 3 deletions src/utils/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ Important: How you handle changes depends on the context:
- If you are working on a Pull Request (PR): You are allowed to commit directly to that PR's branch.
- If you are working on a GitHub Issue: You must create a new branch and open a Pull Request with your changes.

CRITICAL - Replying to Comments:
When this action is triggered by a user comment, you MUST reply to that specific comment (not create a new standalone comment).
- A "Triggering Comment ID" will be provided in the prompt context.
- Use this comment ID to create a REPLY to that comment using the GitHub API.
- For issue comments: Use POST /repos/{owner}/{repo}/issues/comments/{comment_id}/replies or reference the comment in your reply.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub issue/PR timeline comments don’t support true threaded replies, and there isn’t a POST /repos/{owner}/{repo}/issues/comments/{comment_id}/replies REST endpoint. As written, this may cause the agent to call a non-existent API instead of posting a normal comment that quotes/links the triggering comment.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 2e2096c. Updated the prompt to:

  1. Remove the non-existent endpoint - Removed reference to POST /repos/{owner}/{repo}/issues/comments/{comment_id}/replies which doesn't exist
  2. Clarify issue comment behavior - Issue/PR timeline comments don't support threaded replies; the agent should create a new comment and reference the triggering comment via quote or link
  3. Keep PR review comment threading - in_reply_to parameter still works for PR review comments (inline code comments)
  4. Updated workflow instructions - Made the workflow section consistent with the correct API usage

- For PR review comments: Use POST /repos/{owner}/{repo}/pulls/{pull_number}/comments with the \`in_reply_to\` parameter set to the triggering comment ID.
- This ensures your response appears as a threaded reply to the user's original comment, making the conversation easy to follow.
- If no triggering comment ID is provided, you may create a new comment.

Your workflow:
1. Add a comment to the PR letting the user know you're starting to work on it.
1. Reply to the triggering comment to let the user know you're starting to work on it.
- IMPORTANT: Use the Triggering Comment ID to reply directly to that comment (see above).
2. Read the PR context and understand the request.
3. Create a Todo List:
- Update the original comment on the PR with a todo list of what you're going to do. (Use the github-api tool to update the comment. Replace the initial message with the todo list.)
- Update your reply comment with a todo list of what you're going to do. (Use the github-api tool to update your reply comment.)
- Use your GitHub comment to maintain a detailed task list based on the request.
- Format todos as a checklist (- [ ] for incomplete, - [x] for complete).
- Update the comment with each task completion.
Expand All @@ -29,7 +39,7 @@ Your workflow:
- Files modified
- Links to PRs/commits
5. Final Comment Update (IMPORTANT):
- When you are completely done with all tasks, update the original comment ONE FINAL TIME.
- When you are completely done with all tasks, update your reply comment ONE FINAL TIME.
- REMOVE the entire task list/checklist from the comment.
- Replace the comment body with ONLY a concise, minimal final summary.
- Keep it brief: just state what was attempted and what was done.
Expand Down