Fix slackbot GitHub discussions search and turbopuffer authentication#1195
Merged
Fix slackbot GitHub discussions search and turbopuffer authentication#1195
Conversation
- Refactor GitHub functionality into organized module structure - Fix turbopuffer API key authentication via environment variable - Use GraphQL API for GitHub discussions search (REST endpoint doesn't exist) - Fix GitHubUser model handling in format_discussions_summary - Improve error handling to prevent stack traces leaking to Slack - Skip Prefect task wrapping for internal pydantic-ai tools - Add admin notifications for discussion creation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes critical bugs in the slackbot's GitHub integration and improves error handling. The main issues addressed are fixing GitHub discussions search (which was using a non-existent REST endpoint) and turbopuffer authentication setup.
Key changes:
- Fixed GitHub discussions search by implementing GraphQL API instead of non-existent REST endpoint
- Added automatic turbopuffer API key configuration through Prefect secrets
- Refactored GitHub functionality into a clean modular structure with proper error handling
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/slackbot/src/slackbot/wrap.py | Skip Prefect wrapping for internal pydantic-ai tools to prevent unnecessary overhead |
| examples/slackbot/src/slackbot/settings.py | Add turbopuffer API key auto-configuration and admin notification settings |
| examples/slackbot/src/slackbot/search.py | Remove duplicate GitHub code and turbopuffer auth, delegate to new GitHub module |
| examples/slackbot/src/slackbot/github/models.py | Define Pydantic models for GitHub entities (users, issues, discussions, etc.) |
| examples/slackbot/src/slackbot/github/issues.py | Implement GitHub issues search functionality with proper error handling |
| examples/slackbot/src/slackbot/github/exceptions.py | Define custom exception hierarchy for GitHub API errors |
| examples/slackbot/src/slackbot/github/discussions.py | Implement GitHub discussions search using GraphQL and discussion creation |
| examples/slackbot/src/slackbot/github/client.py | Centralized GitHub API client with authentication and error handling |
| examples/slackbot/src/slackbot/github/init.py | Module exports for GitHub functionality |
| examples/slackbot/src/slackbot/github.py | Remove old GitHub code (replaced by new modular structure) |
| examples/slackbot/src/slackbot/core.py | Add GitHub discussions tools and comprehensive error handling |
| examples/slackbot/src/slackbot/api.py | Add top-level error handling for agent execution |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Define named constants for body truncation lengths (BODY_TRUNCATE_LENGTH, BODY_DISPLAY_LENGTH) - Replace magic numbers with named constants for better maintainability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
🐛 Bug Fixes
searchfield withtype: DISCUSSION(REST endpoint/search/discussionsdoesn't exist)TURBOPUFFER_API_KEYenvironment variable from Prefect secret in settings validatorformat_discussions_summaryto handleGitHubUserPydantic models instead of dicts🏗️ Refactoring
client.py- Centralized GitHub API client with authmodels.py- Pydantic models for GitHub entitiesexceptions.py- Custom exception hierarchyissues.py- Issue search functionalitydiscussions.py- Discussion search and creationsearch.py⚡ Performance
final_resultTest Plan
🤖 Generated with Claude Code