Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Connect conversations to GitHub issues (#12) #47

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

vikaswakde
Copy link
Contributor

Implements GitHub integration for Helper, allowing users to:


  • Connect GitHub accounts to mailboxes
  • Select repositories for issue tracking
helperai-github-integration-demo.mov

  • Create GitHub issues from conversations
  • Link existing GitHub issues to conversations
  • Synchronize issue states between Helper and GitHub
helper-ai-github-issues-creation-demo.mp4

This integration enables teams to track support requests and bugs directly
from Helper conversations, with bidirectional synchronization ensuring
that issue status is always up-to-date in both systems.

Closes #12

conversationSummary?: string | string[] | null;
}

// Define the GitHub issue type
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think most of the comments in this PR are unnecessary, the code reads well on its own

updatedAt: string;
}

export const GitHubIssueButton = ({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please integrate this into the command bar instead, we're trying to avoid adding buttons. Ideally the form should work similarly to "add note" / tool execution

Screenshot 2025-03-09 at 21 54 12

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the button to now be in 'command bar' instead of in conversation tabs.

checkout this commit : 7a2b578

screenshot :
Screenshot 1403-12-20 at 9 08 49 AM

const [selectedIssueNumber, setSelectedIssueNumber] = useState<number | null>(null);

// Get conversation details to check if a GitHub issue is already linked
const { data: conversation, refetch: refetchConversation } = api.mailbox.conversations.get.useQuery(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be a bit nicer to use useConversationContext

Comment on lines +491 to +496
<>
<span className="inline-flex items-center rounded-full bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground mr-1">
Closed
</span>
<HumanizedTime time={conversation.closedAt ?? conversation.updatedAt} titlePrefix="Closed on" />
</>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't look related?

try {
setIsLoading(true);
setRepositories(
await utils.client.mailbox.github.repositories.query({
Copy link
Collaborator

Choose a reason for hiding this comment

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

useQuery should simplify the state handling here (or let me know if there's a reason you're not using it!)


return {
accessToken: data.access_token,
username: userResponse.data.login,
Copy link
Collaborator

@binary-koan binary-koan Mar 9, 2025

Choose a reason for hiding this comment

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

Why do we save the username?

Copy link
Collaborator

@binary-koan binary-koan left a comment

Choose a reason for hiding this comment

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

@vikaswakde _a Thanks for the PR, the functionality looks great! I've added some initial comments (in 2 reviews because I mis-clicked ...), could you take a look?

Apologies some of these weren't clear, we haven't had a chance to document things in detail yet

Comment on lines +126 to +127
console.error("Error listing repository issues:", error);
throw new Error("Failed to list issues for this repository");
Copy link
Collaborator

Choose a reason for hiding this comment

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

In general I think we can let things like this fail rather than having custom error handlers (if it's for the message, we should throw a tRPC error class in the procedure)

import { createGitHubIssue, getGitHubIssue, listRepositoryIssues, updateGitHubIssueState } from "@/lib/github/client";
import { mailboxProcedure } from "./procedure";

export const githubConversationsRouter = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about we nest this under conversations and use conversationProcedure


if (mailbox?.githubAccessToken) {
// Map conversation status to GitHub issue state
const githubState = updatedConversation.status === "closed" ? "closed" : "open";
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we should do this, "closed" for the conversation just means we've replied, not that the issue is fixed

Copy link
Collaborator

@binary-koan binary-koan left a comment

Choose a reason for hiding this comment

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

(misclick again, I need coffee ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connect conversation to GitHub
2 participants