Merged
Conversation
Introduces a new worker at workers/task-manager that automatically creates GitHub issues for events meeting a threshold, with daily rate limiting and atomic usage tracking. Includes environment setup, documentation, and updates @hawk.so/types to v0.5.3.
Added GitHubService for authenticating as a GitHub App and creating issues via the GitHub API. Implemented formatting of issue data from events, including stacktrace and source code snippets. Updated TaskManagerWorker to use real GitHub issue creation and Copilot assignment, replacing previous mocked logic. Added environment variables for GitHub App configuration and updated documentation. Included tests for issue formatting.
Extracted GitHub App private key normalization to a utility for better reliability and CI compatibility. Enhanced Copilot assignment to use the GraphQL API and improved error handling. Refactored task creation flow to increment usage only after successful issue creation, updated dependencies, and fixed import paths.
…tion Introduces delegated user-to-server OAuth support for GitHub App integration in the task manager worker. Adds logic for handling delegated user tokens, including automatic refresh and fallback to installation tokens, and updates environment/configuration to support GitHub App OAuth credentials. Updates dependencies to include @octokit/oauth-methods and related packages.
Separated GitHub issue creation and Copilot agent assignment into distinct steps. The issue is now always created using the GitHub App installation token, and Copilot is assigned afterward using a user-to-server OAuth token if enabled. Updated the TaskManagerWorker logic to reflect this change, improved error handling, and updated the event saving logic to accurately reflect Copilot assignment status.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new task-manager worker that automatically creates GitHub issues for errors that meet configured thresholds. The worker integrates with GitHub's API using a GitHub App for issue creation and optionally assigns GitHub Copilot to created issues using delegated user OAuth tokens.
Changes:
- New task-manager worker with automatic issue creation for high-frequency errors
- GitHub API integration with token refresh and Copilot assignment support
- Daily rate limiting per project to prevent excessive issue creation
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Added dependencies for Octokit GitHub API client, jsonwebtoken, and dotenv upgrade |
| package.json | Updated dotenv version and added task-manager test/run scripts |
| workers/task-manager/types/task-manager-worker-task.ts | Type definition for task manager worker tasks |
| workers/task-manager/tests/issue.test.ts | Comprehensive tests for GitHub issue formatting (currently skipped) |
| workers/task-manager/src/utils/issue.ts | Utility to format GitHub issues from Hawk events with stacktrace info |
| workers/task-manager/src/utils/githubPrivateKey.ts | GitHub App private key normalization supporting multiple formats |
| workers/task-manager/src/env.ts | Environment variable loading configuration |
| workers/task-manager/src/index.ts | Main worker implementation with budget tracking and event processing |
| workers/task-manager/src/GithubService.ts | GitHub API service for issue creation, Copilot assignment, and token management |
| workers/task-manager/package.json | Package metadata and dependencies for the worker |
| workers/task-manager/README.md | Documentation for the worker's purpose and configuration |
| workers/task-manager/.env.example | Example environment variables (contains potentially real credentials) |
| workers/grouper/src/index.ts | Code style improvement - consolidated if-else block |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replaces Number() with parseInt() for MAX_AUTO_TASKS_PER_DAY to ensure correct parsing. Fixes event query to filter by timestamp using connectedAt, and enables the super.start() call. Also corrects a typo in a comment in GrouperWorker.
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.
The new
task-managerworker.It is responsible for automatically creating GitHub issues for errors that meet certain thresholds.