Skip to content

Filter threads by installation name #355

Open
@bracesproul

Description

@bracesproul

We should update the threads fetcher to filter by the selected GH installation ID instead of all threads on the user

All new threads have a field on metadata: installation_name. This is the org/user name of whatever org/user the thread was created under. We should apply this filter when fetching threads to render

Agent Context { "tasks": [ { "id": "968c7481-3b4b-4d85-8c47-bf6727b85399", "taskIndex": 0, "request": "[original issue]\n**Filter threads by installation name**\nWe should update the threads fetcher to filter by the selected GH installation ID instead of all threads on the user\n\nAll new threads have a field on `metadata`: `installation_name`. This is the org/user name of whatever org/user the thread was created under. We should apply this filter when fetching threads to render", "title": "Filter threads by installation name using selected repository owner", "createdAt": 1751932626439, "completed": true, "planRevisions": [ { "revisionIndex": 0, "plans": [ { "index": 0, "plan": "Modify the getThreadSearchMetadata function in apps/web/src/providers/Thread.tsx to accept an optional installation name parameter and include it in the metadata filter when provided", "completed": true, "summary": "Modified the `getThreadSearchMetadata` function in `apps/web/src/providers/Thread.tsx` to accept an optional `installationName` parameter. The function now:\n\n- Added an optional second parameter `installationName?: string`\n- Updated return types to include `installation_name?: string` in both possible return objects\n- Modified the logic to conditionally include the `installation_name` field in the metadata filter when the parameter is provided\n- Maintains backward compatibility by preserving original behavior when no installation name is provided\n- Returns either `{ assistant_id: assistantId, installation_name: installationName }` or `{ graph_id: assistantId, installation_name: installationName }` when installation name is provided" }, { "index": 1, "plan": "Update the ThreadProvider component in apps/web/src/providers/Thread.tsx to access the selectedRepository from useGitHubAppProvider context and pass the repository owner as the installation name to the thread search metadata", "completed": true, "summary": "Modified the ThreadProvider component to integrate with the GitHub App Provider context:\n\n- Imported useGitHubAppProvider from \"./GitHubApp\" \n- Added useGitHubAppProvider hook to access selectedRepository in the ThreadProvider component\n- Extracted the repository owner from selectedRepository?.owner to use as the installation name\n- Updated the refreshThreads function to pass the installation name to getThreadSearchMetadata(assistantId, installationName)\n- Modified the useCallback dependency array to include selectedRepository?.owner so threads refresh when the selected repository changes\n\nThe ThreadProvider now properly filters threads by the selected GitHub installation using the repository owner as the installation name in the metadata search." }, { "index": 2, "plan": "Modify the useThreads hook in apps/web/src/hooks/useThreads.tsx to accept an optional installation name parameter and include it in the thread search metadata when provided", "completed": true, "summary": "Modified the useThreads hook to accept an optional installation name parameter and include it in the thread search metadata:\n\n- Added `installationName?: string` parameter to the useThreads hook function signature\n- Updated the getThreads function to conditionally include `installation_name` in the metadata filter when both assistantId and installationName are provided\n- Modified the search logic to create nested conditional metadata objects that include the installation_name field when the installationName parameter is present\n- Updated the useCallback dependency array to include both assistantId and installationName parameters to ensure the hook properly re-runs when either parameter changes\n\nThe implementation maintains backward compatibility by only including the installation_name in the metadata when the installationName parameter is provided, following the same pattern established in the ThreadProvider's getThreadSearchMetadata function." }, { "index": 3, "plan": "Update all usages of useThreads hook in apps/web/src/app/(v2)/chat/[thread_id]/page.tsx and apps/web/src/app/(v2)/chat/threads/page.tsx to pass the installation name from the selected repository owner via useGitHubAppProvider context", "completed": true, "summary": "Modified both page components to integrate with the GitHub App Provider context for thread filtering:\n\n**First file (apps/web/src/app/(v2)/chat/[thread_id]/page.tsx)**:\n- Added import for useGitHubAppProvider from \"@/providers/GitHubApp\"\n- Added useGitHubAppProvider hook to access selectedRepository\n- Updated the useThreads call to pass selectedRepository?.owner as the installation name parameter\n\n**Second file (apps/web/src/app/(v2)/chat/threads/page.tsx)**:\n- Added import for useGitHubAppProvider from \"@/providers/GitHubApp\" \n- Added useGitHubAppProvider hook to access selectedRepository\n- Updated the useThreads call to pass selectedRepository?.owner as the installation name parameter\n\nBoth files now properly filter threads by the selected GitHub installation using the repository owner as the installation name, enabling the thread filtering functionality described in the original issue." }, { "index": 4, "plan": "Run yarn lint:fix and yarn format to ensure code quality standards are met", "completed": true } ], "createdAt": 1751932626439, "createdBy": "agent" } ], "activeRevisionIndex": 0, "completedAt": 1751933385636, "summary": "## Summary\n\nSuccessfully implemented thread filtering by installation name across the codebase:\n\n**Key Changes Made:**\n- Modified `getThreadSearchMetadata` function in `Thread.tsx` to accept optional installation name parameter\n- Updated `ThreadProvider` to access selected repository from GitHub context and pass owner as installation name\n- Enhanced `useThreads` hook to accept installation name parameter and include it in search metadata\n- Updated thread pages to pass installation name from selected repository owner\n- Fixed syntax errors and removed unused variables to ensure code quality\n\n**Code Quality:**\n- Ran `yarn lint:fix` and `yarn format` successfully - all packages passed with no errors\n- Fixed malformed ternary operator structure and removed unused variables\n\nThe implementation now properly filters threads by the selected GitHub installation/organization instead of showing all user threads, improving the user experience by displaying only relevant threads for the current repository context." } ], "activeTaskIndex": 0 }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions