-
Notifications
You must be signed in to change notification settings - Fork 1
Task manager #511
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
Task manager #511
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
The new
task-managerworker.It is responsible for automatically creating GitHub issues for errors that meet certain thresholds.