fix github label validation and error handling#1235
Conversation
**github labels fix:** - allow None for label description field (github api returns null sometimes) - fixes pydantic validation error when fetching issues with labels **error handling fix:** - remove ERROR_HANDLED completed state - errors now properly fail the flow after sending user-friendly message - maintains user experience while allowing proper monitoring/alerting 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
This PR ensures the Slackbot handles GitHub’s nullable label descriptions and improves error handling to allow flows to properly fail for monitoring.
- Allow GitHub label descriptions to be None to prevent Pydantic validation errors.
- Replace swallowing errors with a direct re-raise after notifying the user, removing the ERROR_HANDLED Completed state.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| examples/slackbot/src/slackbot/github/models.py | Model change: description now allows None to handle GitHub’s null label descriptions. |
| examples/slackbot/src/slackbot/api.py | Error handling updated to re-raise exceptions rather than returning a Completed(ERROR_HANDLED). |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| name: str = Field(default="") | ||
| color: str = Field(default="") | ||
| description: str = Field(default="") | ||
| description: str | None = Field(default="") |
There was a problem hiding this comment.
[nitpick] The field type allows None but the default remains an empty string. This mixes two different sentinel values for 'no description' and can confuse downstream consumers; consider setting the default to None to align with the Optional type.
| description: str | None = Field(default="") | |
| description: str | None = Field(default=None) |
| raise | ||
| finally: | ||
| try: | ||
| await mark_thread_completed(db, message_ts) |
There was a problem hiding this comment.
Because mark_thread_completed is in a finally block, it will run even when an exception is re-raised, marking the thread as completed on failure. If the intent is to signal a failed flow, move this call to the success path (outside finally) or add a separate failure path (e.g., mark_thread_failed) for the except branch.
summary
changes
github labels fix
GitHubLabel.descriptionnow acceptsstr | Nonenullfor label descriptionsInput should be a valid string [type=string_type, input_value=None]error handling fix
Completed(name="ERROR_HANDLED")patternwhy
proper failure states are important for:
🤖 Generated with Claude Code